mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|compute] fix mock filters for internet gateways/subnets/vpcs
This commit is contained in:
parent
4ec4aa1e48
commit
9fc9244ee4
3 changed files with 39 additions and 21 deletions
|
@ -37,16 +37,22 @@ module Fog
|
|||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
class Mock
|
||||
def describe_internet_gateways(filters = {})
|
||||
Excon::Response.new.tap do |response|
|
||||
response.status = 200
|
||||
response.body = {
|
||||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'internetGatewaySet' => self.data[:internet_gateways]
|
||||
}
|
||||
internet_gateways = self.data[:internet_gateways]
|
||||
|
||||
if filters['internet-gateway-id']
|
||||
internet_gateways = internet_gateways.reject {|internet_gateway| internet_gateway['internetGatewayId'] != filters['internet-gateway-id']}
|
||||
end
|
||||
|
||||
Excon::Response.new(
|
||||
:status => 200,
|
||||
:body => {
|
||||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'internetGatewaySet' => internet_gateways
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -41,16 +41,22 @@ module Fog
|
|||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
class Mock
|
||||
def describe_subnets(filters = {})
|
||||
Excon::Response.new.tap do |response|
|
||||
response.status = 200
|
||||
response.body = {
|
||||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'subnetSet' => self.data[:subnets]
|
||||
}
|
||||
subnets = self.data[:subnets]
|
||||
|
||||
if filters['subnet-id']
|
||||
subnets = subnets.reject {|subnet| subnet['subnetId'] != filters['subnet-id']}
|
||||
end
|
||||
|
||||
Excon::Response.new(
|
||||
:status => 200,
|
||||
:body => {
|
||||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'subnetSet' => subnets
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -38,16 +38,22 @@ module Fog
|
|||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
class Mock
|
||||
def describe_vpcs(filters = {})
|
||||
Excon::Response.new.tap do |response|
|
||||
response.status = 200
|
||||
response.body = {
|
||||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'vpcSet' => self.data[:vpcs]
|
||||
}
|
||||
vpcs = self.data[:vpcs]
|
||||
|
||||
if filters['vpc-id']
|
||||
vpcs = vpcs.reject {|vpc| vpc['vpcId'] != filters['vpc-id']}
|
||||
end
|
||||
|
||||
Excon::Response.new(
|
||||
:status => 200,
|
||||
:body => {
|
||||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'vpcSet' => vpcs
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue