@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
156 lines • 7.59 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.Cluster = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages CDM cluster resource within HuaweiCloud.
*
* ## Example Usage
* ### create a cdm cluster
*
* ```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 name = config.requireObject("name");
* const flavorId = config.requireObject("flavorId");
* const availabilityZone = config.requireObject("availabilityZone");
* const vpcId = config.requireObject("vpcId");
* const subnetId = config.requireObject("subnetId");
* const secgroupId = config.requireObject("secgroupId");
* const test = huaweicloud.Cdm.getFlavors({});
* const cluster = new huaweicloud.cdm.Cluster("cluster", {
* availabilityZone: availabilityZone,
* flavorId: test.then(test => test.flavors?[0]?.id),
* subnetId: subnetId,
* vpcId: vpcId,
* securityGroupId: secgroupId,
* });
* ```
*
* ## Import
*
* Clusters can be imported by `id`. For example, bash
*
* ```sh
* $ pulumi import huaweicloud:Cdm/cluster:Cluster test b11b407c-e604-4e8d-8bc4-92398320b847
* ```
*
* 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`email` and `phone_num`.
*
* It is generally recommended running `terraform plan` after importing a cluster.
*
* You can then decide if changes should be applied to the cluster, or the resource definition should be updated to align with the cluster. Also you can ignore changes as below. hcl resource "huaweicloud_cdm_cluster" "test" {
*
* ...
*
* lifecycle {
*
* ignore_changes = [
*
* email, phone_num,
*
* ]
*
* } }
*/
class Cluster extends pulumi.CustomResource {
/**
* Get an existing Cluster 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 Cluster(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Cluster. 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'] === Cluster.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["availabilityZone"] = state ? state.availabilityZone : undefined;
resourceInputs["created"] = state ? state.created : undefined;
resourceInputs["emails"] = state ? state.emails : undefined;
resourceInputs["enterpriseProjectId"] = state ? state.enterpriseProjectId : undefined;
resourceInputs["flavorId"] = state ? state.flavorId : undefined;
resourceInputs["flavorName"] = state ? state.flavorName : undefined;
resourceInputs["instances"] = state ? state.instances : undefined;
resourceInputs["isAutoOff"] = state ? state.isAutoOff : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["phoneNums"] = state ? state.phoneNums : undefined;
resourceInputs["publicEndpoint"] = state ? state.publicEndpoint : undefined;
resourceInputs["publicIp"] = state ? state.publicIp : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["scheduleBootTime"] = state ? state.scheduleBootTime : undefined;
resourceInputs["scheduleOffTime"] = state ? state.scheduleOffTime : undefined;
resourceInputs["securityGroupId"] = state ? state.securityGroupId : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["subnetId"] = state ? state.subnetId : undefined;
resourceInputs["version"] = state ? state.version : 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.securityGroupId === undefined) && !opts.urn) {
throw new Error("Missing required property 'securityGroupId'");
}
if ((!args || args.subnetId === undefined) && !opts.urn) {
throw new Error("Missing required property 'subnetId'");
}
if ((!args || args.vpcId === undefined) && !opts.urn) {
throw new Error("Missing required property 'vpcId'");
}
resourceInputs["availabilityZone"] = args ? args.availabilityZone : undefined;
resourceInputs["emails"] = args ? args.emails : undefined;
resourceInputs["enterpriseProjectId"] = args ? args.enterpriseProjectId : undefined;
resourceInputs["flavorId"] = args ? args.flavorId : undefined;
resourceInputs["isAutoOff"] = args ? args.isAutoOff : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["phoneNums"] = args ? args.phoneNums : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["scheduleBootTime"] = args ? args.scheduleBootTime : undefined;
resourceInputs["scheduleOffTime"] = args ? args.scheduleOffTime : undefined;
resourceInputs["securityGroupId"] = args ? args.securityGroupId : undefined;
resourceInputs["subnetId"] = args ? args.subnetId : undefined;
resourceInputs["version"] = args ? args.version : undefined;
resourceInputs["vpcId"] = args ? args.vpcId : undefined;
resourceInputs["created"] = undefined /*out*/;
resourceInputs["flavorName"] = undefined /*out*/;
resourceInputs["instances"] = undefined /*out*/;
resourceInputs["publicEndpoint"] = undefined /*out*/;
resourceInputs["publicIp"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Cluster.__pulumiType, name, resourceInputs, opts);
}
}
exports.Cluster = Cluster;
/** @internal */
Cluster.__pulumiType = 'huaweicloud:Cdm/cluster:Cluster';
//# sourceMappingURL=cluster.js.map