Class: Aws::CloudWatch::CompositeAlarm
- Inherits:
-
Object
- Object
- Aws::CloudWatch::CompositeAlarm
- Extended by:
- Deprecations
- Defined in:
- sig/composite_alarm.rbs,
lib/aws-sdk-cloudwatch/composite_alarm.rb
Overview
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#actions_enabled ⇒ Boolean
Indicates whether actions should be executed during any changes to the alarm state.
-
#actions_suppressed_by ⇒ String
When the value is
ALARM, it means that the actions are suppressed because the suppressor alarm is inALARMWhen the value isWaitPeriod, it means that the actions are suppressed because the composite alarm is waiting for the suppressor alarm to go into into theALARMstate. -
#actions_suppressed_reason ⇒ String
Captures the reason for action suppression.
-
#actions_suppressor ⇒ String
Actions will be suppressed if the suppressor alarm is in the
ALARMstate. -
#actions_suppressor_extension_period ⇒ Integer
The maximum time in seconds that the composite alarm waits after suppressor alarm goes out of the
ALARMstate. -
#actions_suppressor_wait_period ⇒ Integer
The maximum time in seconds that the composite alarm waits for the suppressor alarm to go into the
ALARMstate. -
#alarm_actions ⇒ Array<String>
The actions to execute when this alarm transitions to the ALARM state from any other state.
-
#alarm_arn ⇒ String
The Amazon Resource Name (ARN) of the alarm.
-
#alarm_configuration_updated_timestamp ⇒ Time
The time stamp of the last update to the alarm configuration.
-
#alarm_description ⇒ String
The description of the alarm.
-
#alarm_rule ⇒ String
The rule that this alarm uses to evaluate its alarm state.
-
#insufficient_data_actions ⇒ Array<String>
The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state.
- #name ⇒ String (also: #alarm_name)
-
#ok_actions ⇒ Array<String>
The actions to execute when this alarm transitions to the OK state from any other state.
-
#state_reason ⇒ String
An explanation for the alarm state, in text format.
-
#state_reason_data ⇒ String
An explanation for the alarm state, in JSON format.
-
#state_transitioned_timestamp ⇒ Time
The timestamp of the last change to the alarm's
StateValue. -
#state_updated_timestamp ⇒ Time
Tracks the timestamp of any state update, even if
StateValuedoesn't change. -
#state_value ⇒ String
The state value for the alarm.
Actions collapse
- #delete(options = {}) ⇒ EmptyStructure
- #describe_history(options = {}) ⇒ Types::DescribeAlarmHistoryOutput
- #disable_actions(options = {}) ⇒ EmptyStructure
- #enable_actions(options = {}) ⇒ EmptyStructure
- #identifiers ⇒ Object deprecated private Deprecated.
- #set_state(options = {}) ⇒ EmptyStructure
Instance Method Summary collapse
- #client ⇒ Client
-
#data ⇒ Types::CompositeAlarm
Returns the data for this CompositeAlarm.
-
#data_loaded? ⇒ Boolean
Returns
trueif this resource is loaded. -
#exists?(options = {}) ⇒ Boolean
Returns
trueif the CompositeAlarm exists. -
#initialize(*args) ⇒ CompositeAlarm
constructor
A new instance of CompositeAlarm.
-
#load ⇒ self
(also: #reload)
Loads, or reloads #data for the current CompositeAlarm.
-
#wait_until(options = {}) {|resource| ... } ⇒ Resource
deprecated
Deprecated.
Use [Aws::CloudWatch::Client] #wait_until instead
- #wait_until_exists(options = {}, &block) ⇒ CompositeAlarm
Constructor Details
#initialize(name, options = {}) ⇒ CompositeAlarm #initialize(options = {}) ⇒ CompositeAlarm
Returns a new instance of CompositeAlarm.
13 14 15 |
# File 'sig/composite_alarm.rbs', line 13
def initialize: (String name, Hash[Symbol, untyped] options) -> void
| (name: String, ?client: Client) -> void
| (Hash[Symbol, untyped] args) -> void
|
Instance Method Details
#actions_enabled ⇒ Boolean
Indicates whether actions should be executed during any changes to the alarm state.
22 |
# File 'sig/composite_alarm.rbs', line 22
def actions_enabled: () -> bool
|
#actions_suppressed_by ⇒ String
When the value is ALARM, it means that the actions are suppressed
because the suppressor alarm is in ALARM When the value is
WaitPeriod, it means that the actions are suppressed because the
composite alarm is waiting for the suppressor alarm to go into into
the ALARM state. The maximum waiting time is as specified in
ActionsSuppressorWaitPeriod. After this time, the composite alarm
performs its actions. When the value is ExtensionPeriod, it means
that the actions are suppressed because the composite alarm is waiting
after the suppressor alarm went out of the ALARM state. The maximum
waiting time is as specified in ActionsSuppressorExtensionPeriod.
After this time, the composite alarm performs its actions.
61 |
# File 'sig/composite_alarm.rbs', line 61
def actions_suppressed_by: () -> ("WaitPeriod" | "ExtensionPeriod" | "Alarm")
|
#actions_suppressed_reason ⇒ String
Captures the reason for action suppression.
64 |
# File 'sig/composite_alarm.rbs', line 64
def actions_suppressed_reason: () -> ::String
|
#actions_suppressor ⇒ String
Actions will be suppressed if the suppressor alarm is in the ALARM
state. ActionsSuppressor can be an AlarmName or an Amazon Resource
Name (ARN) from an existing alarm.
67 |
# File 'sig/composite_alarm.rbs', line 67
def actions_suppressor: () -> ::String
|
#actions_suppressor_extension_period ⇒ Integer
The maximum time in seconds that the composite alarm waits after
suppressor alarm goes out of the ALARM state. After this time, the
composite alarm performs its actions.
ExtensionPeriod is required only when ActionsSuppressor is
specified.
73 |
# File 'sig/composite_alarm.rbs', line 73
def actions_suppressor_extension_period: () -> ::Integer
|
#actions_suppressor_wait_period ⇒ Integer
The maximum time in seconds that the composite alarm waits for the
suppressor alarm to go into the ALARM state. After this time, the
composite alarm performs its actions.
WaitPeriod is required only when ActionsSuppressor is specified.
70 |
# File 'sig/composite_alarm.rbs', line 70
def actions_suppressor_wait_period: () -> ::Integer
|
#alarm_actions ⇒ Array<String>
The actions to execute when this alarm transitions to the ALARM state from any other state. Each action is specified as an Amazon Resource Name (ARN).
25 |
# File 'sig/composite_alarm.rbs', line 25
def alarm_actions: () -> ::Array[::String]
|
#alarm_arn ⇒ String
The Amazon Resource Name (ARN) of the alarm.
28 |
# File 'sig/composite_alarm.rbs', line 28
def alarm_arn: () -> ::String
|
#alarm_configuration_updated_timestamp ⇒ Time
The time stamp of the last update to the alarm configuration.
31 |
# File 'sig/composite_alarm.rbs', line 31
def alarm_configuration_updated_timestamp: () -> ::Time
|
#alarm_description ⇒ String
The description of the alarm.
34 |
# File 'sig/composite_alarm.rbs', line 34
def alarm_description: () -> ::String
|
#alarm_rule ⇒ String
The rule that this alarm uses to evaluate its alarm state.
37 |
# File 'sig/composite_alarm.rbs', line 37
def alarm_rule: () -> ::String
|
#client ⇒ Client
178 |
# File 'lib/aws-sdk-cloudwatch/composite_alarm.rb', line 178
def client: () -> Client
|
#data ⇒ Types::CompositeAlarm
Returns the data for this Aws::CloudWatch::CompositeAlarm. Calls
Aws::CloudWatch::Client#describe_alarms if #data_loaded? is false.
82 |
# File 'sig/composite_alarm.rbs', line 82
def data: () -> Types::CompositeAlarm
|
#data_loaded? ⇒ Boolean
85 |
# File 'sig/composite_alarm.rbs', line 85
def data_loaded?: () -> bool
|
#delete(options = {}) ⇒ EmptyStructure
96 |
# File 'sig/composite_alarm.rbs', line 96
def delete: (
|
#describe_history(options = {}) ⇒ Types::DescribeAlarmHistoryOutput
101 |
# File 'sig/composite_alarm.rbs', line 101
def describe_history: (
|
#disable_actions(options = {}) ⇒ EmptyStructure
114 |
# File 'sig/composite_alarm.rbs', line 114
def disable_actions: (
|
#enable_actions(options = {}) ⇒ EmptyStructure
119 |
# File 'sig/composite_alarm.rbs', line 119
def enable_actions: (
|
#exists?(options = {}) ⇒ Boolean
Returns true if the CompositeAlarm exists.
88 89 |
# File 'sig/composite_alarm.rbs', line 88
def exists?: (?max_attempts: Integer, ?delay: Numeric, ?before_attempt: (^(Integer attempts) -> void), ?before_wait: (^(Integer attempts, untyped response) -> void)) -> bool
| (?Hash[Symbol, untyped]) -> bool
|
#identifiers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
462 463 464 |
# File 'lib/aws-sdk-cloudwatch/composite_alarm.rb', line 462 def identifiers { name: @name } end |
#insufficient_data_actions ⇒ Array<String>
The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state. Each action is specified as an Amazon Resource Name (ARN).
40 |
# File 'sig/composite_alarm.rbs', line 40
def insufficient_data_actions: () -> ::Array[::String]
|
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::CloudWatch::CompositeAlarm.
Returns self making it possible to chain methods.
composite_alarm.reload.data
78 |
# File 'sig/composite_alarm.rbs', line 78
def load: () -> self
|
#name ⇒ String Also known as: alarm_name
18 |
# File 'sig/composite_alarm.rbs', line 18
def name: () -> String
|
#ok_actions ⇒ Array<String>
The actions to execute when this alarm transitions to the OK state from any other state. Each action is specified as an Amazon Resource Name (ARN).
43 |
# File 'sig/composite_alarm.rbs', line 43
def ok_actions: () -> ::Array[::String]
|
#set_state(options = {}) ⇒ EmptyStructure
124 |
# File 'sig/composite_alarm.rbs', line 124
def set_state: (
|
#state_reason ⇒ String
An explanation for the alarm state, in text format.
46 |
# File 'sig/composite_alarm.rbs', line 46
def state_reason: () -> ::String
|
#state_reason_data ⇒ String
An explanation for the alarm state, in JSON format.
49 |
# File 'sig/composite_alarm.rbs', line 49
def state_reason_data: () -> ::String
|
#state_transitioned_timestamp ⇒ Time
The timestamp of the last change to the alarm's StateValue.
58 |
# File 'sig/composite_alarm.rbs', line 58
def state_transitioned_timestamp: () -> ::Time
|
#state_updated_timestamp ⇒ Time
Tracks the timestamp of any state update, even if StateValue
doesn't change.
52 |
# File 'sig/composite_alarm.rbs', line 52
def state_updated_timestamp: () -> ::Time
|
#state_value ⇒ String
The state value for the alarm.
55 |
# File 'sig/composite_alarm.rbs', line 55
def state_value: () -> ("OK" | "ALARM" | "INSUFFICIENT_DATA")
|
#wait_until(options = {}) {|resource| ... } ⇒ Resource
Use [Aws::CloudWatch::Client] #wait_until instead
The waiting operation is performed on a copy. The original resource remains unchanged.
Waiter polls an API operation until a resource enters a desired state.
Basic Usage
Waiter will polls until it is successful, it fails by entering a terminal state, or until a maximum number of attempts are made.
# polls in a loop until condition is true
resource.wait_until() {|resource| condition}
Example
instance.wait_until(max_attempts:10, delay:5) do |instance|
instance.state.name == 'running'
end
Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. The waiting condition is set by passing a block to #wait_until:
# poll for ~25 seconds
resource.wait_until(max_attempts:5,delay:5) {|resource|...}
Callbacks
You can be notified before each polling attempt and before each
delay. If you throw :success or :failure from these callbacks,
it will terminate the waiter.
started_at = Time.now
# poll for 1 hour, instead of a number of attempts
proc = Proc.new do |attempts, response|
throw :failure if Time.now - started_at > 3600
end
# disable max attempts
instance.wait_until(before_wait:proc, max_attempts:nil) {...}
Handling Errors
When a waiter is successful, it returns the Resource. When a waiter fails, it raises an error.
begin
resource.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
attempts attempt in seconds invoked before each attempt invoked before each wait
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 |
# File 'lib/aws-sdk-cloudwatch/composite_alarm.rb', line 325 def wait_until( = {}, &block) self_copy = self.dup attempts = 0 [:max_attempts] = 10 unless .key?(:max_attempts) [:delay] ||= 10 [:poller] = Proc.new do attempts += 1 if block.call(self_copy) [:success, self_copy] else self_copy.reload unless attempts == [:max_attempts] :retry end end Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do Aws::Waiters::Waiter.new().wait({}) end end |
#wait_until_exists(options = {}, &block) ⇒ CompositeAlarm
92 93 |
# File 'sig/composite_alarm.rbs', line 92
def wait_until_exists: (?max_attempts: Integer, ?delay: Numeric, ?before_attempt: (^(Integer attempts) -> void), ?before_wait: (^(Integer attempts, untyped response) -> void)) ?{ (untyped waiter) -> void } -> CompositeAlarm
| (?Hash[Symbol, untyped]) ?{ (untyped waiter) -> void } -> CompositeAlarm
|