@volcengine/pulumi
Version:
A Pulumi package for creating and managing volcengine cloud resources.
333 lines (332 loc) • 20.4 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
/**
* 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
* ```
*/
export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: ScalingPolicyState, opts?: pulumi.CustomResourceOptions): ScalingPolicy;
/**
* 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: any): obj is ScalingPolicy;
/**
* The active flag of the scaling policy. [Warning] the scaling policy can be active only when the scaling group be active otherwise will fail.
*/
readonly active: pulumi.Output<boolean>;
/**
* The adjustment type of the scaling policy. Valid values: QuantityChangeInCapacity, PercentChangeInCapacity, TotalCapacity.
*/
readonly adjustmentType: pulumi.Output<string>;
/**
* The adjustment value of the scaling policy. When the value of the `AdjustmentType` parameter is `QuantityChangeInCapacity`: -100 ~ 100, 0 is not allowed, unit: piece. When the value of the `AdjustmentType` parameter is `PercentChangeInCapacity`: -100 ~ 10000, 0 is not allowed, unit: %. When the value of the `AdjustmentType` parameter is `TotalCapacity`: the default is 0 to 100, unit: piece.
*/
readonly adjustmentValue: pulumi.Output<number>;
/**
* The comparison operator of the alarm policy condition of the scaling policy. Valid values: `>`, `<`, `=`. It is only valid and required when the value of `ScalingPolicyType` is `Alarm`.
*/
readonly alarmPolicyConditionComparisonOperator: pulumi.Output<string | undefined>;
/**
* The metric name of the alarm policy condition of the scaling policy. Valid values: CpuTotal_Max, CpuTotal_Min, CpuTotal_Avg, MemoryUsedUtilization_Max, MemoryUsedUtilization_Min, MemoryUsedUtilization_Avg, Instance_CpuBusy_Max, Instance_CpuBusy_Min, Instance_CpuBusy_Avg.
*/
readonly alarmPolicyConditionMetricName: pulumi.Output<string | undefined>;
/**
* The comparison operator of the alarm policy condition of the scaling policy. It is only valid and required when the value of `ScalingPolicyType` is `Alarm`.
*/
readonly alarmPolicyConditionMetricUnit: pulumi.Output<string | undefined>;
/**
* The threshold of the alarm policy condition of the scaling policy. It is only valid and required when the value of `ScalingPolicyType` is `Alarm`.
*/
readonly alarmPolicyConditionThreshold: pulumi.Output<string | undefined>;
/**
* The evaluation count of the alarm policy of the scaling policy. It is only valid and required when the value of `ScalingPolicyType` is `Alarm`.
*/
readonly alarmPolicyEvaluationCount: pulumi.Output<number | undefined>;
/**
* The rule type of the alarm policy of the scaling policy. Valid value: Static. It is only valid and required when the value of `ScalingPolicyType` is `Alarm`.
*/
readonly alarmPolicyRuleType: pulumi.Output<string | undefined>;
/**
* The cooldown of the scaling policy. Default value is the cooldown time of the scaling group. Value: 0~86400, unit: second, if left blank, the cooling time of the scaling group will be used by default.
*/
readonly cooldown: pulumi.Output<number>;
/**
* The id of the scaling group to which the scaling policy belongs.
*/
readonly scalingGroupId: pulumi.Output<string>;
/**
* The id of the scaling policy.
*/
readonly scalingPolicyId: pulumi.Output<string>;
/**
* The name of the scaling policy.
*/
readonly scalingPolicyName: pulumi.Output<string>;
/**
* The type of scaling policy. Valid values: Scheduled, Recurrence, Alarm.
*/
readonly scalingPolicyType: pulumi.Output<string>;
/**
* The launch time of the scheduled policy of the scaling policy.
* When the value of `ScalingPolicyType` is `Scheduled`, it means that the trigger time of the scheduled task must be greater than the current time.
* When the value of `ScalingPolicyType` is `Recurrence`: If `ScheduledPolicy.RecurrenceType` is not specified, it means to execute only once according to the date and time specified here.
* If `ScheduledPolicy.RecurrenceType` is specified, it indicates the start time of the periodic task. Only the time within 90 days from the date of creation/modification is supported.
* When the value of `ScalingPolicyType` is `Alarm`, this parameter is invalid.
*/
readonly scheduledPolicyLaunchTime: pulumi.Output<string>;
/**
* The recurrence end time of the scheduled policy of the scaling policy. Valid and required when `ScalingPolicyType` is `Recurrence`. If not configured, it will default to the day/week/month after this moment according to the recurrence period (ScheduledPolicy.RecurrenceType).
*/
readonly scheduledPolicyRecurrenceEndTime: pulumi.Output<string | undefined>;
/**
* The recurrence type the scheduled policy of the scaling policy. Valid values: Daily, Weekly, Monthly, Cron.
*/
readonly scheduledPolicyRecurrenceType: pulumi.Output<string | undefined>;
/**
* The recurrence value the scheduled policy of the scaling policy. Valid and required when `ScalingPolicyType` is `Recurrence`. When the value of the ScheduledPolicy.RecurrenceType parameter is Daily, only one value can be filled in, ranging from 1 to 31.
* When the value of the ScheduledPolicy.RecurrenceType parameter is Weekly, you can enter multiple values separated by commas (,). The values from Monday to Sunday are: 1,2,3,4,5,6,7.
* When the value of the ScheduledPolicy.RecurrenceType parameter is Monthly, the format is A-B. The value ranges of A and B are both 1~31, and B must be greater than or equal to A.
* When the value of the ScheduledPolicy.RecurrenceType parameter is Cron, it means UTC+8 time, supports 5-field expressions of minutes, hours, days, months, and weeks, and supports wildcard English commas (,), English question marks (?), and conjunctions ( -), asterisk (*), pound sign (#), slash (/), L, and W.
*/
readonly scheduledPolicyRecurrenceValue: pulumi.Output<string | undefined>;
/**
* The status of the scaling policy. Valid values: Active, InActive.
*/
readonly status: pulumi.Output<string>;
/**
* Create a ScalingPolicy resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: ScalingPolicyArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering ScalingPolicy resources.
*/
export interface ScalingPolicyState {
/**
* The active flag of the scaling policy. [Warning] the scaling policy can be active only when the scaling group be active otherwise will fail.
*/
active?: pulumi.Input<boolean>;
/**
* The adjustment type of the scaling policy. Valid values: QuantityChangeInCapacity, PercentChangeInCapacity, TotalCapacity.
*/
adjustmentType?: pulumi.Input<string>;
/**
* The adjustment value of the scaling policy. When the value of the `AdjustmentType` parameter is `QuantityChangeInCapacity`: -100 ~ 100, 0 is not allowed, unit: piece. When the value of the `AdjustmentType` parameter is `PercentChangeInCapacity`: -100 ~ 10000, 0 is not allowed, unit: %. When the value of the `AdjustmentType` parameter is `TotalCapacity`: the default is 0 to 100, unit: piece.
*/
adjustmentValue?: pulumi.Input<number>;
/**
* The comparison operator of the alarm policy condition of the scaling policy. Valid values: `>`, `<`, `=`. It is only valid and required when the value of `ScalingPolicyType` is `Alarm`.
*/
alarmPolicyConditionComparisonOperator?: pulumi.Input<string>;
/**
* The metric name of the alarm policy condition of the scaling policy. Valid values: CpuTotal_Max, CpuTotal_Min, CpuTotal_Avg, MemoryUsedUtilization_Max, MemoryUsedUtilization_Min, MemoryUsedUtilization_Avg, Instance_CpuBusy_Max, Instance_CpuBusy_Min, Instance_CpuBusy_Avg.
*/
alarmPolicyConditionMetricName?: pulumi.Input<string>;
/**
* The comparison operator of the alarm policy condition of the scaling policy. It is only valid and required when the value of `ScalingPolicyType` is `Alarm`.
*/
alarmPolicyConditionMetricUnit?: pulumi.Input<string>;
/**
* The threshold of the alarm policy condition of the scaling policy. It is only valid and required when the value of `ScalingPolicyType` is `Alarm`.
*/
alarmPolicyConditionThreshold?: pulumi.Input<string>;
/**
* The evaluation count of the alarm policy of the scaling policy. It is only valid and required when the value of `ScalingPolicyType` is `Alarm`.
*/
alarmPolicyEvaluationCount?: pulumi.Input<number>;
/**
* The rule type of the alarm policy of the scaling policy. Valid value: Static. It is only valid and required when the value of `ScalingPolicyType` is `Alarm`.
*/
alarmPolicyRuleType?: pulumi.Input<string>;
/**
* The cooldown of the scaling policy. Default value is the cooldown time of the scaling group. Value: 0~86400, unit: second, if left blank, the cooling time of the scaling group will be used by default.
*/
cooldown?: pulumi.Input<number>;
/**
* The id of the scaling group to which the scaling policy belongs.
*/
scalingGroupId?: pulumi.Input<string>;
/**
* The id of the scaling policy.
*/
scalingPolicyId?: pulumi.Input<string>;
/**
* The name of the scaling policy.
*/
scalingPolicyName?: pulumi.Input<string>;
/**
* The type of scaling policy. Valid values: Scheduled, Recurrence, Alarm.
*/
scalingPolicyType?: pulumi.Input<string>;
/**
* The launch time of the scheduled policy of the scaling policy.
* When the value of `ScalingPolicyType` is `Scheduled`, it means that the trigger time of the scheduled task must be greater than the current time.
* When the value of `ScalingPolicyType` is `Recurrence`: If `ScheduledPolicy.RecurrenceType` is not specified, it means to execute only once according to the date and time specified here.
* If `ScheduledPolicy.RecurrenceType` is specified, it indicates the start time of the periodic task. Only the time within 90 days from the date of creation/modification is supported.
* When the value of `ScalingPolicyType` is `Alarm`, this parameter is invalid.
*/
scheduledPolicyLaunchTime?: pulumi.Input<string>;
/**
* The recurrence end time of the scheduled policy of the scaling policy. Valid and required when `ScalingPolicyType` is `Recurrence`. If not configured, it will default to the day/week/month after this moment according to the recurrence period (ScheduledPolicy.RecurrenceType).
*/
scheduledPolicyRecurrenceEndTime?: pulumi.Input<string>;
/**
* The recurrence type the scheduled policy of the scaling policy. Valid values: Daily, Weekly, Monthly, Cron.
*/
scheduledPolicyRecurrenceType?: pulumi.Input<string>;
/**
* The recurrence value the scheduled policy of the scaling policy. Valid and required when `ScalingPolicyType` is `Recurrence`. When the value of the ScheduledPolicy.RecurrenceType parameter is Daily, only one value can be filled in, ranging from 1 to 31.
* When the value of the ScheduledPolicy.RecurrenceType parameter is Weekly, you can enter multiple values separated by commas (,). The values from Monday to Sunday are: 1,2,3,4,5,6,7.
* When the value of the ScheduledPolicy.RecurrenceType parameter is Monthly, the format is A-B. The value ranges of A and B are both 1~31, and B must be greater than or equal to A.
* When the value of the ScheduledPolicy.RecurrenceType parameter is Cron, it means UTC+8 time, supports 5-field expressions of minutes, hours, days, months, and weeks, and supports wildcard English commas (,), English question marks (?), and conjunctions ( -), asterisk (*), pound sign (#), slash (/), L, and W.
*/
scheduledPolicyRecurrenceValue?: pulumi.Input<string>;
/**
* The status of the scaling policy. Valid values: Active, InActive.
*/
status?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a ScalingPolicy resource.
*/
export interface ScalingPolicyArgs {
/**
* The active flag of the scaling policy. [Warning] the scaling policy can be active only when the scaling group be active otherwise will fail.
*/
active?: pulumi.Input<boolean>;
/**
* The adjustment type of the scaling policy. Valid values: QuantityChangeInCapacity, PercentChangeInCapacity, TotalCapacity.
*/
adjustmentType: pulumi.Input<string>;
/**
* The adjustment value of the scaling policy. When the value of the `AdjustmentType` parameter is `QuantityChangeInCapacity`: -100 ~ 100, 0 is not allowed, unit: piece. When the value of the `AdjustmentType` parameter is `PercentChangeInCapacity`: -100 ~ 10000, 0 is not allowed, unit: %. When the value of the `AdjustmentType` parameter is `TotalCapacity`: the default is 0 to 100, unit: piece.
*/
adjustmentValue: pulumi.Input<number>;
/**
* The comparison operator of the alarm policy condition of the scaling policy. Valid values: `>`, `<`, `=`. It is only valid and required when the value of `ScalingPolicyType` is `Alarm`.
*/
alarmPolicyConditionComparisonOperator?: pulumi.Input<string>;
/**
* The metric name of the alarm policy condition of the scaling policy. Valid values: CpuTotal_Max, CpuTotal_Min, CpuTotal_Avg, MemoryUsedUtilization_Max, MemoryUsedUtilization_Min, MemoryUsedUtilization_Avg, Instance_CpuBusy_Max, Instance_CpuBusy_Min, Instance_CpuBusy_Avg.
*/
alarmPolicyConditionMetricName?: pulumi.Input<string>;
/**
* The comparison operator of the alarm policy condition of the scaling policy. It is only valid and required when the value of `ScalingPolicyType` is `Alarm`.
*/
alarmPolicyConditionMetricUnit?: pulumi.Input<string>;
/**
* The threshold of the alarm policy condition of the scaling policy. It is only valid and required when the value of `ScalingPolicyType` is `Alarm`.
*/
alarmPolicyConditionThreshold?: pulumi.Input<string>;
/**
* The evaluation count of the alarm policy of the scaling policy. It is only valid and required when the value of `ScalingPolicyType` is `Alarm`.
*/
alarmPolicyEvaluationCount?: pulumi.Input<number>;
/**
* The rule type of the alarm policy of the scaling policy. Valid value: Static. It is only valid and required when the value of `ScalingPolicyType` is `Alarm`.
*/
alarmPolicyRuleType?: pulumi.Input<string>;
/**
* The cooldown of the scaling policy. Default value is the cooldown time of the scaling group. Value: 0~86400, unit: second, if left blank, the cooling time of the scaling group will be used by default.
*/
cooldown?: pulumi.Input<number>;
/**
* The id of the scaling group to which the scaling policy belongs.
*/
scalingGroupId: pulumi.Input<string>;
/**
* The name of the scaling policy.
*/
scalingPolicyName: pulumi.Input<string>;
/**
* The type of scaling policy. Valid values: Scheduled, Recurrence, Alarm.
*/
scalingPolicyType: pulumi.Input<string>;
/**
* The launch time of the scheduled policy of the scaling policy.
* When the value of `ScalingPolicyType` is `Scheduled`, it means that the trigger time of the scheduled task must be greater than the current time.
* When the value of `ScalingPolicyType` is `Recurrence`: If `ScheduledPolicy.RecurrenceType` is not specified, it means to execute only once according to the date and time specified here.
* If `ScheduledPolicy.RecurrenceType` is specified, it indicates the start time of the periodic task. Only the time within 90 days from the date of creation/modification is supported.
* When the value of `ScalingPolicyType` is `Alarm`, this parameter is invalid.
*/
scheduledPolicyLaunchTime?: pulumi.Input<string>;
/**
* The recurrence end time of the scheduled policy of the scaling policy. Valid and required when `ScalingPolicyType` is `Recurrence`. If not configured, it will default to the day/week/month after this moment according to the recurrence period (ScheduledPolicy.RecurrenceType).
*/
scheduledPolicyRecurrenceEndTime?: pulumi.Input<string>;
/**
* The recurrence type the scheduled policy of the scaling policy. Valid values: Daily, Weekly, Monthly, Cron.
*/
scheduledPolicyRecurrenceType?: pulumi.Input<string>;
/**
* The recurrence value the scheduled policy of the scaling policy. Valid and required when `ScalingPolicyType` is `Recurrence`. When the value of the ScheduledPolicy.RecurrenceType parameter is Daily, only one value can be filled in, ranging from 1 to 31.
* When the value of the ScheduledPolicy.RecurrenceType parameter is Weekly, you can enter multiple values separated by commas (,). The values from Monday to Sunday are: 1,2,3,4,5,6,7.
* When the value of the ScheduledPolicy.RecurrenceType parameter is Monthly, the format is A-B. The value ranges of A and B are both 1~31, and B must be greater than or equal to A.
* When the value of the ScheduledPolicy.RecurrenceType parameter is Cron, it means UTC+8 time, supports 5-field expressions of minutes, hours, days, months, and weeks, and supports wildcard English commas (,), English question marks (?), and conjunctions ( -), asterisk (*), pound sign (#), slash (/), L, and W.
*/
scheduledPolicyRecurrenceValue?: pulumi.Input<string>;
}