@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
112 lines • 5.44 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.CompositeAlarm = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a CloudWatch Composite Alarm resource.
*
* > **NOTE:** An alarm (composite or metric) cannot be destroyed when there are other composite alarms depending on it. This can lead to a cyclical dependency on update, as the provider will unsuccessfully attempt to destroy alarms before updating the rule. Consider using `dependsOn`, references to alarm names, and two-stage updates.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.cloudwatch.CompositeAlarm("example", {
* alarmDescription: "This is a composite alarm!",
* alarmName: "example-composite-alarm",
* alarmActions: exampleAwsSnsTopic.arn,
* okActions: exampleAwsSnsTopic.arn,
* alarmRule: `ALARM(${alpha.alarmName}) OR
* ALARM(${bravo.alarmName})
* `,
* actionsSuppressor: {
* alarm: "suppressor-alarm",
* extensionPeriod: 10,
* waitPeriod: 20,
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import a CloudWatch Composite Alarm using the `alarm_name`. For example:
*
* ```sh
* $ pulumi import aws:cloudwatch/compositeAlarm:CompositeAlarm test my-alarm
* ```
*/
class CompositeAlarm extends pulumi.CustomResource {
/**
* Get an existing CompositeAlarm 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 CompositeAlarm(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of CompositeAlarm. 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'] === CompositeAlarm.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["actionsEnabled"] = state ? state.actionsEnabled : undefined;
resourceInputs["actionsSuppressor"] = state ? state.actionsSuppressor : undefined;
resourceInputs["alarmActions"] = state ? state.alarmActions : undefined;
resourceInputs["alarmDescription"] = state ? state.alarmDescription : undefined;
resourceInputs["alarmName"] = state ? state.alarmName : undefined;
resourceInputs["alarmRule"] = state ? state.alarmRule : undefined;
resourceInputs["arn"] = state ? state.arn : undefined;
resourceInputs["insufficientDataActions"] = state ? state.insufficientDataActions : undefined;
resourceInputs["okActions"] = state ? state.okActions : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tagsAll"] = state ? state.tagsAll : undefined;
}
else {
const args = argsOrState;
if ((!args || args.alarmName === undefined) && !opts.urn) {
throw new Error("Missing required property 'alarmName'");
}
if ((!args || args.alarmRule === undefined) && !opts.urn) {
throw new Error("Missing required property 'alarmRule'");
}
resourceInputs["actionsEnabled"] = args ? args.actionsEnabled : undefined;
resourceInputs["actionsSuppressor"] = args ? args.actionsSuppressor : undefined;
resourceInputs["alarmActions"] = args ? args.alarmActions : undefined;
resourceInputs["alarmDescription"] = args ? args.alarmDescription : undefined;
resourceInputs["alarmName"] = args ? args.alarmName : undefined;
resourceInputs["alarmRule"] = args ? args.alarmRule : undefined;
resourceInputs["insufficientDataActions"] = args ? args.insufficientDataActions : undefined;
resourceInputs["okActions"] = args ? args.okActions : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(CompositeAlarm.__pulumiType, name, resourceInputs, opts);
}
}
exports.CompositeAlarm = CompositeAlarm;
/** @internal */
CompositeAlarm.__pulumiType = 'aws:cloudwatch/compositeAlarm:CompositeAlarm';
//# sourceMappingURL=compositeAlarm.js.map