@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
247 lines • 12.7 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.Group = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages an AS group resource within HuaweiCloud.
*
* ## Example Usage
* ### Basic Autoscaling Group
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const configurationId = config.requireObject("configurationId");
* const vpcId = config.requireObject("vpcId");
* const subnetId = config.requireObject("subnetId");
* const myAsGroup = new huaweicloud.as.Group("myAsGroup", {
* scalingGroupName: "my_as_group",
* scalingConfigurationId: configurationId,
* desireInstanceNumber: 2,
* minInstanceNumber: 0,
* maxInstanceNumber: 10,
* vpcId: vpcId,
* deletePublicip: true,
* deleteInstances: "yes",
* networks: [{
* id: subnetId,
* }],
* tags: {
* foo: "bar",
* key: "value",
* },
* });
* ```
* ### Autoscaling Group Only Remove Members When Scaling Down
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const configurationId = config.requireObject("configurationId");
* const vpcId = config.requireObject("vpcId");
* const subnetId = config.requireObject("subnetId");
* const myAsGroupOnlyRemoveMembers = new huaweicloud.as.Group("myAsGroupOnlyRemoveMembers", {
* scalingGroupName: "my_as_group_only_remove_members",
* scalingConfigurationId: configurationId,
* desireInstanceNumber: 2,
* minInstanceNumber: 0,
* maxInstanceNumber: 10,
* vpcId: vpcId,
* deletePublicip: true,
* deleteInstances: "no",
* networks: [{
* id: subnetId,
* }],
* });
* ```
* ### Autoscaling Group With Elastic Load Balancer Listener
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const configurationId = config.requireObject("configurationId");
* const vpcId = config.requireObject("vpcId");
* const subnetId = config.requireObject("subnetId");
* const ipv4SubnetId = config.requireObject("ipv4SubnetId");
* const testLoadbalancer = new huaweicloud.elb.Loadbalancer("testLoadbalancer", {vipSubnetId: ipv4SubnetId});
* const testListener = new huaweicloud.elb.Listener("testListener", {
* protocol: "HTTP",
* protocolPort: 8080,
* loadbalancerId: testLoadbalancer.id,
* });
* const testPool = new huaweicloud.elb.Pool("testPool", {
* protocol: "HTTP",
* lbMethod: "ROUND_ROBIN",
* listenerId: testListener.id,
* });
* const myAsGroupWithEnhancedLb = new huaweicloud.as.Group("myAsGroupWithEnhancedLb", {
* scalingGroupName: "my_as_group_with_enhanced_lb",
* scalingConfigurationId: configurationId,
* desireInstanceNumber: 2,
* minInstanceNumber: 0,
* maxInstanceNumber: 10,
* vpcId: vpcId,
* networks: [{
* id: subnetId,
* }],
* lbaasListeners: [{
* poolId: testPool.id,
* protocolPort: testListener.protocolPort,
* }],
* });
* ```
*
* ## Import
*
* AS groups can be imported by their `id`. For example, bash
*
* ```sh
* $ pulumi import huaweicloud:As/group:Group 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`delete_instances`. It is generally recommended running `terraform plan` after importing the resource. You can then decide if changes should be applied to the resource, or the resource definition should be updated to align with the group. Also, you can ignore changes as below. hcl resource "huaweicloud_as_group" "test" {
*
* ...
*
* lifecycle {
*
* ignore_changes = [
*
* delete_instances,
*
* ]
*
* } }
*/
class Group extends pulumi.CustomResource {
/**
* Get an existing Group 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 Group(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Group. 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'] === Group.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["activityType"] = state ? state.activityType : undefined;
resourceInputs["agencyName"] = state ? state.agencyName : undefined;
resourceInputs["availabilityZones"] = state ? state.availabilityZones : undefined;
resourceInputs["availableZones"] = state ? state.availableZones : undefined;
resourceInputs["coolDownTime"] = state ? state.coolDownTime : undefined;
resourceInputs["createTime"] = state ? state.createTime : undefined;
resourceInputs["currentInstanceNumber"] = state ? state.currentInstanceNumber : undefined;
resourceInputs["deleteInstances"] = state ? state.deleteInstances : undefined;
resourceInputs["deletePublicip"] = state ? state.deletePublicip : undefined;
resourceInputs["deleteVolume"] = state ? state.deleteVolume : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["desireInstanceNumber"] = state ? state.desireInstanceNumber : undefined;
resourceInputs["detail"] = state ? state.detail : undefined;
resourceInputs["enable"] = state ? state.enable : undefined;
resourceInputs["enterpriseProjectId"] = state ? state.enterpriseProjectId : undefined;
resourceInputs["forceDelete"] = state ? state.forceDelete : undefined;
resourceInputs["healthPeriodicAuditGracePeriod"] = state ? state.healthPeriodicAuditGracePeriod : undefined;
resourceInputs["healthPeriodicAuditMethod"] = state ? state.healthPeriodicAuditMethod : undefined;
resourceInputs["healthPeriodicAuditTime"] = state ? state.healthPeriodicAuditTime : undefined;
resourceInputs["instanceTerminatePolicy"] = state ? state.instanceTerminatePolicy : undefined;
resourceInputs["instances"] = state ? state.instances : undefined;
resourceInputs["isScaling"] = state ? state.isScaling : undefined;
resourceInputs["lbListenerId"] = state ? state.lbListenerId : undefined;
resourceInputs["lbaasListeners"] = state ? state.lbaasListeners : undefined;
resourceInputs["maxInstanceNumber"] = state ? state.maxInstanceNumber : undefined;
resourceInputs["minInstanceNumber"] = state ? state.minInstanceNumber : undefined;
resourceInputs["multiAzScalingPolicy"] = state ? state.multiAzScalingPolicy : undefined;
resourceInputs["networks"] = state ? state.networks : undefined;
resourceInputs["notifications"] = state ? state.notifications : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["scalingConfigurationId"] = state ? state.scalingConfigurationId : undefined;
resourceInputs["scalingConfigurationName"] = state ? state.scalingConfigurationName : undefined;
resourceInputs["scalingGroupName"] = state ? state.scalingGroupName : undefined;
resourceInputs["securityGroups"] = state ? state.securityGroups : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["vpcId"] = state ? state.vpcId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.networks === undefined) && !opts.urn) {
throw new Error("Missing required property 'networks'");
}
if ((!args || args.scalingGroupName === undefined) && !opts.urn) {
throw new Error("Missing required property 'scalingGroupName'");
}
if ((!args || args.vpcId === undefined) && !opts.urn) {
throw new Error("Missing required property 'vpcId'");
}
resourceInputs["agencyName"] = args ? args.agencyName : undefined;
resourceInputs["availabilityZones"] = args ? args.availabilityZones : undefined;
resourceInputs["availableZones"] = args ? args.availableZones : undefined;
resourceInputs["coolDownTime"] = args ? args.coolDownTime : undefined;
resourceInputs["deleteInstances"] = args ? args.deleteInstances : undefined;
resourceInputs["deletePublicip"] = args ? args.deletePublicip : undefined;
resourceInputs["deleteVolume"] = args ? args.deleteVolume : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["desireInstanceNumber"] = args ? args.desireInstanceNumber : undefined;
resourceInputs["enable"] = args ? args.enable : undefined;
resourceInputs["enterpriseProjectId"] = args ? args.enterpriseProjectId : undefined;
resourceInputs["forceDelete"] = args ? args.forceDelete : undefined;
resourceInputs["healthPeriodicAuditGracePeriod"] = args ? args.healthPeriodicAuditGracePeriod : undefined;
resourceInputs["healthPeriodicAuditMethod"] = args ? args.healthPeriodicAuditMethod : undefined;
resourceInputs["healthPeriodicAuditTime"] = args ? args.healthPeriodicAuditTime : undefined;
resourceInputs["instanceTerminatePolicy"] = args ? args.instanceTerminatePolicy : undefined;
resourceInputs["lbListenerId"] = args ? args.lbListenerId : undefined;
resourceInputs["lbaasListeners"] = args ? args.lbaasListeners : undefined;
resourceInputs["maxInstanceNumber"] = args ? args.maxInstanceNumber : undefined;
resourceInputs["minInstanceNumber"] = args ? args.minInstanceNumber : undefined;
resourceInputs["multiAzScalingPolicy"] = args ? args.multiAzScalingPolicy : undefined;
resourceInputs["networks"] = args ? args.networks : undefined;
resourceInputs["notifications"] = args ? args.notifications : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["scalingConfigurationId"] = args ? args.scalingConfigurationId : undefined;
resourceInputs["scalingGroupName"] = args ? args.scalingGroupName : undefined;
resourceInputs["securityGroups"] = args ? args.securityGroups : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["vpcId"] = args ? args.vpcId : undefined;
resourceInputs["activityType"] = undefined /*out*/;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["currentInstanceNumber"] = undefined /*out*/;
resourceInputs["detail"] = undefined /*out*/;
resourceInputs["instances"] = undefined /*out*/;
resourceInputs["isScaling"] = undefined /*out*/;
resourceInputs["scalingConfigurationName"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Group.__pulumiType, name, resourceInputs, opts);
}
}
exports.Group = Group;
/** @internal */
Group.__pulumiType = 'huaweicloud:As/group:Group';
//# sourceMappingURL=group.js.map