From 36ad5bcea4b477a76ca9eb76e98d7b77968b4fa8 Mon Sep 17 00:00:00 2001 From: Bohuslav Kabrda Date: Mon, 2 Jul 2012 14:43:21 +0200 Subject: [PATCH] And the same for internet gateways --- lib/fog/aws/compute.rb | 3 ++- .../aws/requests/compute/create_internet_gateway.rb | 13 +++++++------ .../aws/requests/compute/delete_internet_gateway.rb | 1 + .../requests/compute/describe_internet_gateways.rb | 9 +-------- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/lib/fog/aws/compute.rb b/lib/fog/aws/compute.rb index 00a45dbda..0108b7eb6 100644 --- a/lib/fog/aws/compute.rb +++ b/lib/fog/aws/compute.rb @@ -201,7 +201,8 @@ module Fog end, :subnets => [], :vpcs => [], - :dhcp_options => [] + :dhcp_options => [], + :internet_gateways => [] } end end diff --git a/lib/fog/aws/requests/compute/create_internet_gateway.rb b/lib/fog/aws/requests/compute/create_internet_gateway.rb index df0736609..34263e939 100644 --- a/lib/fog/aws/requests/compute/create_internet_gateway.rb +++ b/lib/fog/aws/requests/compute/create_internet_gateway.rb @@ -33,15 +33,16 @@ module Fog class Mock def create_internet_gateway() - Excon::Response.new( + self.data[:internet_gateways].push({ + 'internetGatewayId' => Fog::AWS::Mock.request_id, + 'attachmentSet' => {}, + 'tagSet' => {} + }) + Excon::Response.new( :status => 200, :body => { 'requestId' => Fog::AWS::Mock.request_id, - 'internetGatewaySet' => [ - 'internetGatewayId' => Fog::AWS::Mock.request_id, - 'attachmentSet' => {}, - 'tagSet' => {} - ] + 'internetGatewaySet' => self.data[:internet_gateways] } ) end diff --git a/lib/fog/aws/requests/compute/delete_internet_gateway.rb b/lib/fog/aws/requests/compute/delete_internet_gateway.rb index 06243350c..6ba7e0924 100644 --- a/lib/fog/aws/requests/compute/delete_internet_gateway.rb +++ b/lib/fog/aws/requests/compute/delete_internet_gateway.rb @@ -30,6 +30,7 @@ module Fog Excon::Response.new.tap do |response| if internet_gateway_id response.status = 200 + self.data[:internet_gateways].reject! { |v| v['internetGatewayId'] == internet_gateway_id } response.body = { 'requestId' => Fog::AWS::Mock.request_id, diff --git a/lib/fog/aws/requests/compute/describe_internet_gateways.rb b/lib/fog/aws/requests/compute/describe_internet_gateways.rb index e305a956b..2842c43f8 100644 --- a/lib/fog/aws/requests/compute/describe_internet_gateways.rb +++ b/lib/fog/aws/requests/compute/describe_internet_gateways.rb @@ -44,14 +44,7 @@ module Fog response.status = 200 response.body = { 'requestId' => Fog::AWS::Mock.request_id, - 'internetGatewaySet' => [ - 'internetGatewayId' => Fog::AWS::Mock.request_id, - 'attachmentSet' => { - 'vpcId' => Fog::AWS::Mock.request_id, - 'state' => 'pending', - }, - 'tagSet' => {} - ] + 'internetGatewaySet' => self.data[:internet_gateways] } end end