UNPKG

@volcengine/pulumi

Version:

A Pulumi package for creating and managing volcengine cloud resources.

161 lines 6.25 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Attachment = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a resource to manage bandwidth package attachment * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as volcengine from "@pulumi/volcengine"; * import * as volcengine from "@volcengine/pulumi"; * * const fooAddress = new volcengine.eip.Address("fooAddress", { * billingType: "PostPaidByBandwidth", * bandwidth: 1, * isp: "BGP", * description: "acc-test", * projectName: "default", * }); * const ipv4BandwidthPackage = new volcengine.bandwidth_package.BandwidthPackage("ipv4BandwidthPackage", { * bandwidthPackageName: "acc-test-bp", * billingType: "PostPaidByBandwidth", * isp: "BGP", * description: "acc-test", * bandwidth: 2, * protocol: "IPv4", * tags: [{ * key: "k1", * value: "v1", * }], * }); * const ipv4Attachment = new volcengine.bandwidth_package.Attachment("ipv4Attachment", { * allocationId: fooAddress.id, * bandwidthPackageId: ipv4BandwidthPackage.id, * }); * const fooZones = volcengine.ecs.getZones({}); * const fooImages = volcengine.ecs.getImages({ * osType: "Linux", * visibility: "public", * instanceTypeId: "ecs.g1.large", * }); * const fooVpc = new volcengine.vpc.Vpc("fooVpc", { * vpcName: "acc-test-vpc", * cidrBlock: "172.16.0.0/16", * enableIpv6: true, * }); * const fooSubnet = new volcengine.vpc.Subnet("fooSubnet", { * subnetName: "acc-test-subnet", * cidrBlock: "172.16.0.0/24", * zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id), * vpcId: fooVpc.id, * ipv6CidrBlock: 1, * }); * const fooSecurityGroup = new volcengine.vpc.SecurityGroup("fooSecurityGroup", { * vpcId: fooVpc.id, * securityGroupName: "acc-test-security-group", * }); * const fooIpv6Gateway = new volcengine.vpc.Ipv6Gateway("fooIpv6Gateway", { * vpcId: fooVpc.id, * description: "test", * }); * const fooInstance = new volcengine.ecs.Instance("fooInstance", { * imageId: fooImages.then(fooImages => fooImages.images?.[0]?.imageId), * instanceType: "ecs.g1.large", * instanceName: "acc-test-ecs-name", * password: "93f0cb0614Aab12", * instanceChargeType: "PostPaid", * systemVolumeType: "ESSD_PL0", * systemVolumeSize: 40, * subnetId: fooSubnet.id, * securityGroupIds: [fooSecurityGroup.id], * ipv6AddressCount: 1, * }); * const fooIpv6Addresses = volcengine.vpc.getIpv6AddressesOutput({ * associatedInstanceId: fooInstance.id, * }); * const fooIpv6AddressBandwidth = new volcengine.vpc.Ipv6AddressBandwidth("fooIpv6AddressBandwidth", { * ipv6Address: fooIpv6Addresses.apply(fooIpv6Addresses => fooIpv6Addresses.ipv6Addresses?.[0]?.ipv6Address), * billingType: "PostPaidByBandwidth", * bandwidth: 5, * }); * const ipv6 = new volcengine.bandwidth_package.BandwidthPackage("ipv6", { * bandwidthPackageName: "acc-test-bp", * billingType: "PostPaidByBandwidth", * isp: "BGP", * description: "acc-test", * bandwidth: 2, * protocol: "IPv6", * tags: [{ * key: "k1", * value: "v1", * }], * }); * const fooAttachment = new volcengine.bandwidth_package.Attachment("fooAttachment", { * allocationId: fooIpv6AddressBandwidth.id, * bandwidthPackageId: ipv6.id, * }); * ``` * * ## Import * * BandwidthPackageAttachment can be imported using the bandwidth package id and eip id, e.g. * * ```sh * $ pulumi import volcengine:bandwidth_package/attachment:Attachment default BandwidthPackageId:EipId * ``` */ class Attachment extends pulumi.CustomResource { /** * Get an existing Attachment resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new Attachment(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Attachment. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Attachment.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["allocationId"] = state ? state.allocationId : undefined; resourceInputs["bandwidthPackageId"] = state ? state.bandwidthPackageId : undefined; } else { const args = argsOrState; if ((!args || args.allocationId === undefined) && !opts.urn) { throw new Error("Missing required property 'allocationId'"); } if ((!args || args.bandwidthPackageId === undefined) && !opts.urn) { throw new Error("Missing required property 'bandwidthPackageId'"); } resourceInputs["allocationId"] = args ? args.allocationId : undefined; resourceInputs["bandwidthPackageId"] = args ? args.bandwidthPackageId : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Attachment.__pulumiType, name, resourceInputs, opts); } } exports.Attachment = Attachment; /** @internal */ Attachment.__pulumiType = 'volcengine:bandwidth_package/attachment:Attachment'; //# sourceMappingURL=attachment.js.map