@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
149 lines • 7.43 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.AlarmRule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages an AOM alarm rule resource within HuaweiCloud.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const alarmRule = new huaweicloud.aom.AlarmRule("alarmRule", {
* alarmLevel: 3,
* description: "test rule",
* namespace: "PAAS.NODE",
* metricName: "cupUsage",
* dimensions: [{
* name: "hostID",
* value: _var.instance_id,
* }],
* comparisonOperator: ">=",
* period: 60000,
* statistic: "average",
* threshold: "3",
* unit: "Percent",
* evaluationPeriods: 2,
* });
* ```
*
* ## Import
*
* AOM alarm rules can be imported using the `id`, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:Aom/alarmRule:AlarmRule alarm_rule <id>
* ```
*/
class AlarmRule extends pulumi.CustomResource {
/**
* Get an existing AlarmRule 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 AlarmRule(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of AlarmRule. 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'] === AlarmRule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["alarmActionEnabled"] = state ? state.alarmActionEnabled : undefined;
resourceInputs["alarmActions"] = state ? state.alarmActions : undefined;
resourceInputs["alarmEnabled"] = state ? state.alarmEnabled : undefined;
resourceInputs["alarmLevel"] = state ? state.alarmLevel : undefined;
resourceInputs["comparisonOperator"] = state ? state.comparisonOperator : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["dimensions"] = state ? state.dimensions : undefined;
resourceInputs["evaluationPeriods"] = state ? state.evaluationPeriods : undefined;
resourceInputs["insufficientDataActions"] = state ? state.insufficientDataActions : undefined;
resourceInputs["metricName"] = state ? state.metricName : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["namespace"] = state ? state.namespace : undefined;
resourceInputs["okActions"] = state ? state.okActions : undefined;
resourceInputs["period"] = state ? state.period : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["stateReason"] = state ? state.stateReason : undefined;
resourceInputs["stateValue"] = state ? state.stateValue : undefined;
resourceInputs["statistic"] = state ? state.statistic : undefined;
resourceInputs["threshold"] = state ? state.threshold : undefined;
resourceInputs["unit"] = state ? state.unit : undefined;
}
else {
const args = argsOrState;
if ((!args || args.comparisonOperator === undefined) && !opts.urn) {
throw new Error("Missing required property 'comparisonOperator'");
}
if ((!args || args.dimensions === undefined) && !opts.urn) {
throw new Error("Missing required property 'dimensions'");
}
if ((!args || args.evaluationPeriods === undefined) && !opts.urn) {
throw new Error("Missing required property 'evaluationPeriods'");
}
if ((!args || args.metricName === undefined) && !opts.urn) {
throw new Error("Missing required property 'metricName'");
}
if ((!args || args.namespace === undefined) && !opts.urn) {
throw new Error("Missing required property 'namespace'");
}
if ((!args || args.period === undefined) && !opts.urn) {
throw new Error("Missing required property 'period'");
}
if ((!args || args.statistic === undefined) && !opts.urn) {
throw new Error("Missing required property 'statistic'");
}
if ((!args || args.threshold === undefined) && !opts.urn) {
throw new Error("Missing required property 'threshold'");
}
if ((!args || args.unit === undefined) && !opts.urn) {
throw new Error("Missing required property 'unit'");
}
resourceInputs["alarmActionEnabled"] = args ? args.alarmActionEnabled : undefined;
resourceInputs["alarmActions"] = args ? args.alarmActions : undefined;
resourceInputs["alarmLevel"] = args ? args.alarmLevel : undefined;
resourceInputs["comparisonOperator"] = args ? args.comparisonOperator : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["dimensions"] = args ? args.dimensions : undefined;
resourceInputs["evaluationPeriods"] = args ? args.evaluationPeriods : undefined;
resourceInputs["insufficientDataActions"] = args ? args.insufficientDataActions : undefined;
resourceInputs["metricName"] = args ? args.metricName : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["namespace"] = args ? args.namespace : undefined;
resourceInputs["okActions"] = args ? args.okActions : undefined;
resourceInputs["period"] = args ? args.period : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["statistic"] = args ? args.statistic : undefined;
resourceInputs["threshold"] = args ? args.threshold : undefined;
resourceInputs["unit"] = args ? args.unit : undefined;
resourceInputs["alarmEnabled"] = undefined /*out*/;
resourceInputs["stateReason"] = undefined /*out*/;
resourceInputs["stateValue"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(AlarmRule.__pulumiType, name, resourceInputs, opts);
}
}
exports.AlarmRule = AlarmRule;
/** @internal */
AlarmRule.__pulumiType = 'huaweicloud:Aom/alarmRule:AlarmRule';
//# sourceMappingURL=alarmRule.js.map