@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
229 lines • 11.1 kB
JavaScript
;
// *** 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");
/**
* Manages a volume resource within HuaweiCloud.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const availabilityZone = config.requireObject("availabilityZone");
* const volume = new huaweicloud.evs.Volume("volume", {
* description: "my volume",
* volumeType: "SAS",
* size: 20,
* availabilityZone: availabilityZone,
* tags: {
* foo: "bar",
* key: "value",
* },
* });
* ```
* ### With KMS Encryption
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const availabilityZone = config.requireObject("availabilityZone");
* const volume = new huaweicloud.evs.Volume("volume", {
* description: "my volume",
* volumeType: "SAS",
* size: 20,
* kmsId: _var.kms_id,
* availabilityZone: availabilityZone,
* tags: {
* foo: "bar",
* key: "value",
* },
* });
* ```
* ### With Server_id
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const imageId = config.requireObject("imageId");
* const flavorId = config.requireObject("flavorId");
* const keyPair = config.requireObject("keyPair");
* const securityGroupId = config.requireObject("securityGroupId");
* const availabilityZone = config.requireObject("availabilityZone");
* const subnetId = config.requireObject("subnetId");
* const myinstance = new huaweicloud.ecs.Instance("myinstance", {
* imageId: imageId,
* flavorId: flavorId,
* keyPair: keyPair,
* securityGroupIds: [securityGroupId],
* availabilityZone: availabilityZone,
* networks: [{
* uuid: subnetId,
* }],
* });
* const volume = new huaweicloud.evs.Volume("volume", {
* description: "my volume",
* volumeType: "SAS",
* size: 20,
* availabilityZone: availabilityZone,
* serverId: myinstance.id,
* tags: {
* foo: "bar",
* key: "value",
* },
* });
* ```
*
* ## Import
*
* Volumes can be imported using the `id`, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:Evs/volume:Volume test <id>
* ```
*
* Note that the imported state may not be identical to your resource definition, due to some attributes missing from the API response, security or some other reason. The missing attributes include`cascade`, `period_unit`, `period`, `server_id`, `auto_renew`, and `charging_mode`. It is generally recommended running terraform plan after importing a disk. You can then decide if changes should be applied to the disk, or the resource definition should be updated to align with the disk. Also, you can ignore changes as below. hcl resource "huaweicloud_evs_volume" "test" {
*
* ...
*
* lifecycle {
*
* ignore_changes = [
*
* cascade, period_unit, period, server_id, auto_renew, charging_mode,
*
* ]
*
* } }
*/
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["allMetadata"] = state ? state.allMetadata : undefined;
resourceInputs["allVolumeImageMetadata"] = state ? state.allVolumeImageMetadata : undefined;
resourceInputs["attachments"] = state ? state.attachments : undefined;
resourceInputs["autoPay"] = state ? state.autoPay : undefined;
resourceInputs["autoRenew"] = state ? state.autoRenew : undefined;
resourceInputs["availabilityZone"] = state ? state.availabilityZone : undefined;
resourceInputs["backupId"] = state ? state.backupId : undefined;
resourceInputs["bootable"] = state ? state.bootable : undefined;
resourceInputs["cascade"] = state ? state.cascade : undefined;
resourceInputs["chargingMode"] = state ? state.chargingMode : undefined;
resourceInputs["createdAt"] = state ? state.createdAt : undefined;
resourceInputs["dedicatedStorageId"] = state ? state.dedicatedStorageId : undefined;
resourceInputs["dedicatedStorageName"] = state ? state.dedicatedStorageName : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["deviceType"] = state ? state.deviceType : undefined;
resourceInputs["enterpriseProjectId"] = state ? state.enterpriseProjectId : undefined;
resourceInputs["imageId"] = state ? state.imageId : undefined;
resourceInputs["iops"] = state ? state.iops : undefined;
resourceInputs["iopsAttributes"] = state ? state.iopsAttributes : undefined;
resourceInputs["kmsId"] = state ? state.kmsId : undefined;
resourceInputs["links"] = state ? state.links : undefined;
resourceInputs["multiattach"] = state ? state.multiattach : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["period"] = state ? state.period : undefined;
resourceInputs["periodUnit"] = state ? state.periodUnit : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["serialNumber"] = state ? state.serialNumber : undefined;
resourceInputs["serverId"] = state ? state.serverId : undefined;
resourceInputs["serviceType"] = state ? state.serviceType : 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["throughput"] = state ? state.throughput : undefined;
resourceInputs["throughputAttributes"] = state ? state.throughputAttributes : undefined;
resourceInputs["updatedAt"] = state ? state.updatedAt : undefined;
resourceInputs["volumeType"] = state ? state.volumeType : undefined;
resourceInputs["wwn"] = state ? state.wwn : undefined;
}
else {
const args = argsOrState;
if ((!args || args.availabilityZone === undefined) && !opts.urn) {
throw new Error("Missing required property 'availabilityZone'");
}
if ((!args || args.volumeType === undefined) && !opts.urn) {
throw new Error("Missing required property 'volumeType'");
}
resourceInputs["autoPay"] = args ? args.autoPay : undefined;
resourceInputs["autoRenew"] = args ? args.autoRenew : undefined;
resourceInputs["availabilityZone"] = args ? args.availabilityZone : undefined;
resourceInputs["backupId"] = args ? args.backupId : undefined;
resourceInputs["cascade"] = args ? args.cascade : undefined;
resourceInputs["chargingMode"] = args ? args.chargingMode : undefined;
resourceInputs["dedicatedStorageId"] = args ? args.dedicatedStorageId : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["deviceType"] = args ? args.deviceType : undefined;
resourceInputs["enterpriseProjectId"] = args ? args.enterpriseProjectId : undefined;
resourceInputs["imageId"] = args ? args.imageId : undefined;
resourceInputs["iops"] = args ? args.iops : undefined;
resourceInputs["kmsId"] = args ? args.kmsId : undefined;
resourceInputs["multiattach"] = args ? args.multiattach : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["period"] = args ? args.period : undefined;
resourceInputs["periodUnit"] = args ? args.periodUnit : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["serverId"] = args ? args.serverId : undefined;
resourceInputs["size"] = args ? args.size : undefined;
resourceInputs["snapshotId"] = args ? args.snapshotId : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["throughput"] = args ? args.throughput : undefined;
resourceInputs["volumeType"] = args ? args.volumeType : undefined;
resourceInputs["allMetadata"] = undefined /*out*/;
resourceInputs["allVolumeImageMetadata"] = undefined /*out*/;
resourceInputs["attachments"] = undefined /*out*/;
resourceInputs["bootable"] = undefined /*out*/;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["dedicatedStorageName"] = undefined /*out*/;
resourceInputs["iopsAttributes"] = undefined /*out*/;
resourceInputs["links"] = undefined /*out*/;
resourceInputs["serialNumber"] = undefined /*out*/;
resourceInputs["serviceType"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
resourceInputs["throughputAttributes"] = undefined /*out*/;
resourceInputs["updatedAt"] = undefined /*out*/;
resourceInputs["wwn"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Volume.__pulumiType, name, resourceInputs, opts);
}
}
exports.Volume = Volume;
/** @internal */
Volume.__pulumiType = 'huaweicloud:Evs/volume:Volume';
//# sourceMappingURL=volume.js.map