Basic requirements VPN GW (#4276)

This commit is contained in:
Mohit Alonja 2021-09-10 22:51:29 +05:30 committed by GitHub
parent d5ffce650f
commit e061d371c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 9 deletions

View File

@ -6702,9 +6702,10 @@ class VpnGatewayBackend(object):
def detach_vpn_gateway(self, vpn_gateway_id, vpc_id):
vpn_gateway = self.get_vpn_gateway(vpn_gateway_id)
self.get_vpc(vpc_id)
detached = vpn_gateway.attachments.pop(vpc_id, None)
detached = vpn_gateway.attachments.get(vpc_id, None)
if not detached:
raise InvalidVPCIdError(vpc_id)
detached.state = "detached"
return detached

View File

@ -53,15 +53,13 @@ CREATE_VPN_GATEWAY_RESPONSE = """
<requestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</requestId>
<vpnGateway>
<vpnGatewayId>{{ vpn_gateway.id }}</vpnGatewayId>
<state>available</state>
<state>{{ vpn_gateway.state }}</state>
<type>{{ vpn_gateway.type }}</type>
<availabilityZone>{{ vpn_gateway.availability_zone }}</availabilityZone>
<attachments/>
<tagSet>
{% for tag in vpn_gateway.get_tags() %}
<item>
<resourceId>{{ tag.resource_id }}</resourceId>
<resourceType>{{ tag.resource_type }}</resourceType>
<key>{{ tag.key }}</key>
<value>{{ tag.value }}</value>
</item>
@ -77,9 +75,9 @@ DESCRIBE_VPN_GATEWAYS_RESPONSE = """
{% for vpn_gateway in vpn_gateways %}
<item>
<vpnGatewayId>{{ vpn_gateway.id }}</vpnGatewayId>
<state>available</state>
<state>{{ vpn_gateway.state }}</state>
<type>{{ vpn_gateway.id }}</type>
<availabilityZone>us-east-1a</availabilityZone>
<availabilityZone>{{ vpn_gateway.availability_zone }}</availabilityZone>
<attachments>
{% for attachment in vpn_gateway.attachments.values() %}
<item>
@ -92,8 +90,6 @@ DESCRIBE_VPN_GATEWAYS_RESPONSE = """
<tagSet>
{% for tag in vpn_gateway.get_tags() %}
<item>
<resourceId>{{ tag.resource_id }}</resourceId>
<resourceType>{{ tag.resource_type }}</resourceType>
<key>{{ tag.key }}</key>
<value>{{ tag.value }}</value>
</item>

View File

@ -120,4 +120,7 @@ TestAccAwsEc2ManagedPrefixList
TestAccAWSEgressOnlyInternetGateway
TestAccAWSSecurityGroup_
TestAccAWSInternetGateway
TestAccAWSVpnGateway_basic
TestAccAWSVpnGateway_delete
TestAccAWSVpnGateway_tags
TestAccAWSSecurityGroupRule_

View File

@ -271,4 +271,5 @@ def test_detach_vpn_gateway():
gateway = conn.get_all_vpn_gateways()[0]
attachments = gateway.attachments
attachments.should.have.length_of(0)
attachments.should.have.length_of(1)
attachments[0].state.should.equal("detached")