Sha256: 690eca2ff80cd0b2d3adedf7ce631b10eef3c6a920489003e365232dee72d56b

Contents?: true

Size: 1.45 KB

Versions: 32

Compression:

Stored size: 1.45 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'
              @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

32 entries across 32 versions & 10 rubygems

Version Path
fog-parser-fix-1.6.1 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-test-again-1.6.0 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-parser-fix-1.6.0 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-1.6.0 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-1.5.0 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
rackspace-fog-1.4.2 lib/rackspace-fog/aws/parsers/cloud_watch/list_metrics.rb
fog-1.4.0 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/cloud_watch/list_metrics.rb
michiels-fog-1.3.1 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/aws/parsers/cloud_watch/list_metrics.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-1.3.1 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-1.3.0 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/cloud_watch/list_metrics.rb
fog-1.2.0 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
ktheory-fog-1.1.2 lib/fog/aws/parsers/cloud_watch/list_metrics.rb
brightbox-cli-0.17.4 lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/cloud_watch/list_metrics.rb
brightbox-cli-0.17.3 lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/cloud_watch/list_metrics.rb
brightbox-cli-0.17.2 lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/cloud_watch/list_metrics.rb
brightbox-cli-0.17.1 lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/cloud_watch/list_metrics.rb