UNPKG

@volcengine/pulumi

Version:

A Pulumi package for creating and managing volcengine cloud resources.

155 lines 8.61 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.ScalingPolicy = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a resource to manage scaling policy * ## 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({}); * const fooVpc = new volcengine.vpc.Vpc("fooVpc", { * vpcName: "acc-test-vpc", * cidrBlock: "172.16.0.0/16", * }); * 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, * }); * const fooScalingGroup = new volcengine.autoscaling.ScalingGroup("fooScalingGroup", { * scalingGroupName: "acc-test-scaling-group", * subnetIds: [fooSubnet.id], * multiAzPolicy: "BALANCE", * desireInstanceNumber: 0, * minInstanceNumber: 0, * maxInstanceNumber: 1, * instanceTerminatePolicy: "OldestInstance", * defaultCooldown: 10, * }); * const fooScalingPolicy = new volcengine.autoscaling.ScalingPolicy("fooScalingPolicy", { * active: false, * scalingGroupId: fooScalingGroup.id, * scalingPolicyName: "acc-tf-sg-policy-test", * scalingPolicyType: "Alarm", * adjustmentType: "QuantityChangeInCapacity", * adjustmentValue: 100, * cooldown: 10, * alarmPolicyRuleType: "Static", * alarmPolicyEvaluationCount: 1, * alarmPolicyConditionMetricName: "Instance_CpuBusy_Avg", * alarmPolicyConditionMetricUnit: "Percent", * alarmPolicyConditionComparisonOperator: "=", * alarmPolicyConditionThreshold: "100", * }); * ``` * * ## Import * * ScalingPolicy can be imported using the ScalingGroupId:ScalingPolicyId, e.g. * * ```sh * $ pulumi import volcengine:autoscaling/scalingPolicy:ScalingPolicy default scg-yblfbfhy7agh9zn72iaz:sp-yblf9l4fvcl8j1prohsp * ``` */ class ScalingPolicy extends pulumi.CustomResource { /** * Get an existing ScalingPolicy 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 ScalingPolicy(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of ScalingPolicy. 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'] === ScalingPolicy.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["active"] = state ? state.active : undefined; resourceInputs["adjustmentType"] = state ? state.adjustmentType : undefined; resourceInputs["adjustmentValue"] = state ? state.adjustmentValue : undefined; resourceInputs["alarmPolicyConditionComparisonOperator"] = state ? state.alarmPolicyConditionComparisonOperator : undefined; resourceInputs["alarmPolicyConditionMetricName"] = state ? state.alarmPolicyConditionMetricName : undefined; resourceInputs["alarmPolicyConditionMetricUnit"] = state ? state.alarmPolicyConditionMetricUnit : undefined; resourceInputs["alarmPolicyConditionThreshold"] = state ? state.alarmPolicyConditionThreshold : undefined; resourceInputs["alarmPolicyEvaluationCount"] = state ? state.alarmPolicyEvaluationCount : undefined; resourceInputs["alarmPolicyRuleType"] = state ? state.alarmPolicyRuleType : undefined; resourceInputs["cooldown"] = state ? state.cooldown : undefined; resourceInputs["scalingGroupId"] = state ? state.scalingGroupId : undefined; resourceInputs["scalingPolicyId"] = state ? state.scalingPolicyId : undefined; resourceInputs["scalingPolicyName"] = state ? state.scalingPolicyName : undefined; resourceInputs["scalingPolicyType"] = state ? state.scalingPolicyType : undefined; resourceInputs["scheduledPolicyLaunchTime"] = state ? state.scheduledPolicyLaunchTime : undefined; resourceInputs["scheduledPolicyRecurrenceEndTime"] = state ? state.scheduledPolicyRecurrenceEndTime : undefined; resourceInputs["scheduledPolicyRecurrenceType"] = state ? state.scheduledPolicyRecurrenceType : undefined; resourceInputs["scheduledPolicyRecurrenceValue"] = state ? state.scheduledPolicyRecurrenceValue : undefined; resourceInputs["status"] = state ? state.status : undefined; } else { const args = argsOrState; if ((!args || args.adjustmentType === undefined) && !opts.urn) { throw new Error("Missing required property 'adjustmentType'"); } if ((!args || args.adjustmentValue === undefined) && !opts.urn) { throw new Error("Missing required property 'adjustmentValue'"); } if ((!args || args.scalingGroupId === undefined) && !opts.urn) { throw new Error("Missing required property 'scalingGroupId'"); } if ((!args || args.scalingPolicyName === undefined) && !opts.urn) { throw new Error("Missing required property 'scalingPolicyName'"); } if ((!args || args.scalingPolicyType === undefined) && !opts.urn) { throw new Error("Missing required property 'scalingPolicyType'"); } resourceInputs["active"] = args ? args.active : undefined; resourceInputs["adjustmentType"] = args ? args.adjustmentType : undefined; resourceInputs["adjustmentValue"] = args ? args.adjustmentValue : undefined; resourceInputs["alarmPolicyConditionComparisonOperator"] = args ? args.alarmPolicyConditionComparisonOperator : undefined; resourceInputs["alarmPolicyConditionMetricName"] = args ? args.alarmPolicyConditionMetricName : undefined; resourceInputs["alarmPolicyConditionMetricUnit"] = args ? args.alarmPolicyConditionMetricUnit : undefined; resourceInputs["alarmPolicyConditionThreshold"] = args ? args.alarmPolicyConditionThreshold : undefined; resourceInputs["alarmPolicyEvaluationCount"] = args ? args.alarmPolicyEvaluationCount : undefined; resourceInputs["alarmPolicyRuleType"] = args ? args.alarmPolicyRuleType : undefined; resourceInputs["cooldown"] = args ? args.cooldown : undefined; resourceInputs["scalingGroupId"] = args ? args.scalingGroupId : undefined; resourceInputs["scalingPolicyName"] = args ? args.scalingPolicyName : undefined; resourceInputs["scalingPolicyType"] = args ? args.scalingPolicyType : undefined; resourceInputs["scheduledPolicyLaunchTime"] = args ? args.scheduledPolicyLaunchTime : undefined; resourceInputs["scheduledPolicyRecurrenceEndTime"] = args ? args.scheduledPolicyRecurrenceEndTime : undefined; resourceInputs["scheduledPolicyRecurrenceType"] = args ? args.scheduledPolicyRecurrenceType : undefined; resourceInputs["scheduledPolicyRecurrenceValue"] = args ? args.scheduledPolicyRecurrenceValue : undefined; resourceInputs["scalingPolicyId"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ScalingPolicy.__pulumiType, name, resourceInputs, opts); } } exports.ScalingPolicy = ScalingPolicy; /** @internal */ ScalingPolicy.__pulumiType = 'volcengine:autoscaling/scalingPolicy:ScalingPolicy'; //# sourceMappingURL=scalingPolicy.js.map