UNPKG

@volcengine/pulumi

Version:

A Pulumi package for creating and managing volcengine cloud resources.

196 lines 8.62 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.Volume = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as volcengine from "@pulumi/volcengine"; * import * as volcengine from "@volcengine/pulumi"; * * const fooZones = volcengine.ecs.getZones({}); * // create vpc * const fooVpc = new volcengine.vpc.Vpc("fooVpc", { * vpcName: "acc-test-vpc", * cidrBlock: "172.16.0.0/16", * }); * // create subnet * 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, * }); * // create security group * const fooSecurityGroup = new volcengine.vpc.SecurityGroup("fooSecurityGroup", { * securityGroupName: "acc-test-security-group", * vpcId: fooVpc.id, * }); * const fooImages = volcengine.ecs.getImages({ * osType: "Linux", * visibility: "public", * instanceTypeId: "ecs.g3il.large", * }); * // create PrePaid ecs instance * const fooInstance = new volcengine.ecs.Instance("fooInstance", { * instanceName: "acc-test-ecs", * description: "acc-test", * hostName: "tf-acc-test", * imageId: fooImages.then(fooImages => fooImages.images?.[0]?.imageId), * instanceType: "ecs.g3il.large", * password: "93f0cb0614Aab12", * instanceChargeType: "PrePaid", * period: 1, * systemVolumeType: "ESSD_PL0", * systemVolumeSize: 40, * subnetId: fooSubnet.id, * securityGroupIds: [fooSecurityGroup.id], * projectName: "default", * tags: [{ * key: "k1", * value: "v1", * }], * }); * // create PrePaid data volume * const preVolume = new volcengine.ebs.Volume("preVolume", { * volumeName: "acc-test-volume", * volumeType: "ESSD_PL0", * description: "acc-test", * kind: "data", * size: 40, * zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id), * volumeChargeType: "PrePaid", * instanceId: fooInstance.id, * projectName: "default", * deleteWithInstance: true, * tags: [{ * key: "k1", * value: "v1", * }], * }); * // create PostPaid data volume * const postVolume = new volcengine.ebs.Volume("postVolume", { * volumeName: "acc-test-volume", * volumeType: "ESSD_PL0", * description: "acc-test", * kind: "data", * size: 40, * zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id), * volumeChargeType: "PostPaid", * projectName: "default", * tags: [{ * key: "k1", * value: "v1", * }], * }); * // attach PostPaid data volume to ecs instance * const fooVolumeAttach = new volcengine.ebs.VolumeAttach("fooVolumeAttach", { * instanceId: fooInstance.id, * volumeId: postVolume.id, * }); * ``` * * ## Import * * Volume can be imported using the id, e.g. * * ```sh * $ pulumi import volcengine:ebs/volume:Volume default vol-mizl7m1kqccg5smt1bdpijuj * ``` */ class Volume extends pulumi.CustomResource { /** * Get an existing Volume 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 Volume(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Volume. 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'] === Volume.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["createdAt"] = state ? state.createdAt : undefined; resourceInputs["deleteWithInstance"] = state ? state.deleteWithInstance : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["extraPerformanceIops"] = state ? state.extraPerformanceIops : undefined; resourceInputs["extraPerformanceThroughputMb"] = state ? state.extraPerformanceThroughputMb : undefined; resourceInputs["extraPerformanceTypeId"] = state ? state.extraPerformanceTypeId : undefined; resourceInputs["instanceId"] = state ? state.instanceId : undefined; resourceInputs["kind"] = state ? state.kind : undefined; resourceInputs["projectName"] = state ? state.projectName : undefined; resourceInputs["size"] = state ? state.size : undefined; resourceInputs["snapshotId"] = state ? state.snapshotId : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["tradeStatus"] = state ? state.tradeStatus : undefined; resourceInputs["volumeChargeType"] = state ? state.volumeChargeType : undefined; resourceInputs["volumeName"] = state ? state.volumeName : undefined; resourceInputs["volumeType"] = state ? state.volumeType : undefined; resourceInputs["zoneId"] = state ? state.zoneId : undefined; } else { const args = argsOrState; if ((!args || args.kind === undefined) && !opts.urn) { throw new Error("Missing required property 'kind'"); } if ((!args || args.size === undefined) && !opts.urn) { throw new Error("Missing required property 'size'"); } if ((!args || args.volumeName === undefined) && !opts.urn) { throw new Error("Missing required property 'volumeName'"); } if ((!args || args.volumeType === undefined) && !opts.urn) { throw new Error("Missing required property 'volumeType'"); } if ((!args || args.zoneId === undefined) && !opts.urn) { throw new Error("Missing required property 'zoneId'"); } resourceInputs["deleteWithInstance"] = args ? args.deleteWithInstance : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["extraPerformanceIops"] = args ? args.extraPerformanceIops : undefined; resourceInputs["extraPerformanceThroughputMb"] = args ? args.extraPerformanceThroughputMb : undefined; resourceInputs["extraPerformanceTypeId"] = args ? args.extraPerformanceTypeId : undefined; resourceInputs["instanceId"] = args ? args.instanceId : undefined; resourceInputs["kind"] = args ? args.kind : undefined; resourceInputs["projectName"] = args ? args.projectName : undefined; resourceInputs["size"] = args ? args.size : undefined; resourceInputs["snapshotId"] = args ? args.snapshotId : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["volumeChargeType"] = args ? args.volumeChargeType : undefined; resourceInputs["volumeName"] = args ? args.volumeName : undefined; resourceInputs["volumeType"] = args ? args.volumeType : undefined; resourceInputs["zoneId"] = args ? args.zoneId : undefined; resourceInputs["createdAt"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; resourceInputs["tradeStatus"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Volume.__pulumiType, name, resourceInputs, opts); } } exports.Volume = Volume; /** @internal */ Volume.__pulumiType = 'volcengine:ebs/volume:Volume'; //# sourceMappingURL=volume.js.map