@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
379 lines (378 loc) • 15.5 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import { input as inputs, output as outputs } from "../types";
/**
* Manages an AS bandwidth scaling policy resource within HuaweiCloud.
*
* > AS cannot scale yearly/monthly bandwidths.
*
* ## Example Usage
* ### AS Recurrence Policy
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const scalingPolicyName = config.requireObject("scalingPolicyName");
* const bandwidthId = config.requireObject("bandwidthId");
* const test = new huaweicloud.as.BandwidthPolicy("test", {
* scalingPolicyName: scalingPolicyName,
* scalingPolicyType: "RECURRENCE",
* bandwidthId: bandwidthId,
* coolDownTime: 600,
* scalingPolicyAction: {
* operation: "ADD",
* size: 1,
* },
* scheduledPolicy: {
* launchTime: "07:00",
* recurrenceType: "Weekly",
* recurrenceValue: "1,3,5",
* startTime: "2022-09-30T12:00Z",
* endTime: "2022-12-30T12:00Z",
* },
* });
* ```
* ### AS Scheduled Policy
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const scalingPolicyName = config.requireObject("scalingPolicyName");
* const bandwidthId = config.requireObject("bandwidthId");
* const test = new huaweicloud.as.BandwidthPolicy("test", {
* scalingPolicyName: scalingPolicyName,
* scalingPolicyType: "SCHEDULED",
* bandwidthId: bandwidthId,
* coolDownTime: 600,
* scalingPolicyAction: {
* operation: "ADD",
* size: 1,
* },
* scheduledPolicy: {
* launchTime: "2022-09-30T12:00Z",
* },
* });
* ```
* ### AS Alarm Policy
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const scalingPolicyName = config.requireObject("scalingPolicyName");
* const bandwidthId = config.requireObject("bandwidthId");
* const alarmId = config.requireObject("alarmId");
* const test = new huaweicloud.as.BandwidthPolicy("test", {
* scalingPolicyName: scalingPolicyName,
* scalingPolicyType: "ALARM",
* bandwidthId: bandwidthId,
* alarmId: alarmId,
* scalingPolicyAction: {
* operation: "ADD",
* size: 1,
* limits: 300,
* },
* });
* ```
* ### AS Interval Alarm Policy
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const scalingPolicyName = config.requireObject("scalingPolicyName");
* const bandwidthId = config.requireObject("bandwidthId");
* const alarmId = config.requireObject("alarmId");
* const test = new huaweicloud.as.BandwidthPolicy("test", {
* scalingPolicyName: scalingPolicyName,
* scalingPolicyType: "INTERVAL_ALARM",
* bandwidthId: bandwidthId,
* alarmId: alarmId,
* intervalAlarmActions: [{
* lowerBound: "0",
* upperBound: "5",
* operation: "ADD",
* size: 1,
* }],
* });
* ```
*
* ## Import
*
* The bandwidth scaling policies can be imported using the `id`, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:As/bandwidthPolicy:BandwidthPolicy 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`action`. 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 resource. Also you can ignore changes as below. hcl resource "huaweicloud_as_bandwidth_policy" "test" {
*
* ...
*
* lifecycle {
*
* ignore_changes = [
*
* action,
*
* ]
*
* } }
*/
export declare class BandwidthPolicy extends pulumi.CustomResource {
/**
* Get an existing BandwidthPolicy 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?: BandwidthPolicyState, opts?: pulumi.CustomResourceOptions): BandwidthPolicy;
/**
* Returns true if the given object is an instance of BandwidthPolicy. 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 BandwidthPolicy;
/**
* Specifies identification of operation the AS bandwidth policy.
* After the AS bandwidth policy created, the status is inservice, indicates the AS bandwidth policy is enabled.
* The valid values are as follows:
* + **resume**: Indicates enable the AS bandwidth policy.
* + **pause**: Indicates disable the AS bandwidth policy.
*/
readonly action: pulumi.Output<string | undefined>;
/**
* Specifies the alarm rule ID.
* This parameter is mandatory when `scalingPolicyType` is set to **ALARM** or **INTERVAL_ALARM**.
*/
readonly alarmId: pulumi.Output<string>;
/**
* Specifies the scaling bandwidth ID.
*/
readonly bandwidthId: pulumi.Output<string>;
/**
* Specifies the cooldown period (in seconds).
* The value ranges from `0` to `86,400` and is `300` by default.
*/
readonly coolDownTime: pulumi.Output<number>;
/**
* The creation time of the bandwidth policy, in UTC format.
*/
readonly createTime: pulumi.Output<string>;
/**
* Specifies the description of the AS policy.
* The value can contain `0` to `256` characters.
*/
readonly description: pulumi.Output<string>;
/**
* Specifies the alarm interval of the bandwidth policy.
* The intervalAlarmActions structure is documented below.
*/
readonly intervalAlarmActions: pulumi.Output<outputs.As.BandwidthPolicyIntervalAlarmAction[]>;
/**
* The bandwidth policy additional information.
* The metaData structure is documented below.
*/
readonly metaDatas: pulumi.Output<outputs.As.BandwidthPolicyMetaData[]>;
/**
* Specifies the region in which to create the resource.
* If omitted, the provider-level region will be used. Changing this parameter will create a new resource.
*/
readonly region: pulumi.Output<string>;
/**
* Specifies the scaling action of the AS policy.
* The scalingPolicyAction structure is documented below.
*/
readonly scalingPolicyAction: pulumi.Output<outputs.As.BandwidthPolicyScalingPolicyAction>;
/**
* Specifies the AS policy name.
* The name contains only letters, digits, underscores (_), and hyphens (-), and cannot exceed 64 characters.
*/
readonly scalingPolicyName: pulumi.Output<string>;
/**
* Specifies the AS policy type. The options are as follows:
* + **ALARM** (corresponding to `alarmId`): Indicates that the scaling action is triggered by an alarm.
* + **SCHEDULED** (corresponding to `scheduledPolicy`): Indicates that the scaling action is triggered as scheduled.
* + **RECURRENCE** (corresponding to `scheduledPolicy`): Indicates that the scaling action is triggered periodically.
* + **INTERVAL_ALARM** (corresponding to `alarmId`): Indicates that the scaling action is triggered by an alarm.
*/
readonly scalingPolicyType: pulumi.Output<string>;
/**
* The scaling resource type. The value is fixed to **BANDWIDTH**.
*/
readonly scalingResourceType: pulumi.Output<string>;
/**
* Specifies the periodic or scheduled AS policy.
* This parameter is mandatory when `scalingPolicyType` is set to **SCHEDULED** or **RECURRENCE**.
* The scheduledPolicy structure is documented below.
*/
readonly scheduledPolicy: pulumi.Output<outputs.As.BandwidthPolicyScheduledPolicy>;
/**
* The AS policy status. The value can be **INSERVICE**, **PAUSED** and **EXECUTING**.
*/
readonly status: pulumi.Output<string>;
/**
* Create a BandwidthPolicy 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: BandwidthPolicyArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering BandwidthPolicy resources.
*/
export interface BandwidthPolicyState {
/**
* Specifies identification of operation the AS bandwidth policy.
* After the AS bandwidth policy created, the status is inservice, indicates the AS bandwidth policy is enabled.
* The valid values are as follows:
* + **resume**: Indicates enable the AS bandwidth policy.
* + **pause**: Indicates disable the AS bandwidth policy.
*/
action?: pulumi.Input<string>;
/**
* Specifies the alarm rule ID.
* This parameter is mandatory when `scalingPolicyType` is set to **ALARM** or **INTERVAL_ALARM**.
*/
alarmId?: pulumi.Input<string>;
/**
* Specifies the scaling bandwidth ID.
*/
bandwidthId?: pulumi.Input<string>;
/**
* Specifies the cooldown period (in seconds).
* The value ranges from `0` to `86,400` and is `300` by default.
*/
coolDownTime?: pulumi.Input<number>;
/**
* The creation time of the bandwidth policy, in UTC format.
*/
createTime?: pulumi.Input<string>;
/**
* Specifies the description of the AS policy.
* The value can contain `0` to `256` characters.
*/
description?: pulumi.Input<string>;
/**
* Specifies the alarm interval of the bandwidth policy.
* The intervalAlarmActions structure is documented below.
*/
intervalAlarmActions?: pulumi.Input<pulumi.Input<inputs.As.BandwidthPolicyIntervalAlarmAction>[]>;
/**
* The bandwidth policy additional information.
* The metaData structure is documented below.
*/
metaDatas?: pulumi.Input<pulumi.Input<inputs.As.BandwidthPolicyMetaData>[]>;
/**
* Specifies the region in which to create the resource.
* If omitted, the provider-level region will be used. Changing this parameter will create a new resource.
*/
region?: pulumi.Input<string>;
/**
* Specifies the scaling action of the AS policy.
* The scalingPolicyAction structure is documented below.
*/
scalingPolicyAction?: pulumi.Input<inputs.As.BandwidthPolicyScalingPolicyAction>;
/**
* Specifies the AS policy name.
* The name contains only letters, digits, underscores (_), and hyphens (-), and cannot exceed 64 characters.
*/
scalingPolicyName?: pulumi.Input<string>;
/**
* Specifies the AS policy type. The options are as follows:
* + **ALARM** (corresponding to `alarmId`): Indicates that the scaling action is triggered by an alarm.
* + **SCHEDULED** (corresponding to `scheduledPolicy`): Indicates that the scaling action is triggered as scheduled.
* + **RECURRENCE** (corresponding to `scheduledPolicy`): Indicates that the scaling action is triggered periodically.
* + **INTERVAL_ALARM** (corresponding to `alarmId`): Indicates that the scaling action is triggered by an alarm.
*/
scalingPolicyType?: pulumi.Input<string>;
/**
* The scaling resource type. The value is fixed to **BANDWIDTH**.
*/
scalingResourceType?: pulumi.Input<string>;
/**
* Specifies the periodic or scheduled AS policy.
* This parameter is mandatory when `scalingPolicyType` is set to **SCHEDULED** or **RECURRENCE**.
* The scheduledPolicy structure is documented below.
*/
scheduledPolicy?: pulumi.Input<inputs.As.BandwidthPolicyScheduledPolicy>;
/**
* The AS policy status. The value can be **INSERVICE**, **PAUSED** and **EXECUTING**.
*/
status?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a BandwidthPolicy resource.
*/
export interface BandwidthPolicyArgs {
/**
* Specifies identification of operation the AS bandwidth policy.
* After the AS bandwidth policy created, the status is inservice, indicates the AS bandwidth policy is enabled.
* The valid values are as follows:
* + **resume**: Indicates enable the AS bandwidth policy.
* + **pause**: Indicates disable the AS bandwidth policy.
*/
action?: pulumi.Input<string>;
/**
* Specifies the alarm rule ID.
* This parameter is mandatory when `scalingPolicyType` is set to **ALARM** or **INTERVAL_ALARM**.
*/
alarmId?: pulumi.Input<string>;
/**
* Specifies the scaling bandwidth ID.
*/
bandwidthId: pulumi.Input<string>;
/**
* Specifies the cooldown period (in seconds).
* The value ranges from `0` to `86,400` and is `300` by default.
*/
coolDownTime?: pulumi.Input<number>;
/**
* Specifies the description of the AS policy.
* The value can contain `0` to `256` characters.
*/
description?: pulumi.Input<string>;
/**
* Specifies the alarm interval of the bandwidth policy.
* The intervalAlarmActions structure is documented below.
*/
intervalAlarmActions?: pulumi.Input<pulumi.Input<inputs.As.BandwidthPolicyIntervalAlarmAction>[]>;
/**
* Specifies the region in which to create the resource.
* If omitted, the provider-level region will be used. Changing this parameter will create a new resource.
*/
region?: pulumi.Input<string>;
/**
* Specifies the scaling action of the AS policy.
* The scalingPolicyAction structure is documented below.
*/
scalingPolicyAction?: pulumi.Input<inputs.As.BandwidthPolicyScalingPolicyAction>;
/**
* Specifies the AS policy name.
* The name contains only letters, digits, underscores (_), and hyphens (-), and cannot exceed 64 characters.
*/
scalingPolicyName: pulumi.Input<string>;
/**
* Specifies the AS policy type. The options are as follows:
* + **ALARM** (corresponding to `alarmId`): Indicates that the scaling action is triggered by an alarm.
* + **SCHEDULED** (corresponding to `scheduledPolicy`): Indicates that the scaling action is triggered as scheduled.
* + **RECURRENCE** (corresponding to `scheduledPolicy`): Indicates that the scaling action is triggered periodically.
* + **INTERVAL_ALARM** (corresponding to `alarmId`): Indicates that the scaling action is triggered by an alarm.
*/
scalingPolicyType: pulumi.Input<string>;
/**
* Specifies the periodic or scheduled AS policy.
* This parameter is mandatory when `scalingPolicyType` is set to **SCHEDULED** or **RECURRENCE**.
* The scheduledPolicy structure is documented below.
*/
scheduledPolicy?: pulumi.Input<inputs.As.BandwidthPolicyScheduledPolicy>;
}