diff --git a/lib/fog/compute/aws.rb b/lib/fog/compute/aws.rb index 83343ba08..a41273d91 100644 --- a/lib/fog/compute/aws.rb +++ b/lib/fog/compute/aws.rb @@ -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 diff --git a/lib/fog/compute/parsers/aws/describe_reserved_instances_offerings.rb b/lib/fog/compute/parsers/aws/describe_reserved_instances_offerings.rb new file mode 100644 index 000000000..0d9c76ff4 --- /dev/null +++ b/lib/fog/compute/parsers/aws/describe_reserved_instances_offerings.rb @@ -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 \ No newline at end of file diff --git a/lib/fog/compute/requests/aws/describe_reserved_instances_offerings.rb b/lib/fog/compute/requests/aws/describe_reserved_instances_offerings.rb new file mode 100644 index 000000000..04151551c --- /dev/null +++ b/lib/fog/compute/requests/aws/describe_reserved_instances_offerings.rb @@ -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