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. | 
static allOf(...operands) 
public 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.
static anyOf(...operands) 
public 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.
static fromAlarm(alarm, alarmState) 
public 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.
static fromBoolean(value) 
public 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.
static fromString(alarmRule) 
public 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.
