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
# 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)

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 (IAlarmRef) – 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