Sha256: 6e8d171ec1af899623e83cc186aea36373248b6661ecb4334d1144b8d3bd6107

Contents?: true

Size: 1.46 KB

Versions: 61

Compression:

Stored size: 1.46 KB

Contents

module Fog
  module Parsers
    module AWS
      module CloudWatch

        class ListMetrics < Fog::Parsers::Base

          def reset
            @response = { 'ListMetricsResult' => {'Metrics' => []}, 'ResponseMetadata' => {} }
            reset_metric
          end

          def reset_metric
            @metric = {'Dimensions' => []}
          end

          def reset_dimension
            @dimension = {}
          end

          def start_element(name, attrs = [])
            super
            case name
            when 'Dimensions'
              @in_dimensions = true
            when 'member'
              if @in_dimensions
                reset_dimension
              end
            end
          end

          def end_element(name)
            case name
            when 'Name', 'Value'
              @dimension[name] = value
            when 'Namespace', 'MetricName'
              @metric[name] = value
            when 'Dimensions'
              @in_dimensions = false
            when 'NextMarker', 'NextToken'
              @response['ListMetricsResult'][name] = value
            when 'RequestId'
              @response['ResponseMetadata'][name] = value
            when 'member'
              if !@in_dimensions
                @response['ListMetricsResult']['Metrics'] << @metric
                reset_metric
              else
                @metric['Dimensions'] << @dimension
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

61 entries across 61 versions & 6 rubygems

Version Path
fog-1.22.0 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-1.21.0 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-1.20.0 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-1.19.0 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/aws/parsers/cloud_watch/list_metrics.rb