Class: AWS::CloudWatch::MetricCollection

Inherits:
MetricBase
  • Object
show all
Includes:
Enumerable
Defined in:
lib/aws/cloud_watch/metric_collection.rb

Instance Attribute Summary

Attributes inherited from MetricBase

#dimensions, #name, #namespace

Instance Method Summary collapse

Methods inherited from MetricBase

#attr_names, #camel_case, #initialize, #inspect, #method_missing, #options, #set_attributes, #to_sym

Constructor Details

This class inherits a constructor from AWS::CloudWatch::MetricBase

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class AWS::CloudWatch::MetricBase

Instance Method Details

#each(&block) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/aws/cloud_watch/metric_collection.rb', line 21

def each &block

  next_token = nil

  begin
    
    list_options = options.merge(next_token ? { :next_token => next_token } : {})
    response = client.list_metrics(list_options)

    response.metrics.each do |t|
      metric = Metric.new(t.merge :config => config)
      yield(metric)
    end

  end while(next_token = response.data[:next_token])
  nil

end

#get_by_name(name) ⇒ Object Also known as: []



40
41
42
# File 'lib/aws/cloud_watch/metric_collection.rb', line 40

def get_by_name name
  Metric.new(options.merge(:name => camel_case(name), :config => config))
end