@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
210 lines • 8.94 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.BandwidthPolicy = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* 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,
*
* ]
*
* } }
*/
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, id, state, opts) {
return new BandwidthPolicy(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* 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) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === BandwidthPolicy.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["action"] = state ? state.action : undefined;
resourceInputs["alarmId"] = state ? state.alarmId : undefined;
resourceInputs["bandwidthId"] = state ? state.bandwidthId : undefined;
resourceInputs["coolDownTime"] = state ? state.coolDownTime : undefined;
resourceInputs["createTime"] = state ? state.createTime : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["intervalAlarmActions"] = state ? state.intervalAlarmActions : undefined;
resourceInputs["metaDatas"] = state ? state.metaDatas : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["scalingPolicyAction"] = state ? state.scalingPolicyAction : undefined;
resourceInputs["scalingPolicyName"] = state ? state.scalingPolicyName : undefined;
resourceInputs["scalingPolicyType"] = state ? state.scalingPolicyType : undefined;
resourceInputs["scalingResourceType"] = state ? state.scalingResourceType : undefined;
resourceInputs["scheduledPolicy"] = state ? state.scheduledPolicy : undefined;
resourceInputs["status"] = state ? state.status : undefined;
}
else {
const args = argsOrState;
if ((!args || args.bandwidthId === undefined) && !opts.urn) {
throw new Error("Missing required property 'bandwidthId'");
}
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["action"] = args ? args.action : undefined;
resourceInputs["alarmId"] = args ? args.alarmId : undefined;
resourceInputs["bandwidthId"] = args ? args.bandwidthId : undefined;
resourceInputs["coolDownTime"] = args ? args.coolDownTime : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["intervalAlarmActions"] = args ? args.intervalAlarmActions : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["scalingPolicyAction"] = args ? args.scalingPolicyAction : undefined;
resourceInputs["scalingPolicyName"] = args ? args.scalingPolicyName : undefined;
resourceInputs["scalingPolicyType"] = args ? args.scalingPolicyType : undefined;
resourceInputs["scheduledPolicy"] = args ? args.scheduledPolicy : undefined;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["metaDatas"] = undefined /*out*/;
resourceInputs["scalingResourceType"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(BandwidthPolicy.__pulumiType, name, resourceInputs, opts);
}
}
exports.BandwidthPolicy = BandwidthPolicy;
/** @internal */
BandwidthPolicy.__pulumiType = 'huaweicloud:As/bandwidthPolicy:BandwidthPolicy';
//# sourceMappingURL=bandwidthPolicy.js.map