2010-02-18 19:57:50 -05:00
|
|
|
module Fog
|
|
|
|
module Parsers
|
2011-06-16 19:28:54 -04:00
|
|
|
module Compute
|
|
|
|
module AWS
|
2010-02-18 19:57:50 -05:00
|
|
|
|
|
|
|
class DescribeReservedInstances < Fog::Parsers::Base
|
|
|
|
|
|
|
|
def reset
|
|
|
|
@reserved_instance = {}
|
|
|
|
@response = { 'reservedInstancesSet' => [] }
|
|
|
|
end
|
|
|
|
|
|
|
|
def end_element(name)
|
|
|
|
case name
|
|
|
|
when 'availabilityZone', 'instanceType', 'productDescription', 'reservedInstancesId', 'state'
|
2011-05-12 16:15:13 -04:00
|
|
|
@reserved_instance[name] = value
|
2010-02-18 19:57:50 -05:00
|
|
|
when 'duration', 'instanceCount'
|
2011-05-12 16:15:13 -04:00
|
|
|
@reserved_instance[name] = value.to_i
|
2010-02-18 19:57:50 -05:00
|
|
|
when 'fixedPrice', 'usagePrice'
|
2011-05-12 16:15:13 -04:00
|
|
|
@reserved_instance[name] = value.to_f
|
2010-02-18 19:57:50 -05:00
|
|
|
when 'item'
|
|
|
|
@response['reservedInstancesSet'] << @reserved_instance
|
|
|
|
@reserved_instance = {}
|
|
|
|
when 'requestId'
|
2011-05-12 16:15:13 -04:00
|
|
|
@response[name] = value
|
2010-02-18 19:57:50 -05:00
|
|
|
when 'start'
|
2011-07-13 02:54:13 -04:00
|
|
|
@reserved_instance[name] = Time.parse(value)
|
2010-02-18 19:57:50 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|