2011-05-16 05:48:09 -04:00
|
|
|
module Fog
|
|
|
|
module Parsers
|
|
|
|
module AWS
|
|
|
|
module CloudWatch
|
|
|
|
|
2011-05-19 06:37:45 -04:00
|
|
|
class GetMetricStatistics < Fog::Parsers::Base
|
2011-05-16 05:48:09 -04:00
|
|
|
|
|
|
|
def reset
|
|
|
|
@response = { 'GetMetricStatisticsResult' => {'Datapoints' => []}, 'ResponseMetadata' => {} }
|
|
|
|
reset_datapoint
|
|
|
|
end
|
|
|
|
|
|
|
|
def reset_datapoint
|
|
|
|
@datapoint = {}
|
|
|
|
end
|
|
|
|
|
|
|
|
def start_element(name, attrs = [])
|
|
|
|
super
|
|
|
|
end
|
|
|
|
|
|
|
|
def end_element(name)
|
|
|
|
case name
|
|
|
|
when 'Average', 'Maximum', 'Minimum', 'SampleCount', 'Sum'
|
2011-05-19 06:37:45 -04:00
|
|
|
@datapoint[name] = value.to_f
|
2011-05-16 05:48:09 -04:00
|
|
|
when 'Unit'
|
2011-05-19 06:37:45 -04:00
|
|
|
@datapoint[name] = value
|
2011-05-16 05:48:09 -04:00
|
|
|
when 'Timestamp'
|
2011-05-19 06:37:45 -04:00
|
|
|
@datapoint[name] = Time.parse value
|
|
|
|
when 'member'
|
2011-05-16 05:48:09 -04:00
|
|
|
@response['GetMetricStatisticsResult']['Datapoints'] << @datapoint
|
|
|
|
reset_datapoint
|
2011-05-19 06:37:45 -04:00
|
|
|
when 'Label'
|
|
|
|
@response['GetMetricStatisticsResult'][name] = value
|
2011-05-16 05:48:09 -04:00
|
|
|
when 'RequestId'
|
2011-05-19 06:37:45 -04:00
|
|
|
@response['ResponseMetadata'][name] = value
|
2011-05-16 05:48:09 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|