Added DisassociateTransitGatewayRouteTable API (#4154)
This commit is contained in:
parent
298e220122
commit
6db042dc72
@ -6240,6 +6240,10 @@ class TransitGatewayRouteTableBackend(object):
|
|||||||
"transitGatewayAttachmentId": transit_gateway_attachment_id,
|
"transitGatewayAttachmentId": transit_gateway_attachment_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def unset_route_table_association(self, tgw_rt_id):
|
||||||
|
tgw_rt = self.transit_gateways_route_tables[tgw_rt_id]
|
||||||
|
tgw_rt.route_table_association = {}
|
||||||
|
|
||||||
def set_route_table_propagation(
|
def set_route_table_propagation(
|
||||||
self, transit_gateway_attachment_id, transit_gateway_route_table_id
|
self, transit_gateway_attachment_id, transit_gateway_route_table_id
|
||||||
):
|
):
|
||||||
@ -6256,6 +6260,10 @@ class TransitGatewayRouteTableBackend(object):
|
|||||||
"transitGatewayAttachmentId": transit_gateway_attachment_id,
|
"transitGatewayAttachmentId": transit_gateway_attachment_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def unset_route_table_propagation(self, tgw_rt_id):
|
||||||
|
tgw_rt = self.transit_gateways_route_tables[tgw_rt_id]
|
||||||
|
tgw_rt.route_table_propagation = {}
|
||||||
|
|
||||||
def disable_route_table_propagation(self, transit_gateway_route_table_id):
|
def disable_route_table_propagation(self, transit_gateway_route_table_id):
|
||||||
self.transit_gateways_route_tables[
|
self.transit_gateways_route_tables[
|
||||||
transit_gateway_route_table_id
|
transit_gateway_route_table_id
|
||||||
@ -6538,6 +6546,9 @@ class TransitGatewayAttachmentBackend(object):
|
|||||||
"transitGatewayRouteTableId": transit_gateway_route_table_id,
|
"transitGatewayRouteTableId": transit_gateway_route_table_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def unset_attachment_association(self, tgw_attach_id):
|
||||||
|
self.transit_gateway_attachments.get(tgw_attach_id).association = {}
|
||||||
|
|
||||||
def set_attachment_propagation(
|
def set_attachment_propagation(
|
||||||
self, transit_gateway_attachment_id=None, transit_gateway_route_table_id=None
|
self, transit_gateway_attachment_id=None, transit_gateway_route_table_id=None
|
||||||
):
|
):
|
||||||
@ -6546,6 +6557,9 @@ class TransitGatewayAttachmentBackend(object):
|
|||||||
"transitGatewayRouteTableId": transit_gateway_route_table_id,
|
"transitGatewayRouteTableId": transit_gateway_route_table_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def unset_attachment_propagation(self, tgw_attach_id):
|
||||||
|
self.transit_gateway_attachments.get(tgw_attach_id).propagation = {}
|
||||||
|
|
||||||
def disable_attachment_propagation(self, transit_gateway_attachment_id=None):
|
def disable_attachment_propagation(self, transit_gateway_attachment_id=None):
|
||||||
self.transit_gateway_attachments[transit_gateway_attachment_id].propagation[
|
self.transit_gateway_attachments[transit_gateway_attachment_id].propagation[
|
||||||
"state"
|
"state"
|
||||||
@ -6715,6 +6729,15 @@ class TransitGatewayRelationsBackend(object):
|
|||||||
|
|
||||||
return transit_gateway_propagation
|
return transit_gateway_propagation
|
||||||
|
|
||||||
|
def disassociate_transit_gateway_route_table(self, tgw_attach_id, tgw_rt_id):
|
||||||
|
tgw_association = self.transit_gateway_associations.pop(tgw_attach_id)
|
||||||
|
tgw_association.state == "disassociated"
|
||||||
|
|
||||||
|
self.unset_route_table_association(tgw_rt_id)
|
||||||
|
self.unset_attachment_association(tgw_attach_id)
|
||||||
|
|
||||||
|
return tgw_association
|
||||||
|
|
||||||
|
|
||||||
class NatGateway(CloudFormationModel):
|
class NatGateway(CloudFormationModel):
|
||||||
def __init__(self, backend, subnet_id, allocation_id, tags=[]):
|
def __init__(self, backend, subnet_id, allocation_id, tags=[]):
|
||||||
|
@ -88,6 +88,17 @@ class TransitGatewayAttachment(BaseResponse):
|
|||||||
template = self.response_template(TRANSIT_GATEWAY_ASSOCIATION)
|
template = self.response_template(TRANSIT_GATEWAY_ASSOCIATION)
|
||||||
return template.render(transit_gateway_association=transit_gateway_association)
|
return template.render(transit_gateway_association=transit_gateway_association)
|
||||||
|
|
||||||
|
def disassociate_transit_gateway_route_table(self,):
|
||||||
|
tgw_attach_id = self._get_param("TransitGatewayAttachmentId")
|
||||||
|
tgw_rt_id = self._get_param("TransitGatewayRouteTableId")
|
||||||
|
|
||||||
|
tgw_association = self.ec2_backend.disassociate_transit_gateway_route_table(
|
||||||
|
tgw_attach_id, tgw_rt_id
|
||||||
|
)
|
||||||
|
tgw_association.state == "disassociated"
|
||||||
|
template = self.response_template(TRANSIT_GATEWAY_DISASSOCIATION)
|
||||||
|
return template.render(tgw_association=tgw_association)
|
||||||
|
|
||||||
def enable_transit_gateway_route_table_propagation(self):
|
def enable_transit_gateway_route_table_propagation(self):
|
||||||
transit_gateway_attachment_id = self._get_param("TransitGatewayAttachmentId")
|
transit_gateway_attachment_id = self._get_param("TransitGatewayAttachmentId")
|
||||||
transit_gateway_route_table_id = self._get_param("TransitGatewayRouteTableId")
|
transit_gateway_route_table_id = self._get_param("TransitGatewayRouteTableId")
|
||||||
@ -351,6 +362,19 @@ TRANSIT_GATEWAY_ASSOCIATION = """<AssociateTransitGatewayRouteTableResponse xmln
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
TRANSIT_GATEWAY_DISASSOCIATION = """<DisassociateTransitGatewayRouteTableResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
|
||||||
|
<requestId>86a597cf-93ec-44a3-9559-4641863642a5</requestId>
|
||||||
|
<association>
|
||||||
|
<resourceId>{{ tgw_association.resource_id }}</resourceId>
|
||||||
|
<resourceType>{{ tgw_association.resource_type }}</resourceType>
|
||||||
|
<state>{{ tgw_association.state }}</state>
|
||||||
|
<transitGatewayAttachmentId>{{ tgw_association.transit_gateway_attachment_id }}</transitGatewayAttachmentId>
|
||||||
|
<transitGatewayRouteTableId>{{ tgw_association.transit_gateway_route_table_id }}</transitGatewayRouteTableId>
|
||||||
|
</association>
|
||||||
|
</DisassociateTransitGatewayRouteTableResponse>
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
TRANSIT_GATEWAY_PROPAGATION = """<EnableTransitGatewayRouteTablePropagationResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
|
TRANSIT_GATEWAY_PROPAGATION = """<EnableTransitGatewayRouteTablePropagationResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
|
||||||
<requestId>c78427d4-e498-46ae-bc14-32841b16bff4</requestId>
|
<requestId>c78427d4-e498-46ae-bc14-32841b16bff4</requestId>
|
||||||
<propagation>
|
<propagation>
|
||||||
|
Loading…
Reference in New Issue
Block a user