Class: Fog::Parsers::AWS::CloudWatch::DescribeAlarms
- Inherits:
-
Base
- Object
- Nokogiri::XML::SAX::Document
- Base
- Fog::Parsers::AWS::CloudWatch::DescribeAlarms
- Defined in:
- lib/fog/aws/parsers/cloud_watch/describe_alarms.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #end_element(name) ⇒ Object
- #reset ⇒ Object
- #reset_dimension ⇒ Object
- #reset_metric_alarms ⇒ Object
- #start_element(name, attrs = []) ⇒ Object
Methods inherited from Base
#attr_value, #characters, #initialize, #value
Constructor Details
This class inherits a constructor from Fog::Parsers::Base
Instance Method Details
#end_element(name) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/fog/aws/parsers/cloud_watch/describe_alarms.rb', line 33 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', 'OKActions', 'InsufficientDataActions' @metric_alarms[name] = value.to_s.strip 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 if @metric_alarms.has_key?('AlarmName') @response['DescribeAlarmsResult']['MetricAlarms'] << @metric_alarms reset_metric_alarms elsif @response['DescribeAlarmsResult']['MetricAlarms'].last != nil @response['DescribeAlarmsResult']['MetricAlarms'].last.merge!( @metric_alarms) end else @metric_alarms['Dimensions'] << @dimension end end end |
#reset ⇒ Object
8 9 10 11 |
# File 'lib/fog/aws/parsers/cloud_watch/describe_alarms.rb', line 8 def reset @response = { 'DescribeAlarmsResult' => {'MetricAlarms' => []}, 'ResponseMetadata' => {} } reset_metric_alarms end |
#reset_dimension ⇒ Object
17 18 19 |
# File 'lib/fog/aws/parsers/cloud_watch/describe_alarms.rb', line 17 def reset_dimension @dimension = {} end |
#reset_metric_alarms ⇒ Object
13 14 15 |
# File 'lib/fog/aws/parsers/cloud_watch/describe_alarms.rb', line 13 def reset_metric_alarms @metric_alarms = {'Dimensions' => []} end |
#start_element(name, attrs = []) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/fog/aws/parsers/cloud_watch/describe_alarms.rb', line 21 def start_element(name, attrs = []) super case name when 'Dimensions' @in_dimensions = true when 'member' if @in_dimensions reset_dimension end end end |