2010-03-16 18:46:21 -04:00
module Fog
module AWS
2010-09-08 17:40:02 -04:00
class Compute
2010-03-16 18:46:21 -04:00
class Real
2010-02-18 19:57:50 -05:00
2011-01-07 19:52:09 -05:00
require 'fog/compute/parsers/aws/describe_reserved_instances'
2010-06-12 18:31:17 -04:00
2010-02-18 19:57:50 -05:00
# Describe all or specified reserved instances
#
# ==== Parameters
2010-10-04 18:46:12 -04:00
# * filters<~Hash> - List of filters to limit results with
2010-02-18 19:57:50 -05:00
#
# ==== Returns
# * response<~Excon::Response>:
# * body<~Hash>:
# * 'requestId'<~String> - Id of request
# * 'reservedInstancesSet'<~Array>:
# * 'availabilityZone'<~String> - availability zone of the instance
# * 'duration'<~Integer> - duration of reservation, in seconds
# * 'fixedPrice'<~Float> - purchase price of reserved instance
# * 'instanceType'<~String> - type of instance
# * 'instanceCount'<~Integer> - number of reserved instances
# * 'productDescription'<~String> - reserved instance description
# * 'reservedInstancesId'<~String> - id of the instance
# * 'start'<~Time> - start time for reservation
# * 'state'<~String> - state of reserved instance purchase, in .[pending-payment, active, payment-failed, retired]
# * 'usagePrice"<~Float> - usage price of reserved instances, per hour
2011-05-19 12:31:56 -04:00
#
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeReservedInstances.html]
2010-10-04 18:46:12 -04:00
def describe_reserved_instances ( filters = { } )
unless filters . is_a? ( Hash )
Formatador . display_line ( " [yellow][WARN] describe_reserved_instances with #{ filters . class } param is deprecated, use describe_reserved_instances('reserved-instances-id' => []) instead[/] [light_black]( #{ caller . first } )[/] " )
filters = { 'reserved-instances-id' = > [ * filters ] }
end
params = AWS . indexed_filters ( filters )
2010-02-18 19:57:50 -05:00
request ( {
2010-05-24 17:22:35 -04:00
'Action' = > 'DescribeReservedInstances' ,
:idempotent = > true ,
2010-09-08 17:40:02 -04:00
:parser = > Fog :: Parsers :: AWS :: Compute :: DescribeReservedInstances . new
2010-03-16 01:15:33 -04:00
} . merge! ( params ) )
2010-02-18 19:57:50 -05:00
end
end
end
end
end