Add nat_gateway_id to route and describe_route_tables
This commit is contained in:
parent
502957f1f9
commit
43070a03ba
3 changed files with 53 additions and 0 deletions
|
|
@ -3302,6 +3302,7 @@ class Route(object):
|
|||
local=False,
|
||||
gateway=None,
|
||||
instance=None,
|
||||
nat_gateway=None,
|
||||
interface=None,
|
||||
vpc_pcx=None,
|
||||
):
|
||||
|
|
@ -3311,6 +3312,7 @@ class Route(object):
|
|||
self.local = local
|
||||
self.gateway = gateway
|
||||
self.instance = instance
|
||||
self.nat_gateway = nat_gateway
|
||||
self.interface = interface
|
||||
self.vpc_pcx = vpc_pcx
|
||||
|
||||
|
|
@ -3323,6 +3325,7 @@ class Route(object):
|
|||
gateway_id = properties.get("GatewayId")
|
||||
instance_id = properties.get("InstanceId")
|
||||
interface_id = properties.get("NetworkInterfaceId")
|
||||
nat_gateway_id = properties.get("NatGatewayId")
|
||||
pcx_id = properties.get("VpcPeeringConnectionId")
|
||||
|
||||
route_table_id = properties["RouteTableId"]
|
||||
|
|
@ -3332,6 +3335,7 @@ class Route(object):
|
|||
destination_cidr_block=properties.get("DestinationCidrBlock"),
|
||||
gateway_id=gateway_id,
|
||||
instance_id=instance_id,
|
||||
nat_gateway_id=nat_gateway_id,
|
||||
interface_id=interface_id,
|
||||
vpc_peering_connection_id=pcx_id,
|
||||
)
|
||||
|
|
@ -3349,6 +3353,7 @@ class RouteBackend(object):
|
|||
local=False,
|
||||
gateway_id=None,
|
||||
instance_id=None,
|
||||
nat_gateway_id=None,
|
||||
interface_id=None,
|
||||
vpc_peering_connection_id=None,
|
||||
):
|
||||
|
|
@ -3369,12 +3374,17 @@ class RouteBackend(object):
|
|||
except ValueError:
|
||||
raise InvalidDestinationCIDRBlockParameterError(destination_cidr_block)
|
||||
|
||||
nat_gateway = None
|
||||
if nat_gateway_id is not None:
|
||||
nat_gateway = self.nat_gateways.get(nat_gateway_id)
|
||||
|
||||
route = Route(
|
||||
route_table,
|
||||
destination_cidr_block,
|
||||
local=local,
|
||||
gateway=gateway,
|
||||
instance=self.get_instance(instance_id) if instance_id else None,
|
||||
nat_gateway=nat_gateway,
|
||||
interface=None,
|
||||
vpc_pcx=self.get_vpc_peering_connection(vpc_peering_connection_id)
|
||||
if vpc_peering_connection_id
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class RouteTables(BaseResponse):
|
|||
destination_cidr_block = self._get_param("DestinationCidrBlock")
|
||||
gateway_id = self._get_param("GatewayId")
|
||||
instance_id = self._get_param("InstanceId")
|
||||
nat_gateway_id = self._get_param("NatGatewayId")
|
||||
interface_id = self._get_param("NetworkInterfaceId")
|
||||
pcx_id = self._get_param("VpcPeeringConnectionId")
|
||||
|
||||
|
|
@ -26,6 +27,7 @@ class RouteTables(BaseResponse):
|
|||
destination_cidr_block,
|
||||
gateway_id=gateway_id,
|
||||
instance_id=instance_id,
|
||||
nat_gateway_id=nat_gateway_id,
|
||||
interface_id=interface_id,
|
||||
vpc_peering_connection_id=pcx_id,
|
||||
)
|
||||
|
|
@ -173,6 +175,10 @@ DESCRIBE_ROUTE_TABLES_RESPONSE = """
|
|||
<origin>CreateRoute</origin>
|
||||
<state>blackhole</state>
|
||||
{% endif %}
|
||||
{% if route.nat_gateway %}
|
||||
<natGatewayId>{{ route.nat_gateway.id }}</natGatewayId>
|
||||
<state>active</state>
|
||||
{% endif %}
|
||||
</item>
|
||||
{% endfor %}
|
||||
</routeSet>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue