mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|compute] describe reserved instances offerings
This commit is contained in:
parent
3423f0ead1
commit
5b2aaef25e
3 changed files with 80 additions and 0 deletions
|
@ -68,6 +68,7 @@ module Fog
|
|||
request :describe_reserved_instances
|
||||
request :describe_key_pairs
|
||||
request :describe_regions
|
||||
request :describe_reserved_instances_offerings
|
||||
request :describe_security_groups
|
||||
request :describe_snapshots
|
||||
request :describe_tags
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module AWS
|
||||
module Compute
|
||||
|
||||
class DescribeReservedInstancesOfferings < Fog::Parsers::Base
|
||||
|
||||
def reset
|
||||
@reserved_instances_offering = {}
|
||||
@response = { 'reservedInstancesOfferingsSet' => [] }
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'availabilityZone', 'instanceType', 'productDescription', 'reservedInstancesOfferingId'
|
||||
@reserved_instances_offering[name] = @value
|
||||
when 'duration'
|
||||
@reserved_instances_offering[name] = @value.to_i
|
||||
when 'fixedPrice', 'usagePrice'
|
||||
@reserved_instances_offering[name] = @value.to_f
|
||||
when 'item'
|
||||
@response['reservedInstancesOfferingsSet'] << @reserved_instances_offering
|
||||
@reserved_instances_offering = {}
|
||||
when 'requestId'
|
||||
@response[name] = @value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,45 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class Compute
|
||||
class Real
|
||||
|
||||
require 'fog/compute/parsers/aws/describe_reserved_instances_offerings'
|
||||
|
||||
# Describe all or specified reserved instances offerings
|
||||
#
|
||||
# ==== Parameters
|
||||
# * filters<~Hash> - List of filters to limit results with
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# * 'requestId'<~String> - Id of request
|
||||
# * 'reservedInstancesOfferingsSet'<~Array>:
|
||||
# * 'availabilityZone'<~String> - availability zone of offering
|
||||
# * 'duration'<~Integer> - duration, in seconds, of offering
|
||||
# * 'fixedPrice'<~Float> - purchase price of offering
|
||||
# * 'instanceType'<~String> - instance type of offering
|
||||
# * 'productDescription'<~String> - description of offering
|
||||
# * 'reservedInstancesOfferingId'<~String> - id of offering
|
||||
# * 'usagePrice'<~Float> - usage price of offering, per hour
|
||||
def describe_reserved_instances_offerings(filters = {})
|
||||
params = AWS.indexed_filters(filters)
|
||||
request({
|
||||
'Action' => 'DescribeReservedInstancesOfferings',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeReservedInstancesOfferings.new
|
||||
}.merge!(params))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def describe_reserved_instances_offerings(filters = {})
|
||||
Fog::Mock.not_implemented
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue