How to use disassociate_transit_gateway_route_table method in localstack

Best Python code snippet using localstack_python

state_machine_router.py

Source:state_machine_router.py Github

copy

Full Screen

...33 response = tgw.tgw_attachment_crud_operations()34 elif function_name == 'describe_transit_gateway_route_tables':35 response = tgw.describe_transit_gateway_route_tables()36 elif function_name == 'disassociate_transit_gateway_route_table':37 response = tgw.disassociate_transit_gateway_route_table()38 elif function_name == 'associate_transit_gateway_route_table':39 response = tgw.associate_transit_gateway_route_table()40 elif function_name == 'get_transit_gateway_attachment_propagations':41 response = tgw.get_transit_gateway_attachment_propagations()42 elif function_name == 'enable_transit_gateway_route_table_propagation':43 response = tgw.enable_transit_gateway_route_table_propagation()44 elif function_name == 'disable_transit_gateway_route_table_propagation':45 response = tgw.disable_transit_gateway_route_table_propagation()46 elif function_name == 'get_transit_gateway_vpc_attachment_state':47 response = tgw.get_transit_gateway_vpc_attachment_state()48 else:49 message = "Function name does not match any function in the handler file."50 logger.info(message)51 return {"Message": message}...

Full Screen

Full Screen

test_transit_gateway_routetable.py

Source:test_transit_gateway_routetable.py Github

copy

Full Screen

1# Copyright (c) 2018 Cloudify Platform Ltd. All rights reserved2#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.14# Standard imports15import unittest16# Third party imports17from mock import patch, MagicMock18# Local imports19from cloudify_aws.common._compat import reload_module20from cloudify_aws.common.tests.test_base import (21 TestBase,22 mock_decorator23)24from cloudify_aws.ec2.resources import transit_gateway_routetable as mod25class TestEC2RouteTable(TestBase):26 def setUp(self):27 self.routetable = mod.EC2TransitGatewayRouteTable(28 "ctx_node", resource_id=True, client=True, logger=None)29 mock1 = patch('cloudify_aws.common.decorators.aws_resource',30 mock_decorator)31 mock2 = patch('cloudify_aws.common.decorators.wait_for_status',32 mock_decorator)33 mock1.start()34 mock2.start()35 reload_module(mod)36 def test_class_properties(self):37 effect = self.get_client_error_exception(38 name='EC2 Transit Gateway Route Table')39 self.routetable.client = \40 self.make_client_function('describe_transit_gateway_route_tables',41 side_effect=effect)42 self.assertIsNone(self.routetable.properties)43 value = {}44 self.routetable.client = \45 self.make_client_function('describe_transit_gateway_route_tables',46 return_value=value)47 self.assertIsNone(self.routetable.properties)48 value = {mod.ROUTETABLES: [{mod.ROUTETABLE_ID: 'test_name'}]}49 self.routetable.client = \50 self.make_client_function('describe_transit_gateway_route_tables',51 return_value=value)52 res = self.routetable.properties53 self.assertEqual(res[mod.ROUTETABLE_ID], 'test_name')54 def test_class_create(self):55 value = {mod.ROUTETABLE: 'foo'}56 self.routetable.client = \57 self.make_client_function('create_transit_gateway_route_table',58 return_value=value)59 res = self.routetable.create(value)60 self.assertEqual(res[mod.ROUTETABLE], value[mod.ROUTETABLE])61 def test_class_delete(self):62 params = {}63 self.routetable.client = self.make_client_function(64 'delete_transit_gateway_route_table')65 self.routetable.delete(params)66 self.assertTrue(67 self.routetable.client.delete_transit_gateway_route_table.called)68 params = {mod.ROUTETABLE: 'foo'}69 self.routetable.delete(params)70 self.assertEqual(params[mod.ROUTETABLE], 'foo')71 def test_class_attach(self):72 value = {mod.ROUTETABLE_ID: 'foo', mod.TG_ATTACHMENT_ID: 'bar'}73 self.routetable.client = \74 self.make_client_function('associate_transit_gateway_route_table',75 return_value=value)76 res = self.routetable.attach(value)77 self.assertEqual(res[mod.ROUTETABLE_ID], value[mod.ROUTETABLE_ID])78 def test_class_detach(self):79 params = {}80 self.routetable.client = self.make_client_function(81 'disassociate_transit_gateway_route_table')82 self.routetable.detach(params)83 self.assertTrue(84 self.routetable.client85 .disassociate_transit_gateway_route_table.called)86 # ctx = self.get_mock_ctx("TransitGatewayRouteTable")87 params = {}88 self.routetable.detach(params)89 self.assertTrue(90 self.routetable.client91 .disassociate_transit_gateway_route_table.called)92 def test_create(self):93 ctx = self.get_mock_ctx("RouteTable")94 config = {mod.TG_ID: 'foo'}95 self.routetable.resource_id = 'foo'96 iface = MagicMock()97 iface.create = self.mock_return({mod.ROUTETABLE: config})98 mod.create(ctx=ctx, iface=iface, resource_config=config)99 self.assertEqual(self.routetable.resource_id, 'foo')100 def test_attach(self):101 ctx = self.get_mock_ctx("RouteTable")102 self.routetable.resource_id = 'foo'103 config = {mod.ROUTETABLE_ID: 'foo', mod.TG_ATTACHMENT_ID: 'bar'}104 iface = MagicMock()105 iface.attach = self.mock_return(config)106 with patch('cloudify_aws.common.utils.find_rel_by_node_type'):107 mod.attach(ctx, iface, config)108 self.assertEqual(self.routetable.resource_id,109 'foo')110 def test_delete(self):111 ctx = self.get_mock_ctx("RouteTable")112 iface = MagicMock()113 mod.delete(ctx=ctx, iface=iface, resource_config={})114 self.assertTrue(iface.delete.called)115 def test_detach(self):116 ctx = self.get_mock_ctx("RouteTable")117 self.routetable.resource_id = 'route table'118 ctx.instance.runtime_properties['association_ids'] = ['association_id']119 iface = MagicMock()120 iface.detach = self.mock_return(ctx.instance.runtime_properties[121 'association_ids'])122 mod.detach(ctx, iface, {})123 self.assertEqual(self.routetable.resource_id,124 'route table')125if __name__ == '__main__':...

Full Screen

Full Screen

tgw_routing_automation.py

Source:tgw_routing_automation.py Github

copy

Full Screen

...41 TransitGatewayAttachmentId=tgw_attachment_id42 )43 send(msg, context, Status.SUCCESS, {}, physical_resource_id=str(uuid.uuid4()))44 if request_type == 'Delete':45 ec2_client.disassociate_transit_gateway_route_table(46 TransitGatewayRouteTableId=route_table_id,47 TransitGatewayAttachmentId=tgw_attachment_id48 )49 ec2_client.disable_transit_gateway_route_table_propagation(50 TransitGatewayRouteTableId=tgw_hub_route_table,51 TransitGatewayAttachmentId=tgw_attachment_id52 )53 send(msg, context, Status.SUCCESS, {}, physical_resource_id=str(uuid.uuid4()))54 if request_type == 'Update':55 send(msg, context, Status.FAILED, {}, reason='Update on this resource is not supported')56 except Exception as e:57 print(str(e))58 send(msg, context, Status.FAILED, {}, reason=str(e))59 raise(e)...

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