2010-03-16 18:46:21 -04:00
module Fog
2011-06-16 19:28:54 -04:00
module Compute
class AWS
2010-03-16 18:46:21 -04:00
class Real
2010-02-18 19:57:50 -05:00
2011-08-24 21:37:00 -04:00
require 'fog/aws/parsers/compute/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
2013-10-21 08:23:36 -04:00
# * 'end' - time reservation stopped being applied (i.e sold or canceled - as of version 2013/10/01)
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 )
2011-10-19 15:49:34 -04:00
Fog :: Logger . deprecation ( " describe_reserved_instances with #{ filters . class } param is deprecated, use describe_reserved_instances('reserved-instances-id' => []) instead [light_black]( #{ caller . first } )[/] " )
2010-10-04 18:46:12 -04:00
filters = { 'reserved-instances-id' = > [ * filters ] }
end
2011-06-20 16:49:37 -04:00
params = Fog :: 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 ,
2011-06-16 19:28:54 -04:00
:parser = > Fog :: Parsers :: Compute :: AWS :: DescribeReservedInstances . new
2010-03-16 01:15:33 -04:00
} . merge! ( params ) )
2010-02-18 19:57:50 -05:00
end
end
2011-07-13 02:54:13 -04:00
class Mock
def describe_reserved_instances ( filters = { } )
response = Excon :: Response . new
response . status = 200
response . body = {
'reservedInstancesSet' = > self . data [ :reserved_instances ] . values ,
'requestId' = > Fog :: AWS :: Mock . request_id
}
response
end
end
2010-02-18 19:57:50 -05:00
end
end
end