Sha256: 7ae5d22139a525bc5b5bb64a4982f394b5c437af4b54df0aaec2d24dd6bfef2e

Contents?: true

Size: 966 Bytes

Versions: 41

Compression:

Stored size: 966 Bytes

Contents

require 'fog/core/collection'
require 'fog/aws/models/cloud_watch/metric'

module Fog
  module AWS
    class CloudWatch

      class Metrics < Fog::Collection
        model Fog::AWS::CloudWatch::Metric
        
        def all(conditions={})
          data = connection.list_metrics(conditions).body['ListMetricsResult']['Metrics']
          load(data) # data is an array of attribute hashes
        end
        
        def get(namespace, metric_name, dimensions=nil)
          list_opts = {'Namespace' => namespace, 'MetricName' => metric_name}
          if dimensions
            dimensions_array = dimensions.collect do |name, value|
              {'Name' => name, 'Value' => value}
            end
            # list_opts.merge!('Dimensions' => dimensions_array) 
          end
          if data = connection.list_metrics(list_opts).body['ListMetricsResult']['Metrics'].first
            new(data)
          end
        end
        
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 12 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/aws/models/cloud_watch/metrics.rb
fog-nirvanix-1.8.1 lib/fog/aws/models/cloud_watch/metrics.rb
fog-parser-fix-1.6.1 lib/fog/aws/models/cloud_watch/metrics.rb
fog-test-again-1.6.0 lib/fog/aws/models/cloud_watch/metrics.rb
fog-parser-fix-1.6.0 lib/fog/aws/models/cloud_watch/metrics.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/aws/models/cloud_watch/metrics.rb
fog-1.8.0 lib/fog/aws/models/cloud_watch/metrics.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/aws/models/cloud_watch/metrics.rb
fog-1.7.0 lib/fog/aws/models/cloud_watch/metrics.rb
fog-1.6.0 lib/fog/aws/models/cloud_watch/metrics.rb
fog-1.5.0 lib/fog/aws/models/cloud_watch/metrics.rb
fog-1.4.0 lib/fog/aws/models/cloud_watch/metrics.rb
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/cloud_watch/metrics.rb
michiels-fog-1.3.1 lib/fog/aws/models/cloud_watch/metrics.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/aws/models/cloud_watch/metrics.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/cloud_watch/metrics.rb
fog-1.3.1 lib/fog/aws/models/cloud_watch/metrics.rb
fog-1.3.0 lib/fog/aws/models/cloud_watch/metrics.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/cloud_watch/metrics.rb
fog-1.2.0 lib/fog/aws/models/cloud_watch/metrics.rb