Class: Fog::Parsers::AWS::CloudWatch::DescribeAlarms
- Inherits:
-
Base
- Object
- Base
- Fog::Parsers::AWS::CloudWatch::DescribeAlarms
- Defined in:
- lib/fog/aws/parsers/cloud_watch/describe_alarms.rb
Instance Method Summary collapse
- #end_element(name) ⇒ Object
- #reset ⇒ Object
- #reset_alarm_actions ⇒ Object
- #reset_dimension ⇒ Object
- #reset_insufficient_data_actions ⇒ Object
- #reset_metric_alarms ⇒ Object
- #reset_ok_actions ⇒ Object
- #start_element(name, attrs = []) ⇒ Object
Instance Method Details
#end_element(name) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/fog/aws/parsers/cloud_watch/describe_alarms.rb', line 55 def end_element(name) case name when 'Name', 'Value' @dimension[name] = value when 'AlarmConfigurationUpdatedTimestamp', 'StateUpdatedTimestamp' @metric_alarms[name] = Time.parse value when 'Period', 'EvaluationPeriods' @metric_alarms[name] = value.to_i when 'Threshold' @metric_alarms[name] = value.to_f when 'AlarmActions' @in_alarm_actions = false when 'OKActions' @in_ok_actions = false when 'InsufficientDataActions' @in_insufficient_data_actions = false when 'AlarmName', 'Namespace', 'MetricName', 'AlarmDescription', 'AlarmArn', 'Unit', 'StateValue', 'Statistic', 'ComparisonOperator', 'StateReason', 'ActionsEnabled' @metric_alarms[name] = value when 'StateUpdatedTimestamp', 'AlarmConfigurationUpdatedTimestamp' @metric_alarms[name] = Time.parse value when 'Dimensions' @in_dimensions = false when 'RequestId' @response['ResponseMetadata'][name] = value when 'NextToken' @response['ResponseMetadata'][name] = value when 'member' if @in_dimensions @metric_alarms['Dimensions'] << @dimension elsif @in_alarm_actions @metric_alarms['AlarmActions'] << value.to_s.strip elsif @in_ok_actions @metric_alarms['OKActions'] << value.to_s.strip elsif @in_insufficient_data_actions @metric_alarms['InsufficientDataActions'] << value.to_s.strip elsif @metric_alarms.key?('AlarmName') @response['DescribeAlarmsResult']['MetricAlarms'] << @metric_alarms reset_metric_alarms elsif @response['DescribeAlarmsResult']['MetricAlarms'].last != nil @response['DescribeAlarmsResult']['MetricAlarms'].last.merge!( @metric_alarms) end end end |
#reset ⇒ Object
6 7 8 9 |
# File 'lib/fog/aws/parsers/cloud_watch/describe_alarms.rb', line 6 def reset @response = { 'DescribeAlarmsResult' => {'MetricAlarms' => []}, 'ResponseMetadata' => {} } reset_metric_alarms end |
#reset_alarm_actions ⇒ Object
24 25 26 |
# File 'lib/fog/aws/parsers/cloud_watch/describe_alarms.rb', line 24 def reset_alarm_actions @alarm_actions = {} end |
#reset_dimension ⇒ Object
20 21 22 |
# File 'lib/fog/aws/parsers/cloud_watch/describe_alarms.rb', line 20 def reset_dimension @dimension = {} end |
#reset_insufficient_data_actions ⇒ Object
32 33 34 |
# File 'lib/fog/aws/parsers/cloud_watch/describe_alarms.rb', line 32 def reset_insufficient_data_actions @insufficient_data_actions = {} end |
#reset_metric_alarms ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/fog/aws/parsers/cloud_watch/describe_alarms.rb', line 11 def reset_metric_alarms @metric_alarms = { 'Dimensions' => [], 'AlarmActions' => [], 'OKActions' => [], 'InsufficientDataActions' => [] } end |
#reset_ok_actions ⇒ Object
28 29 30 |
# File 'lib/fog/aws/parsers/cloud_watch/describe_alarms.rb', line 28 def reset_ok_actions @ok_actions = {} end |
#start_element(name, attrs = []) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/fog/aws/parsers/cloud_watch/describe_alarms.rb', line 36 def start_element(name, attrs = []) super case name when 'Dimensions' @in_dimensions = true when 'AlarmActions' @in_alarm_actions = true when 'OKActions' @in_ok_actions = true when 'InsufficientDataActions' @in_insufficient_data_actions = true when 'member' reset_dimension if @in_dimensions reset_alarm_actions if @in_alarm_actions reset_ok_actions if @in_ok_actions reset_insufficient_data_actions if @in_insufficient_data_actions end end |