mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Added mock for disassociate_route_table.
This commit is contained in:
parent
ff37b88b12
commit
91a6275e20
1 changed files with 24 additions and 2 deletions
|
@ -21,14 +21,36 @@ module Fog
|
|||
request(
|
||||
'Action' => 'DisassociateRouteTable',
|
||||
'AssociationId' => association_id,
|
||||
:parser => Fog::Parsers::Compute::AWS::DisassociateRouteTable.new
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
|
||||
def disassociate_route_table(association_id)
|
||||
assoc_array = nil
|
||||
routetable = self.data[:route_tables].find { |routetable|
|
||||
assoc_array = routetable["associationSet"].find { |association|
|
||||
association['routeTableAssociationId'].eql? association_id
|
||||
}
|
||||
}
|
||||
if !assoc_array.nil? && assoc_array['main'] == false
|
||||
routetable['associationSet'].delete(assoc_array)
|
||||
response = Excon::Response.new
|
||||
response.status = 200
|
||||
response.body = {
|
||||
'requestId' => Fog::AWS::Mock.request_id,
|
||||
'return' => true
|
||||
}
|
||||
response
|
||||
elsif assoc_array.nil?
|
||||
raise Fog::Compute::AWS::NotFound.new("The association ID '#{association_id}' does not exist")
|
||||
elsif assoc_array['main'] == true
|
||||
raise Fog::Compute::AWS::Error, "InvalidParameterValue => cannot disassociate the main route table association #{association_id}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue