AlarmRule

class aws_cdk.aws_cloudwatch.AlarmRule

Bases: object

Class with static functions to build AlarmRule for Composite Alarms.

ExampleMetadata:

infused

Example:

# alarm1: cloudwatch.Alarm
# alarm2: cloudwatch.Alarm
# alarm3: cloudwatch.Alarm
# alarm4: cloudwatch.Alarm


alarm_rule = cloudwatch.AlarmRule.any_of(
    cloudwatch.AlarmRule.all_of(
        cloudwatch.AlarmRule.any_of(alarm1,
            cloudwatch.AlarmRule.from_alarm(alarm2, cloudwatch.AlarmState.OK), alarm3),
        cloudwatch.AlarmRule.not(cloudwatch.AlarmRule.from_alarm(alarm4, cloudwatch.AlarmState.INSUFFICIENT_DATA))),
    cloudwatch.AlarmRule.from_boolean(False))

cloudwatch.CompositeAlarm(self, "MyAwesomeCompositeAlarm",
    alarm_rule=alarm_rule
)

Static Methods

classmethod all_of(*operands)

function to join all provided AlarmRules with AND operator.

Parameters:

operands (IAlarmRule) – IAlarmRules to be joined with AND operator.

Return type:

IAlarmRule

classmethod any_of(*operands)

function to join all provided AlarmRules with OR operator.

Parameters:

operands (IAlarmRule) – IAlarmRules to be joined with OR operator.

Return type:

IAlarmRule

classmethod from_alarm(alarm, alarm_state)

function to build Rule Expression for given IAlarm and AlarmState.

Parameters:
  • alarm (IAlarm) – IAlarm to be used in Rule Expression.

  • alarm_state (AlarmState) – AlarmState to be used in Rule Expression.

Return type:

IAlarmRule

classmethod from_boolean(value)

function to build TRUE/FALSE intent for Rule Expression.

Parameters:

value (bool) – boolean value to be used in rule expression.

Return type:

IAlarmRule

classmethod from_string(alarm_rule)

function to build Rule Expression for given Alarm Rule string.

Parameters:

alarm_rule (str) – string to be used in Rule Expression.

Return type:

IAlarmRule

classmethod not_(operand)

function to wrap provided AlarmRule in NOT operator.

Parameters:

operand (IAlarmRule) – IAlarmRule to be wrapped in NOT operator.

Return type:

IAlarmRule