Class: Serverspec::Type::AWS::CloudWatch::Alarm
- Inherits:
-
Base
- Object
- Base
- Serverspec::Type::AWS::CloudWatch::Alarm
- Defined in:
- lib/resources/cloudwatch/alarm.rb
Overview
The Alarm class exposes the CloudWatch::Alarm resources
Instance Method Summary collapse
-
#actions_enabled? ⇒ Boolean
Indicates whether actions should be executed during any changes to the Alarm's state.
-
#alarm_actions ⇒ Array(String)
The list of actions to execute when this Alarm transitions into an ALARM state from any other state.
-
#alarm_description ⇒ String
The description for the Alarm.
-
#comparison_operator ⇒ String
The arithmetic operation to use when comparing the specified Statistic and Threshold.
-
#dimensions ⇒ Array(Hash{Symbol => String})
The list of dimensions associated with the Alarm's associated metric.
-
#evaluation_periods ⇒ Integer
The number of periods over which data is compared to the specified threshold.
-
#initialize(alarm_name, instance = nil) ⇒ Alarm
constructor
AWS SDK for Ruby v2 Aws::CloudWatch::Client wrapper for initializing an Alarm resource.
-
#insufficient_data_actions ⇒ Array(String)
The list of actions to execute when this Alarm transitions into an INSUFFICIENT_DATA state from any other state.
-
#metric_name ⇒ String
The name of the Alarm's metric.
-
#namespace ⇒ String
The namespace of Alarm's associated metric.
-
#ok? ⇒ Boolean
Checks if the Alarm state is OK.
-
#ok_actions ⇒ Array(String)
The list of actions to execute when this Alarm transitions into an OK state from any other state.
-
#period ⇒ Integer
The period in seconds over which the statistic is applied.
-
#statistic ⇒ String
The statistic to apply to the Alarm's associated metric.
-
#threshold ⇒ Number
The value against which the specified statistic is compared.
-
#to_s ⇒ String
Returns the String representation of CloudWatch::Alarmm.
Constructor Details
#initialize(alarm_name, instance = nil) ⇒ Alarm
AWS SDK for Ruby v2 Aws::CloudWatch::Client wrapper for initializing an Alarm resource
15 16 17 18 19 20 |
# File 'lib/resources/cloudwatch/alarm.rb', line 15 def initialize(alarm_name, instance = nil) check_init_arg 'alarm_name', 'CloudWatch::Alarm', alarm_name @alarm_name = alarm_name @aws = instance.nil? ? Aws::CloudWatch::Client.new : instance get_alarm alarm_name end |
Instance Method Details
#actions_enabled? ⇒ Boolean
Indicates whether actions should be executed during any changes to the Alarm's state
35 36 37 |
# File 'lib/resources/cloudwatch/alarm.rb', line 35 def actions_enabled? @alarm.actions_enabled end |
#alarm_actions ⇒ Array(String)
The list of actions to execute when this Alarm transitions into an ALARM state from any other state
55 56 57 |
# File 'lib/resources/cloudwatch/alarm.rb', line 55 def alarm_actions @alarm.alarm_actions end |
#alarm_description ⇒ String
The description for the Alarm
41 42 43 |
# File 'lib/resources/cloudwatch/alarm.rb', line 41 def alarm_description @alarm.alarm_description end |
#comparison_operator ⇒ String
The arithmetic operation to use when comparing the specified Statistic and Threshold
119 120 121 |
# File 'lib/resources/cloudwatch/alarm.rb', line 119 def comparison_operator @alarm.comparison_operator end |
#dimensions ⇒ Array(Hash{Symbol => String})
The list of dimensions associated with the Alarm's associated metric
93 94 95 |
# File 'lib/resources/cloudwatch/alarm.rb', line 93 def dimensions @alarm.dimensions end |
#evaluation_periods ⇒ Integer
The number of periods over which data is compared to the specified threshold
106 107 108 |
# File 'lib/resources/cloudwatch/alarm.rb', line 106 def evaluation_periods @alarm.evaluation_periods end |
#insufficient_data_actions ⇒ Array(String)
The list of actions to execute when this Alarm transitions into an INSUFFICIENT_DATA state from any other state
62 63 64 |
# File 'lib/resources/cloudwatch/alarm.rb', line 62 def insufficient_data_actions @alarm.insufficient_data_actions end |
#metric_name ⇒ String
The name of the Alarm's metric
68 69 70 |
# File 'lib/resources/cloudwatch/alarm.rb', line 68 def metric_name @alarm.metric_name end |
#namespace ⇒ String
The namespace of Alarm's associated metric
74 75 76 |
# File 'lib/resources/cloudwatch/alarm.rb', line 74 def namespace @alarm.namespace end |
#ok? ⇒ Boolean
Checks if the Alarm state is OK
29 30 31 |
# File 'lib/resources/cloudwatch/alarm.rb', line 29 def ok? @alarm.state_value == 'OK' end |
#ok_actions ⇒ Array(String)
The list of actions to execute when this Alarm transitions into an OK state from any other state
48 49 50 |
# File 'lib/resources/cloudwatch/alarm.rb', line 48 def ok_actions @alarm.ok_actions end |
#period ⇒ Integer
The period in seconds over which the statistic is applied
99 100 101 |
# File 'lib/resources/cloudwatch/alarm.rb', line 99 def period @alarm.period end |
#statistic ⇒ String
The statistic to apply to the Alarm's associated metric
80 81 82 |
# File 'lib/resources/cloudwatch/alarm.rb', line 80 def statistic @alarm.statistic end |
#threshold ⇒ Number
The value against which the specified statistic is compared
112 113 114 |
# File 'lib/resources/cloudwatch/alarm.rb', line 112 def threshold @alarm.threshold end |
#to_s ⇒ String
Returns the String representation of CloudWatch::Alarmm
24 25 26 |
# File 'lib/resources/cloudwatch/alarm.rb', line 24 def to_s "CloudWatch Alarm: #{@alarm_name}" end |