How to use delete_transit_gateway_connect_peer method in localstack

Best Python code snippet using localstack_python

infraDecom.py

Source:infraDecom.py Github

copy

Full Screen

...348def delTgwConnectPeer(connectPeerId):349 """350 delete tgw connnect peers of tgw connect attachment whose ID is connectPeerId351 """352 ec2client.delete_transit_gateway_connect_peer(353 TransitGatewayConnectPeerId=connectPeerId)354def delTgwConnect(connectAttachmentId):355 """356 check if it is possible to delete tgwConnect attachment357 only delete tgwConnect attachment if all connectPeers are in deleted state358 """359 eligibleDeletion = False360 listTgwConnectPeerInfo = listTgwConnectPeer(connectAttachmentId)361 eligibleConnectPeers = []362 # delete all connect peers who are not in deleted or deleting state.363 for tgwConnectPeerInfo in listTgwConnectPeerInfo:364 if tgwConnectPeerInfo['State'] not in ['deleted', 'deleting']:365 #print("Deleting TGW Connect Peer", tgwConnectPeerInfo['Id'], "in", connectAttachmentId)366 delTgwConnectPeer(tgwConnectPeerInfo['Id'])...

Full Screen

Full Screen

create_tgw_connect_peer.py

Source:create_tgw_connect_peer.py Github

copy

Full Screen

...48 cfnresponse.send(event, context, cfnresponse.SUCCESS, response_data, peer_id)49 return50 if event['RequestType'] == 'Delete':51 if re.match("tgw-connect-peer-[a-zA-Z0-9]+", event['PhysicalResourceId']):52 ec2.delete_transit_gateway_connect_peer(53 TransitGatewayConnectPeerId=event['PhysicalResourceId']54 )55 __wait_for_status(event['PhysicalResourceId'], 'deleted', ec2)56 cfnresponse.send(event, context, cfnresponse.SUCCESS, response_data, event['PhysicalResourceId'])57 return58 else:59 cfnresponse.send(event, context, cfnresponse.SUCCESS, response_data, event['PhysicalResourceId'])60 return61 if event['RequestType'] == 'Read':62 cfnresponse.send(event, context, cfnresponse.SUCCESS, response_data, event['PhysicalResourceId'])63 return64 if event['RequestType'] == 'Update':65 if re.match("tgw-connect-peer-[a-zA-Z0-9]+", event['PhysicalResourceId']):66 ec2.delete_transit_gateway_connect_peer(67 TransitGatewayConnectPeerId=event['PhysicalResourceId']68 )69 __wait_for_status(event['PhysicalResourceId'], 'deleted', ec2)70 tgw_connect_peer = ec2.create_transit_gateway_connect_peer(71 TransitGatewayAttachmentId=properties['TransitGatewayAttachmentId'],72 TransitGatewayAddress=properties['TransitGatewayAddress'],73 PeerAddress=properties['PeerAddress'],74 BgpOptions={75 'PeerAsn': int(properties['PeerAsn'])76 },77 InsideCidrBlocks=[78 properties['InsideCidrBlocks'],79 ]80 )['TransitGatewayConnectPeer']...

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