1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Added some defaults for StartTime, EndTime and Period to model for MetricStatistics

This commit is contained in:
Henry Addison 2011-05-23 16:28:33 +01:00
parent f9d26321d2
commit 8232576e0d

View file

@ -11,7 +11,8 @@ module Fog
metricName = conditions['MetricName']
namespace = conditions['Namespace']
dimensions = conditions['Dimensions']
data = connection.get_metric_statistics(conditions).body['GetMetricStatisticsResult']['Datapoints']
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