@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
194 lines • 10.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.Instance = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a BMS instance resource within HuaweiCloud.
*
* ## Example Usage
* ### Basic Instance
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as huaweicloud from "@pulumi/huaweicloud";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const instanceName = config.requireObject("instanceName");
* const imageId = config.requireObject("imageId");
* const flavorId = config.requireObject("flavorId");
* const userId = config.requireObject("userId");
* const keyPair = config.requireObject("keyPair");
* const eipId = config.requireObject("eipId");
* const enterpriseProjectId = config.requireObject("enterpriseProjectId");
* const myaz = huaweicloud.getAvailabilityZones({});
* const myvpc = huaweicloud.Vpc.getVpc({
* name: "vpc-default",
* });
* const mynet = huaweicloud.Vpc.getSubnet({
* name: "subnet-default",
* });
* const mysecgroup = huaweicloud.Vpc.getSecgroup({
* name: "default",
* });
* const test = new huaweicloud.bms.Instance("test", {
* imageId: imageId,
* flavorId: flavorId,
* userId: userId,
* securityGroups: [mysecgroup.then(mysecgroup => mysecgroup.id)],
* availabilityZone: myaz.then(myaz => myaz.names?[0]),
* vpcId: myvpc.then(myvpc => myvpc.id),
* eipId: huaweicloud_vpc_eip.myeip.id,
* chargingMode: "prePaid",
* periodUnit: "month",
* period: 1,
* keyPair: keyPair,
* enterpriseProjectId: enterpriseProjectId,
* systemDiskSize: 150,
* systemDiskType: "SSD",
* dataDisks: [{
* type: "SSD",
* size: 100,
* }],
* nics: [{
* subnetId: mynet.then(mynet => mynet.id),
* ipAddress: "192.168.0.123",
* }],
* tags: {
* foo: "bar",
* key: "value",
* },
* });
* ```
*/
class Instance extends pulumi.CustomResource {
/**
* Get an existing Instance 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 Instance(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Instance. 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'] === Instance.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["adminPass"] = state ? state.adminPass : undefined;
resourceInputs["agencyName"] = state ? state.agencyName : undefined;
resourceInputs["autoRenew"] = state ? state.autoRenew : undefined;
resourceInputs["availabilityZone"] = state ? state.availabilityZone : undefined;
resourceInputs["bandwidthChargeMode"] = state ? state.bandwidthChargeMode : undefined;
resourceInputs["bandwidthSize"] = state ? state.bandwidthSize : undefined;
resourceInputs["chargingMode"] = state ? state.chargingMode : undefined;
resourceInputs["dataDisks"] = state ? state.dataDisks : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["diskIds"] = state ? state.diskIds : undefined;
resourceInputs["eipChargeMode"] = state ? state.eipChargeMode : undefined;
resourceInputs["eipId"] = state ? state.eipId : undefined;
resourceInputs["enterpriseProjectId"] = state ? state.enterpriseProjectId : undefined;
resourceInputs["flavorId"] = state ? state.flavorId : undefined;
resourceInputs["hostId"] = state ? state.hostId : undefined;
resourceInputs["imageId"] = state ? state.imageId : undefined;
resourceInputs["imageName"] = state ? state.imageName : undefined;
resourceInputs["iptype"] = state ? state.iptype : undefined;
resourceInputs["keyPair"] = state ? state.keyPair : undefined;
resourceInputs["metadata"] = state ? state.metadata : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["nics"] = state ? state.nics : undefined;
resourceInputs["period"] = state ? state.period : undefined;
resourceInputs["periodUnit"] = state ? state.periodUnit : undefined;
resourceInputs["publicIp"] = state ? state.publicIp : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["securityGroups"] = state ? state.securityGroups : undefined;
resourceInputs["sharetype"] = state ? state.sharetype : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["systemDiskSize"] = state ? state.systemDiskSize : undefined;
resourceInputs["systemDiskType"] = state ? state.systemDiskType : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["userData"] = state ? state.userData : undefined;
resourceInputs["userId"] = state ? state.userId : undefined;
resourceInputs["vpcId"] = state ? state.vpcId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.availabilityZone === undefined) && !opts.urn) {
throw new Error("Missing required property 'availabilityZone'");
}
if ((!args || args.flavorId === undefined) && !opts.urn) {
throw new Error("Missing required property 'flavorId'");
}
if ((!args || args.imageId === undefined) && !opts.urn) {
throw new Error("Missing required property 'imageId'");
}
if ((!args || args.nics === undefined) && !opts.urn) {
throw new Error("Missing required property 'nics'");
}
if ((!args || args.userId === undefined) && !opts.urn) {
throw new Error("Missing required property 'userId'");
}
if ((!args || args.vpcId === undefined) && !opts.urn) {
throw new Error("Missing required property 'vpcId'");
}
resourceInputs["adminPass"] = args ? args.adminPass : undefined;
resourceInputs["agencyName"] = args ? args.agencyName : undefined;
resourceInputs["autoRenew"] = args ? args.autoRenew : undefined;
resourceInputs["availabilityZone"] = args ? args.availabilityZone : undefined;
resourceInputs["bandwidthChargeMode"] = args ? args.bandwidthChargeMode : undefined;
resourceInputs["bandwidthSize"] = args ? args.bandwidthSize : undefined;
resourceInputs["chargingMode"] = args ? args.chargingMode : undefined;
resourceInputs["dataDisks"] = args ? args.dataDisks : undefined;
resourceInputs["eipChargeMode"] = args ? args.eipChargeMode : undefined;
resourceInputs["eipId"] = args ? args.eipId : undefined;
resourceInputs["enterpriseProjectId"] = args ? args.enterpriseProjectId : undefined;
resourceInputs["flavorId"] = args ? args.flavorId : undefined;
resourceInputs["imageId"] = args ? args.imageId : undefined;
resourceInputs["iptype"] = args ? args.iptype : undefined;
resourceInputs["keyPair"] = args ? args.keyPair : undefined;
resourceInputs["metadata"] = args ? args.metadata : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["nics"] = args ? args.nics : undefined;
resourceInputs["period"] = args ? args.period : undefined;
resourceInputs["periodUnit"] = args ? args.periodUnit : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["securityGroups"] = args ? args.securityGroups : undefined;
resourceInputs["sharetype"] = args ? args.sharetype : undefined;
resourceInputs["systemDiskSize"] = args ? args.systemDiskSize : undefined;
resourceInputs["systemDiskType"] = args ? args.systemDiskType : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["userData"] = args ? args.userData : undefined;
resourceInputs["userId"] = args ? args.userId : undefined;
resourceInputs["vpcId"] = args ? args.vpcId : undefined;
resourceInputs["description"] = undefined /*out*/;
resourceInputs["diskIds"] = undefined /*out*/;
resourceInputs["hostId"] = undefined /*out*/;
resourceInputs["imageName"] = undefined /*out*/;
resourceInputs["publicIp"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Instance.__pulumiType, name, resourceInputs, opts);
}
}
exports.Instance = Instance;
/** @internal */
Instance.__pulumiType = 'huaweicloud:Bms/instance:Instance';
//# sourceMappingURL=instance.js.map