def associate_route_table(routeTableId, subnetId)
routetable = self.data[:route_tables].find { |routetable| routetable["routeTableId"].eql? routeTableId }
subnet = self.data[:subnets].find { |subnet| subnet["subnetId"].eql? subnetId }
if !routetable.nil? && !subnet.nil?
response = Excon::Response.new
response.status = 200
association = add_route_association(routeTableId, subnetId)
routetable["associationSet"].push(association)
response.body = {
'requestId' => Fog::AWS::Mock.request_id,
'associationId' => association['routeTableAssociationId']
}
response
elsif routetable.nil?
raise Fog::Compute::AWS::NotFound.new("The routeTable ID '#{routeTableId}' does not exist")
else
raise Fog::Compute::AWS::NotFound.new("The subnet ID '#{subnetId}' does not exist")
end
end