Sha256: 8324f5200912e74d675647558817f113ba450ad256fbab7be9376ca788a4e313

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

module Fog
  module AWS
    class CloudWatch
      class Real

        require 'rackspace-fog/aws/parsers/cloud_watch/list_metrics'

        # List availabe metrics
        #
        # ==== Options
        # * Dimensions<~Array>: a list of dimensions to filter against,
        #     Name : The name of the dimension
        #     Value : The value to filter against
        # * MetricName<~String>: The name of the metric to filter against
        # * Namespace<~String>: The namespace to filter against
        # * NextToken<~String> The token returned by a previous call to indicate that there is more data available
        # ==== Returns
        # * response<~Excon::Response>:
        #
        # ==== See Also
        # http://docs.amazonwebservices.com/AmazonCloudWatch/latest/APIReference/API_ListMetrics.html
        #
        def list_metrics(options={})
          if dimensions = options.delete('Dimensions')
            options.merge!(AWS.indexed_param('Dimensions.member.%d.Name', dimensions.collect {|dimension| dimension['Name']}))
            options.merge!(AWS.indexed_param('Dimensions.member.%d.Value', dimensions.collect {|dimension| dimension['Value']}))
          end

          request({
              'Action'    => 'ListMetrics',
              :parser     => Fog::Parsers::AWS::CloudWatch::ListMetrics.new
            }.merge(options))
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rackspace-fog-1.4.2 lib/rackspace-fog/aws/requests/cloud_watch/list_metrics.rb