fixed owner id and delete rt (#4161)
This commit is contained in:
parent
574053cb27
commit
f2b8318211
@ -4375,6 +4375,10 @@ class VPCEndPoint(TaggedEC2Resource):
|
|||||||
self.dns_entries = dns_entries
|
self.dns_entries = dns_entries
|
||||||
self.add_tags(tags or {})
|
self.add_tags(tags or {})
|
||||||
|
|
||||||
|
@property
|
||||||
|
def owner_id(self):
|
||||||
|
return ACCOUNT_ID
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def created_at(self):
|
def created_at(self):
|
||||||
return iso_8601_datetime_with_milliseconds(self._created_at)
|
return iso_8601_datetime_with_milliseconds(self._created_at)
|
||||||
@ -4476,12 +4480,17 @@ class RouteBackend(object):
|
|||||||
route_table = self.get_route_table(route_table_id)
|
route_table = self.get_route_table(route_table_id)
|
||||||
return route_table.get(route_id)
|
return route_table.get(route_id)
|
||||||
|
|
||||||
def delete_route(self, route_table_id, destination_cidr_block):
|
def delete_route(
|
||||||
|
self, route_table_id, destination_cidr_block, destination_ipv6_cidr_block=None
|
||||||
|
):
|
||||||
|
cidr = destination_cidr_block
|
||||||
route_table = self.get_route_table(route_table_id)
|
route_table = self.get_route_table(route_table_id)
|
||||||
route_id = generate_route_id(route_table_id, destination_cidr_block)
|
if destination_ipv6_cidr_block:
|
||||||
|
cidr = destination_ipv6_cidr_block
|
||||||
|
route_id = generate_route_id(route_table_id, cidr)
|
||||||
deleted = route_table.routes.pop(route_id, None)
|
deleted = route_table.routes.pop(route_id, None)
|
||||||
if not deleted:
|
if not deleted:
|
||||||
raise InvalidRouteError(route_table_id, destination_cidr_block)
|
raise InvalidRouteError(route_table_id, cidr)
|
||||||
return deleted
|
return deleted
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,7 +50,10 @@ class RouteTables(BaseResponse):
|
|||||||
def delete_route(self):
|
def delete_route(self):
|
||||||
route_table_id = self._get_param("RouteTableId")
|
route_table_id = self._get_param("RouteTableId")
|
||||||
destination_cidr_block = self._get_param("DestinationCidrBlock")
|
destination_cidr_block = self._get_param("DestinationCidrBlock")
|
||||||
self.ec2_backend.delete_route(route_table_id, destination_cidr_block)
|
destination_ipv6_cidr_block = self._get_param("DestinationIpv6CidrBlock")
|
||||||
|
self.ec2_backend.delete_route(
|
||||||
|
route_table_id, destination_cidr_block, destination_ipv6_cidr_block
|
||||||
|
)
|
||||||
template = self.response_template(DELETE_ROUTE_RESPONSE)
|
template = self.response_template(DELETE_ROUTE_RESPONSE)
|
||||||
return template.render()
|
return template.render()
|
||||||
|
|
||||||
@ -128,7 +131,11 @@ CREATE_ROUTE_TABLE_RESPONSE = """
|
|||||||
{% for route in route_table.routes.values() %}
|
{% for route in route_table.routes.values() %}
|
||||||
{% if route.local %}
|
{% if route.local %}
|
||||||
<item>
|
<item>
|
||||||
<destinationCidrBlock>{{ route.destination_cidr_block }}</destinationCidrBlock>
|
{% if route.destination_ipv6_cidr_block %}
|
||||||
|
<destinationIpv6CidrBlock>{{ route.destination_ipv6_cidr_block }}</destinationIpv6CidrBlock>
|
||||||
|
{% else %}
|
||||||
|
<destinationCidrBlock>{{ route.destination_cidr_block }}</destinationCidrBlock>
|
||||||
|
{% endif %}
|
||||||
<gatewayId>local</gatewayId>
|
<gatewayId>local</gatewayId>
|
||||||
<state>active</state>
|
<state>active</state>
|
||||||
</item>
|
</item>
|
||||||
@ -158,10 +165,15 @@ DESCRIBE_ROUTE_TABLES_RESPONSE = """
|
|||||||
<item>
|
<item>
|
||||||
<routeTableId>{{ route_table.id }}</routeTableId>
|
<routeTableId>{{ route_table.id }}</routeTableId>
|
||||||
<vpcId>{{ route_table.vpc_id }}</vpcId>
|
<vpcId>{{ route_table.vpc_id }}</vpcId>
|
||||||
<routeSet>
|
<ownerId>{{ route_table.owner_id }}</ownerId>
|
||||||
|
<routeSet>
|
||||||
{% for route in route_table.routes.values() %}
|
{% for route in route_table.routes.values() %}
|
||||||
<item>
|
<item>
|
||||||
|
{% if route.destination_ipv6_cidr_block %}
|
||||||
|
<destinationIpv6CidrBlock>{{ route.destination_ipv6_cidr_block }}</destinationIpv6CidrBlock>
|
||||||
|
{% else %}
|
||||||
<destinationCidrBlock>{{ route.destination_cidr_block }}</destinationCidrBlock>
|
<destinationCidrBlock>{{ route.destination_cidr_block }}</destinationCidrBlock>
|
||||||
|
{% endif %}
|
||||||
{% if route.local %}
|
{% if route.local %}
|
||||||
<gatewayId>local</gatewayId>
|
<gatewayId>local</gatewayId>
|
||||||
<origin>CreateRouteTable</origin>
|
<origin>CreateRouteTable</origin>
|
||||||
|
@ -73,3 +73,11 @@ TestAccAWSUserPolicyAttachment
|
|||||||
TestAccAWSUserSSHKey
|
TestAccAWSUserSSHKey
|
||||||
TestAccAWSVpc_
|
TestAccAWSVpc_
|
||||||
TestAccAWSRouteTable_disappears
|
TestAccAWSRouteTable_disappears
|
||||||
|
TestAccAWSRouteTable_RequireRouteTarget
|
||||||
|
TestAccAWSRouteTable_Route_ConfigMode
|
||||||
|
TestAccAWSRouteTable_tags
|
||||||
|
TestAccAWSRouteTable_vgwRoutePropagation
|
||||||
|
TestAccAWSRouteTable_RequireRouteTarget
|
||||||
|
TestAccAWSRouteTable_disappears_SubnetAssociation
|
||||||
|
TestAccAWSRouteTable_disappears
|
||||||
|
TestAccAWSRouteTable_basic
|
@ -588,6 +588,7 @@ def test_create_route_with_invalid_destination_cidr_block_parameter():
|
|||||||
route
|
route
|
||||||
for route in route_table.routes
|
for route in route_table.routes
|
||||||
if route.destination_cidr_block != vpc.cidr_block
|
if route.destination_cidr_block != vpc.cidr_block
|
||||||
|
or route.destination_ipv6_cidr_block != vpc.cidr_block
|
||||||
]
|
]
|
||||||
new_routes.should.have.length_of(1)
|
new_routes.should.have.length_of(1)
|
||||||
new_routes[0].route_table_id.shouldnt.be.equal(None)
|
new_routes[0].route_table_id.shouldnt.be.equal(None)
|
||||||
|
Loading…
Reference in New Issue
Block a user