mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Added describe_route_tables mock.
This commit is contained in:
parent
b9794ae64e
commit
cdce0b8f1d
1 changed files with 27 additions and 1 deletions
|
@ -49,12 +49,38 @@ module Fog
|
|||
:parser => Fog::Parsers::Compute::AWS::DescribeRouteTables.new
|
||||
}.merge!(params))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
def describe_route_tables(filters = {})
|
||||
unless filters.is_a?(Hash)
|
||||
Fog::Logger.deprecation("describe_route_tables with #{filters.class} param is deprecated, use describe_route_tables('route-table-id' => []) instead [light_black](#{caller.first})[/]")
|
||||
filters = {'route-table-id' => [*filters]}
|
||||
end
|
||||
|
||||
display_routes = self.data[:route_tables].dup
|
||||
|
||||
aliases = {
|
||||
'route-table-id' => 'routeTableId',
|
||||
'vpc-id' => 'vpcId'
|
||||
}
|
||||
|
||||
for filter_key, filter_value in filters
|
||||
filter_attribute = aliases[filter_key]
|
||||
case filter_attribute
|
||||
when 'routeTableId', 'vpcId'
|
||||
display_routes.reject! { |routetable| routetable[filter_attribute] != filter_value }
|
||||
end
|
||||
end
|
||||
|
||||
Excon::Response.new(
|
||||
:status => 200,
|
||||
:body => {
|
||||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'routeTableSet' => display_routes
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue