Best Python code snippet using localstack_python
client.pyi
Source:client.pyi
...4252 ) -> DisassociateSubnetCidrBlockResultTypeDef:4253 """4254 [Client.disassociate_subnet_cidr_block documentation](https://boto3.amazonaws.com/v1/documentation/api/1.14.47/reference/services/ec2.html#EC2.Client.disassociate_subnet_cidr_block)4255 """4256 def disassociate_transit_gateway_multicast_domain(4257 self,4258 TransitGatewayMulticastDomainId: str = None,4259 TransitGatewayAttachmentId: str = None,4260 SubnetIds: List[str] = None,4261 DryRun: bool = None,4262 ) -> DisassociateTransitGatewayMulticastDomainResultTypeDef:4263 """4264 [Client.disassociate_transit_gateway_multicast_domain documentation](https://boto3.amazonaws.com/v1/documentation/api/1.14.47/reference/services/ec2.html#EC2.Client.disassociate_transit_gateway_multicast_domain)4265 """4266 def disassociate_transit_gateway_route_table(4267 self, TransitGatewayRouteTableId: str, TransitGatewayAttachmentId: str, DryRun: bool = None4268 ) -> DisassociateTransitGatewayRouteTableResultTypeDef:4269 """4270 [Client.disassociate_transit_gateway_route_table documentation](https://boto3.amazonaws.com/v1/documentation/api/1.14.47/reference/services/ec2.html#EC2.Client.disassociate_transit_gateway_route_table)...
transit-gateway.py
Source:transit-gateway.py
...96 TransitGatewayId=transit_gateway_id,97 DryRun=False98 )99# dissacotiate transit gateway multicast domain100def disassociate_transit_gateway_multicast_domain(tgw_multicast_domain_id, tgw_attachment_id, subnet_id):101 client = boto3.client('ec2', region_name='us-east-1')102 response = client.disassociate_transit_gateway_multicast_domain(103 TransitGatewayMulticastDomainId=tgw_multicast_domain_id,104 TransitGatewayAttachmentId=tgw_attachment_id,105 SubnetIds=[106 subnet_id,107 ],108 DryRun=False109 )110#register transit gateway multi-cast members111def register_transit_gateway_multicast_group_members(tgw_multicast_domain_id, group_address, network_interface2, network_interface3, network_interface4):112 client = boto3.client('ec2', region_name='us-east-1')113 response = client.register_transit_gateway_multicast_group_members(114 TransitGatewayMulticastDomainId = tgw_multicast_domain_id,115 GroupIpAddress = group_address,116 NetworkInterfaceIds = [117 network_interface2, network_interface3, network_interface4118 ],119 DryRun = False120 )121 return response122def register_transit_gateway_multicast_group_sources(tgw_multicast_domain_id, nic1id):123 client = boto3.client('ec2', region_name='us-east-1')124 response = client.register_transit_gateway_multicast_group_sources(125 TransitGatewayMulticastDomainId=tgw_multicast_domain_id,126 GroupIpAddress='224.0.0.0',127 NetworkInterfaceIds=[128 nic1id,129 ],130 DryRun=False131 )132 return response133if __name__ == '__main__':134 action = sys.argv[1]135 if action == "apply":136 #Get variables from cmd line137 vpc_id = sys.argv[2]138 subnet_id = sys.argv[3]139 i1nic = sys.argv[4]140 i2nic = sys.argv[5]141 i3nic = sys.argv[6]142 i4nic = sys.argv[7]143 #Create transit gateway144 tgw_response = create_transit_gateway()145 #Collect transit gateway id from response146 tgw_id = tgw_response['TransitGateway']['TransitGatewayId']147 time.sleep(180)148 #Create transit gateway attachment149 tgw_attachment_response = create_transit_gateway_vpc_attachment(tgw_id, vpc_id, subnet_id)150 #get tgw attachment id response151 tgw_attachment_id = tgw_attachment_response['TransitGatewayVpcAttachment']['TransitGatewayAttachmentId']152 time.sleep(60)153 #Create transit gateway route table and get response154 tgw_rt_response = create_transit_gateway_rt(tgw_id)155 #Get transit gateway route table id from the response156 tgw_rt_id = tgw_rt_response ['TransitGatewayRouteTable']['TransitGatewayRouteTableId']157 time.sleep(90)158 #Create transit gateway route159 create_transit_gateway_route(tgw_rt_id, "10.123.111.0/24", tgw_attachment_id)160 #Create transit gateway multi cast domain161 tgw_multicast_domain_response = create_transit_gateway_multicast_domain(tgw_id)162 #Get transit gateway multi cast domain id163 tgw_multicast_domain_id = tgw_multicast_domain_response['TransitGatewayMulticastDomain']['TransitGatewayMulticastDomainId']164 time.sleep(90)165 #Associate transit gateway multi-cast domain166 associate_transit_gateway_multicast_domain(tgw_multicast_domain_id, tgw_attachment_id, subnet_id)167 time.sleep(30)168 #register transit gateway multicast group members169 register_transit_gateway_multicast_group_members(tgw_multicast_domain_id, "224.0.0.0", i2nic, i3nic, i4nic)170 time.sleep(30)171 #register transit gateway multicast group sources172 register_transit_gateway_multicast_group_sources(tgw_multicast_domain_id,i1nic)173 if action == "destroy":174 #Get values from input175 transit_gateway_multicast_domain_id = sys.argv[2]176 transit_gateway_attachment_id = sys.argv[3]177 transit_gateway_id = sys.argv[4]178 subnet_id = sys.argv[5]179 #Dissacotiate transit gate way multicast domain with subnet180 disassociate_transit_gateway_multicast_domain(transit_gateway_multicast_domain_id, transit_gateway_attachment_id, subnet_id)181 time.sleep(120)182 #Delete transit gateway multicast domain183 delete_transit_gateway_multicast_domain(transit_gateway_multicast_domain_id)184 time.sleep(120)185 #Delete transit gateway VPC attachment186 delete_transit_gateway_vpc_attachment(transit_gateway_attachment_id)187 time.sleep(120)188 #Delete transit gateway...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!