How to use delete_client_vpn_endpoint method in localstack

Best Python code snippet using localstack_python

delete-default-vpcs.py

Source:delete-default-vpcs.py Github

copy

Full Screen

...79 for page in paginator.paginate():80 for cvpn_endpoint in page['ClientVpnEndpoints']:81 if cvpn_endpoint['VpcId'] == vpc.id:82 logger.debug("Deleting {}, VPC:{}".format(cvpn_endpoint['ClientVpnEndpointId'],vpc.id))83 client.delete_client_vpn_endpoint(ClientVpnEndpointId=[cvpn_endpoint['ClientVpnEndpointId']])84def delete_vgw(vpc,logger):85 client = vpc.meta.client86 response = client.describe_vpn_gateways(Filters=[87 {'Name': 'attachment.vpc-id', 'Values': [vpc.id]},88 {'Name': 'state', 'Values': ['pending', 'available']},89 ])90 for vgw in response['VpnGateways']:91 for attachment in vgw['VpcAttachments']:92 if attachment['State'] in ['attaching','attached']:93 logger.debug("Detaching {}, from VPC:{}".format(vgw['VpnGatewayId'],vpc.id))94 client.detach_vpn_gateway(VpcId=vpc.id, VpnGatewayId=vgw['VpnGatewayId'])95 break96 response = client.describe_vpn_connections(Filters=[{'Name': 'vpn-gateway-id', 'Values': [vgw['VpnGatewayId']]}])97 for vpn_connection in response['VpnConnections']:...

Full Screen

Full Screen

vpn-setup.py

Source:vpn-setup.py Github

copy

Full Screen

...42 response = client.disassociate_client_vpn_target_network(43 ClientVpnEndpointId=endpoint_id, AssociationId=association_id, DryRun=False44 )45 debug(response)46 response = client.delete_client_vpn_endpoint(ClientVpnEndpointId=endpoint_id, DryRun=False)47 debug(response)48def create_endpoint(49 service_name,50 operating_env,51 vpc_id,52 client_cidr,53 server_cert,54 client_cert,55 security_groups,56 public_subnets,57):58 client = ec2_client('ec2')59 endpoint_name = client_endpoint_name(service_name, operating_env)60 endpoint_id = find_endpoint_by_name(client, endpoint_name)...

Full Screen

Full Screen

purge.py

Source:purge.py Github

copy

Full Screen

...64 else:65 print('Removed ACM client certificate with ARN %s' % server_arn)66 state.remove('client_cert_acm_arn')67 return server_arn_success and client_arn_success68def delete_client_vpn_endpoint():69 """70 Delete all resources created during Client VPN `create`71 :return: True if all certs were removed72 """73 state = State()74 session = boto3.Session(profile_name=state.get('profile'),75 region_name='us-east-1')76 ec2_client = session.client('ec2')77 security_group_id = state.get('security_group_id')78 vpn_endpoint_id = state.get('vpn_endpoint_id')79 subnet_cidr_block = state.get('subnet_cidr_block')80 association_id = state.get('association_id')81 security_group_success = True82 client_vpn_endpoint_success = True83 client_vpn_target_network_success = True84 client_vpn_ingress_success = True85 if vpn_endpoint_id is None or subnet_cidr_block is None:86 print('There is no VPN ingress to revoke')87 else:88 try:89 ec2_client.revoke_client_vpn_ingress(90 ClientVpnEndpointId=vpn_endpoint_id,91 TargetNetworkCidr=subnet_cidr_block,92 RevokeAllGroups=True,93 )94 except Exception as e:95 print('Failed to delete client VPN ingress: %s' % e)96 client_vpn_ingress_success = False97 else:98 print('Successfully removed client VPN ingress')99 if association_id is None:100 print('There is no VPN association ID to delete')101 else:102 try:103 ec2_client.disassociate_client_vpn_target_network(104 ClientVpnEndpointId=vpn_endpoint_id,105 AssociationId=association_id106 )107 except Exception as e:108 args = (association_id, e)109 print('Failed to delete client VPN association with ID %s: %s' % args)110 client_vpn_target_network_success = False111 else:112 print('Successfully removed client VPN association with ID %s' % association_id)113 state.remove('association_id')114 if vpn_endpoint_id is None:115 print('There is no client VPN endpoint to delete')116 else:117 try:118 ec2_client.delete_client_vpn_endpoint(ClientVpnEndpointId=vpn_endpoint_id)119 except Exception as e:120 args = (vpn_endpoint_id, e)121 print('Failed to delete client VPN endpoint with ID %s: %s' % args)122 client_vpn_endpoint_success = False123 else:124 print('Successfully removed client VPN endpoint with ID %s' % vpn_endpoint_id)125 state.remove('vpn_endpoint_id')126 if security_group_id is None:127 print('There is no security group to remove')128 else:129 try:130 ec2_client.delete_security_group(131 GroupId=security_group_id132 )...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful