class AlarmRule
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.CloudWatch.AlarmRule |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awscloudwatch#AlarmRule |
Java | software.amazon.awscdk.services.cloudwatch.AlarmRule |
Python | aws_cdk.aws_cloudwatch.AlarmRule |
TypeScript (source) | aws-cdk-lib » aws_cloudwatch » AlarmRule |
Class with static functions to build AlarmRule for Composite Alarms.
Example
declare const alarm1: cloudwatch.Alarm;
declare const alarm2: cloudwatch.Alarm;
declare const alarm3: cloudwatch.Alarm;
declare const alarm4: cloudwatch.Alarm;
const alarmRule = cloudwatch.AlarmRule.anyOf(
cloudwatch.AlarmRule.allOf(
cloudwatch.AlarmRule.anyOf(
alarm1,
cloudwatch.AlarmRule.fromAlarm(alarm2, cloudwatch.AlarmState.OK),
alarm3,
),
cloudwatch.AlarmRule.not(cloudwatch.AlarmRule.fromAlarm(alarm4, cloudwatch.AlarmState.INSUFFICIENT_DATA)),
),
cloudwatch.AlarmRule.fromBoolean(false),
);
new cloudwatch.CompositeAlarm(this, 'MyAwesomeCompositeAlarm', {
alarmRule,
});
Initializer
new AlarmRule()
Methods
Name | Description |
---|---|
static all | function to join all provided AlarmRules with AND operator. |
static any | function to join all provided AlarmRules with OR operator. |
static from | function to build Rule Expression for given IAlarm and AlarmState. |
static from | function to build TRUE/FALSE intent for Rule Expression. |
static from | function to build Rule Expression for given Alarm Rule string. |
static not(operand) | function to wrap provided AlarmRule in NOT operator. |
Of(...operands)
static allpublic static allOf(...operands: IAlarmRule[]): IAlarmRule
Parameters
- operands
IAlarm
— IAlarmRules to be joined with AND operator.Rule
Returns
function to join all provided AlarmRules with AND operator.
Of(...operands)
static anypublic static anyOf(...operands: IAlarmRule[]): IAlarmRule
Parameters
- operands
IAlarm
— IAlarmRules to be joined with OR operator.Rule
Returns
function to join all provided AlarmRules with OR operator.
Alarm(alarm, alarmState)
static frompublic static fromAlarm(alarm: IAlarm, alarmState: AlarmState): IAlarmRule
Parameters
- alarm
IAlarm
— IAlarm to be used in Rule Expression. - alarmState
Alarm
— AlarmState to be used in Rule Expression.State
Returns
function to build Rule Expression for given IAlarm and AlarmState.
Boolean(value)
static frompublic static fromBoolean(value: boolean): IAlarmRule
Parameters
- value
boolean
— boolean value to be used in rule expression.
Returns
function to build TRUE/FALSE intent for Rule Expression.
String(alarmRule)
static frompublic static fromString(alarmRule: string): IAlarmRule
Parameters
- alarmRule
string
— string to be used in Rule Expression.
Returns
function to build Rule Expression for given Alarm Rule string.
static not(operand)
public static not(operand: IAlarmRule): IAlarmRule
Parameters
- operand
IAlarm
— IAlarmRule to be wrapped in NOT operator.Rule
Returns
function to wrap provided AlarmRule in NOT operator.