Sha256: fb42fb1c1614d317b2ef42aa0a524043c4fdbc09892255d6484f0b0de5f37d24
Contents?: true
Size: 873 Bytes
Versions: 22
Compression:
Stored size: 873 Bytes
Contents
require 'fog/core/collection' require 'fog/aws/models/cloud_watch/metric_statistic' module Fog module AWS class CloudWatch class MetricStatistics < Fog::Collection model Fog::AWS::CloudWatch::MetricStatistic 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 = service.get_metric_statistics(get_metric_opts).body['GetMetricStatisticsResult']['Datapoints'] data.map! { |datum| datum.merge('MetricName' => metricName, 'Namespace' => namespace, 'Dimensions' => dimensions) } load(data) # data is an array of attribute hashes end end end end end
Version data entries
22 entries across 22 versions & 5 rubygems