Class: Fog::AWS::CloudWatch::MetricStatistics
- Inherits:
-
Collection
- Object
- Array
- Collection
- Fog::AWS::CloudWatch::MetricStatistics
- Defined in:
- lib/fog/aws/models/cloud_watch/metric_statistics.rb
Instance Attribute Summary
Attributes inherited from Collection
Instance Method Summary collapse
Methods inherited from Collection
#clear, #create, #initialize, #inspect, #load, model, #model, #new, #reload, #table, #to_json
Methods included from Fog::Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Fog::Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Collection
Instance Method Details
#all(conditions) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/fog/aws/models/cloud_watch/metric_statistics.rb', line 10 def all(conditions) metricName = conditions['MetricName'] namespace = conditions['Namespace'] dimensions = conditions['Dimensions'] get_metric_opts = {"StartTime" => (Time.now-3600).iso8601, "EndTime" => Time.now.iso8601, "Period" => 300}.merge(conditions) data = connection.get_metric_statistics(get_metric_opts).body['GetMetricStatisticsResult']['Datapoints'] data.collect! { |datum| datum.merge('MetricName' => metricName, 'Namespace' => namespace, 'Dimensions' => dimensions) } load(data) # data is an array of attribute hashes end |