How to use create_vpn_connection_route method in localstack

Best Python code snippet using localstack_python

ec2.py

Source:ec2.py Github

copy

Full Screen

...170 VpnGatewayId=vpngwid,171 DryRun=noop,172 Options=options173 )174 def create_vpn_connection_route(self, cidr, vpnid):175 self.ec2Client.create_vpn_connection_route(176 DestinationCidrBlock=cidr,177 VpnConnectionId=vpnid178 )179 def delete_vpn_connection(self, vpnid, noop=False):180 self.ec2Client.delete_vpn_connection(181 VpnConnectionId=vpnid,182 DryRun=noop183 )184 def delete_vpn_connection_route(self, cidr, vpnid):185 self.ec2Client.delete_vpn_connection_route(186 DestinationCidrBlock=cidr,187 VpnConnectionId=vpnid188 )189 def delete_vpn_gateway(self, vpngwid, noop=False):...

Full Screen

Full Screen

vpn.py

Source:vpn.py Github

copy

Full Screen

...103 vpnConnectionId = kwargs['vpnConnectionId']104 except KeyError as e:105 raise ArguementError(_requiredArgs, vpnConnection.createVpnRoute.__name__)106 try:107 vpnCreationResp = self.ec2Client.create_vpn_connection_route(VpnConnectionId=vpnConnectionId,108 DestinationCidrBlock=customerCidrBlock)109 except Exception as e:110 raise AwsError(boto3Api="create_vpn_connection_route", error=e)111 self.log.info("Created vpn connection route")112 return True113 def getCustomerConfigInfo(self, **kwargs):114 _requiredArgs = ['vpnConnectionId']115 try:116 vpnConnectionId = kwargs['vpnConnectionId']117 except KeyError as e:118 raise ArguementError(_requiredArgs, vpnConnection.getCustomerConfigInfo.__name__)119 try:120 vpnDescribeResp = self.ec2Client.describe_vpn_connections(VpnConnectionIds=[vpnConnectionId])121 except Exception as e:...

Full Screen

Full Screen

vpn_connection.py

Source:vpn_connection.py Github

copy

Full Screen

1# Copyright 2015 Isotoma Limited2#3# Licensed under the Apache License, Version 2.0 (the "License");4# you may not use this file except in compliance with the License.5# You may obtain a copy of the License at6#7# http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS,11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12# See the License for the specific language governing permissions and13# limitations under the License.14from touchdown.core import argument, serializers15from touchdown.core.plan import Plan, Present16from touchdown.core.resource import Resource17from ..common import SimpleApply, SimpleDescribe, SimpleDestroy, TagsMixin18from .customer_gateway import CustomerGateway19from .vpc import VPC20from .vpn_gateway import VpnGateway21class VpnConnection(Resource):22 resource_name = "vpn_connection"23 name = argument.String(field="Name", group="tags")24 customer_gateway = argument.Resource(CustomerGateway, field="CustomerGatewayId")25 vpn_gateway = argument.Resource(VpnGateway, field="VpnGatewayId")26 type = argument.String(default="ipsec.1", choices=["ipsec.1"], field="Type")27 static_routes_only = argument.Boolean(28 default=True,29 field="Options",30 serializer=serializers.Dict(StaticRoutesOnly=serializers.Boolean()),31 )32 static_routes = argument.List()33 # FIXME: This should somehow be a list of argument.IPNetwork34 tags = argument.Dict()35 vpc = argument.Resource(VPC)36class Describe(SimpleDescribe, Plan):37 resource = VpnConnection38 service_name = "ec2"39 api_version = "2015-10-01"40 describe_action = "describe_vpn_connections"41 describe_envelope = "VpnConnections"42 key = "VpnConnectionId"43 def get_describe_filters(self):44 vpc = self.runner.get_plan(self.resource.vpc)45 if not vpc.resource_id:46 return None47 return {"Filters": [{"Name": "tag:Name", "Values": [self.resource.name]}]}48class Apply(TagsMixin, SimpleApply, Describe):49 create_action = "create_vpn_connection"50 waiter = "vpn_connection_available"51 signature = (Present("name"), Present("vpn_gateway"), Present("customer_gateway"))52 def update_object(self):53 remote_routes = set(54 r["DestinationCidrBlock"]55 for r in self.object.get("Routes", [])56 if r["State"] != "deleted"57 )58 local_routes = set(self.resource.static_routes)59 for route in local_routes.difference(remote_routes):60 yield self.generic_action(61 "Add missing route {}".format(route),62 self.client.create_vpn_connection_route,63 VpnConnectionId=serializers.Identifier(),64 DestinationCidrBlock=route,65 )66 for route in remote_routes.difference(local_routes):67 yield self.generic_action(68 "Remove stale route {}".format(route),69 self.client.create_vpn_connection_route,70 VpnConnectionId=serializers.Identifier(),71 DestinationCidrBlock=route,72 )73class Destroy(SimpleDestroy, Describe):74 destroy_action = "delete_vpn_connection"...

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