CompositeAlarm L2 construct
A Composite Alarm based on Alarm Rule.
| CloudFormation | AWS::CloudWatch::CompositeAlarm |
|---|---|
| L1 type | CfnCompositeAlarm |
| Source | aws-cloudwatch/lib/composite-alarm.ts |
| Type last changed |
Example
declare const alarm1: cloudwatch.Alarm;
declare const alarm2: cloudwatch.Alarm;
declare const onAlarmAction: cloudwatch.IAlarmAction;
declare const onOkAction: cloudwatch.IAlarmAction;
declare const actionsSuppressor: cloudwatch.Alarm;
const alarmRule = cloudwatch.AlarmRule.anyOf(alarm1, alarm2);
const myCompositeAlarm = new cloudwatch.CompositeAlarm(this, 'MyAwesomeCompositeAlarm', {
alarmRule,
actionsSuppressor,
});
myCompositeAlarm.addAlarmAction(onAlarmAction);
myCompositeAlarm.addOkAction(onOkAction);
# alarm1: cloudwatch.Alarm
# alarm2: cloudwatch.Alarm
# on_alarm_action: cloudwatch.IAlarmAction
# on_ok_action: cloudwatch.IAlarmAction
# actions_suppressor: cloudwatch.Alarm
alarm_rule = cloudwatch.AlarmRule.any_of(alarm1, alarm2)
my_composite_alarm = cloudwatch.CompositeAlarm(self, "MyAwesomeCompositeAlarm",
alarm_rule=alarm_rule,
actions_suppressor=actions_suppressor
)
my_composite_alarm.add_alarm_action(on_alarm_action)
my_composite_alarm.add_ok_action(on_ok_action)
Alarm alarm1;
Alarm alarm2;
IAlarmAction onAlarmAction;
IAlarmAction onOkAction;
Alarm actionsSuppressor;
IAlarmRule alarmRule = AlarmRule.anyOf(alarm1, alarm2);
CompositeAlarm myCompositeAlarm = CompositeAlarm.Builder.create(this, "MyAwesomeCompositeAlarm")
.alarmRule(alarmRule)
.actionsSuppressor(actionsSuppressor)
.build();
myCompositeAlarm.addAlarmAction(onAlarmAction);
myCompositeAlarm.addOkAction(onOkAction);
// Install: dotnet add package Amazon.CDK.Lib
Alarm alarm1;
Alarm alarm2;
IAlarmAction onAlarmAction;
IAlarmAction onOkAction;
Alarm actionsSuppressor;
var alarmRule = AlarmRule.AnyOf(alarm1, alarm2);
var myCompositeAlarm = new CompositeAlarm(this, "MyAwesomeCompositeAlarm", new CompositeAlarmProps {
AlarmRule = alarmRule,
ActionsSuppressor = actionsSuppressor
});
myCompositeAlarm.AddAlarmAction(onAlarmAction);
myCompositeAlarm.AddOkAction(onOkAction);
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var alarm1 Alarm
var alarm2 Alarm
var onAlarmAction IAlarmAction
var onOkAction IAlarmAction
var actionsSuppressor Alarm
alarmRule := cloudwatch.AlarmRule_AnyOf(alarm1, alarm2)
myCompositeAlarm := cloudwatch.NewCompositeAlarm(this, jsii.String("MyAwesomeCompositeAlarm"), &CompositeAlarmProps{
AlarmRule: AlarmRule,
ActionsSuppressor: ActionsSuppressor,
})
myCompositeAlarm.AddAlarmAction(onAlarmAction)
myCompositeAlarm.AddOkAction(onOkAction)
Initializer
new CompositeAlarm(scope: Construct, id: string, props: CompositeAlarmProps)
CompositeAlarm(scope: Construct, id: str, props: CompositeAlarmProps)
new CompositeAlarm(Construct scope, String id, CompositeAlarmProps props)
new CompositeAlarm(Construct scope, string id, CompositeAlarmProps props)
NewCompositeAlarm(Scope Construct, Id *string, Props CompositeAlarmProps)
Construct Props
actionsEnabledoptionalbooleanactions_enabledoptionalboolactionsEnabledoptionalBooleanActionsEnabledoptionalboolActionsEnabledoptional*bool = true #actionsSuppressoroptionalIAlarmRefactions_suppressoroptionalIAlarmRefactionsSuppressoroptionalIAlarmRefActionsSuppressoroptionalIAlarmRefActionsSuppressoroptionalIAlarmRef #Default: alarm will not be suppressed.
actionsSuppressorExtensionPeriodoptionalDurationactions_suppressor_extension_periodoptionalDurationactionsSuppressorExtensionPeriodoptionalDurationActionsSuppressorExtensionPeriodoptionalDurationActionsSuppressorExtensionPeriodoptionalDuration #Default: 1 minute extension period will be set.
After this time, the composite alarm performs its actions.
actionsSuppressorWaitPeriodoptionalDurationactions_suppressor_wait_periodoptionalDurationactionsSuppressorWaitPeriodoptionalDurationActionsSuppressorWaitPeriodoptionalDurationActionsSuppressorWaitPeriodoptionalDuration #Default: 1 minute wait period will be set.
After this time, the composite alarm performs its actions.
alarmDescriptionoptionalstringalarm_descriptionoptionalstralarmDescriptionoptionalStringAlarmDescriptionoptionalstringAlarmDescriptionoptional*string #Default: No description.
alarmRuleIAlarmRulealarm_ruleIAlarmRulealarmRuleIAlarmRuleAlarmRuleIAlarmRuleAlarmRuleIAlarmRule required #compositeAlarmNameoptionalstringcomposite_alarm_nameoptionalstrcompositeAlarmNameoptionalStringCompositeAlarmNameoptionalstringCompositeAlarmNameoptional*string #Default: Automatically generated name.
Properties
alarmRefAlarmReferencealarm_refAlarmReferencealarmRefAlarmReferenceAlarmRefAlarmReferenceAlarmRefAlarmReference #envResourceEnvironmentenvResourceEnvironmentenvResourceEnvironmentEnvResourceEnvironmentEnvResourceEnvironment #notes
For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.
PROPERTY_INJECTION_IDstringPROPERTY_INJECTION_IDstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*string static #Methods
addAlarmAction(...actions: IAlarmAction[]): voiddef add_alarm_action(self, actions: IAlarmAction) -> Nonepublic void addAlarmAction(IAlarmAction actions)public void AddAlarmAction(IAlarmAction actions)func AddAlarmAction(Actions IAlarmAction) #Typically SnsAction or AutoScalingAction.
addAlarmMuteRule(id: string, options: AlarmMuteRuleOptions): AlarmMuteRuledef add_alarm_mute_rule(self, id: str, options: AlarmMuteRuleOptions) -> AlarmMuteRulepublic AlarmMuteRule addAlarmMuteRule(String id, AlarmMuteRuleOptions options)public AlarmMuteRule AddAlarmMuteRule(string id, AlarmMuteRuleOptions options)func AddAlarmMuteRule(Id *string, Options AlarmMuteRuleOptions) AlarmMuteRule #addInsufficientDataAction(...actions: IAlarmAction[]): voiddef add_insufficient_data_action(self, actions: IAlarmAction) -> Nonepublic void addInsufficientDataAction(IAlarmAction actions)public void AddInsufficientDataAction(IAlarmAction actions)func AddInsufficientDataAction(Actions IAlarmAction) #Typically SnsAction or AutoScalingAction.
addOkAction(...actions: IAlarmAction[]): voiddef add_ok_action(self, actions: IAlarmAction) -> Nonepublic void addOkAction(IAlarmAction actions)public void AddOkAction(IAlarmAction actions)func AddOkAction(Actions IAlarmAction) #Typically SnsAction or AutoScalingAction.
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength) #notes · 1 parameter
When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.
Parameters
strengthstrengthstrengthstrengthStrength— - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy) #notes
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).
fromCompositeAlarmArn(scope: Construct, id: string, compositeAlarmArn: string): IAlarm@staticmethod def from_composite_alarm_arn(scope: Construct, id: str, composite_alarm_arn: str) -> IAlarmpublic static IAlarm fromCompositeAlarmArn(Construct scope, String id, String compositeAlarmArn)public static IAlarm FromCompositeAlarmArn(Construct scope, string id, string compositeAlarmArn)func FromCompositeAlarmArn(Scope Construct, Id *string, CompositeAlarmArn *string) IAlarm static #3 parameters
Parameters
scopescopescopescopeScope— The parent creating construct (usuallythis).ididididId— The construct's name.compositeAlarmArncomposite_alarm_arncompositeAlarmArncompositeAlarmArnCompositeAlarmArn— Composite Alarm ARN (i.e. arn:aws:cloudwatch:<region>:<account-id>:alarm:CompositeAlarmName).
fromCompositeAlarmName(scope: Construct, id: string, compositeAlarmName: string): IAlarm@staticmethod def from_composite_alarm_name(scope: Construct, id: str, composite_alarm_name: str) -> IAlarmpublic static IAlarm fromCompositeAlarmName(Construct scope, String id, String compositeAlarmName)public static IAlarm FromCompositeAlarmName(Construct scope, string id, string compositeAlarmName)func FromCompositeAlarmName(Scope Construct, Id *string, CompositeAlarmName *string) IAlarm static #3 parameters
Parameters
scopescopescopescopeScope— The parent creating construct (usuallythis).ididididId— The construct's name.compositeAlarmNamecomposite_alarm_namecompositeAlarmNamecompositeAlarmNameCompositeAlarmName— Composite Alarm Name.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *bool static #notes · 1 parameter · returns
Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *bool static #isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *bool static #renderAlarmRule(): stringdef render_alarm_rule(self, ) -> strpublic String renderAlarmRule()public string RenderAlarmRule()func RenderAlarmRule() *string #toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string #with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct #Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.