Best Python code snippet using localstack_python
ec2.py
Source:ec2.py  
...497                f"{transit_gateway_route_table_id} and tgw attachment {transit_gateway_attachment_id}"498            )499            self.logger.exception(error)500            raise501    def get_transit_gateway_attachment_propagations(502        self, transit_gateway_attachment_id503    ):504        """505        This method retrieves transit gateway propagations for specified transit gateway attachment id506        :param transit_gateway_attachment_id: ID for transit gateway attachment507        :return list of propagations508        """509        try:510            response = (511                self.ec2_client.get_transit_gateway_attachment_propagations(512                    TransitGatewayAttachmentId=transit_gateway_attachment_id513                )514            )515            propagations_list = response.get(516                "TransitGatewayAttachmentPropagations", []517            )518            next_token = response.get("NextToken", None)519            while next_token is not None:520                response = self.ec2_client.get_transit_gateway_attachment_propagations(521                    TransitGatewayAttachmentId=transit_gateway_attachment_id,522                    NextToken=next_token,523                )524                propagations_list.extend(525                    response.get("TransitGatewayAttachmentPropagations", [])526                )527                next_token = response.get("NextToken", None)528            return propagations_list529        except Exception as error:530            self.logger.exception(531                f"Error while retrieving transit gateway propagations for "532                f"tgw attachment id {transit_gateway_attachment_id}"533            )534            self.logger.exception(error)...index.py
Source:index.py  
...45        response = tgw.disassociate_transit_gateway_route_table()46    elif function_name == "associate_transit_gateway_route_table":47        response = tgw.associate_transit_gateway_route_table()48    elif function_name == "get_transit_gateway_attachment_propagations":49        response = tgw.get_transit_gateway_attachment_propagations()50    elif function_name == "enable_transit_gateway_route_table_propagation":51        response = tgw.enable_transit_gateway_route_table_propagation()52    elif function_name == "disable_transit_gateway_route_table_propagation":53        response = tgw.disable_transit_gateway_route_table_propagation()54    elif function_name == "get_transit_gateway_vpc_attachment_state":55        response = tgw.get_transit_gateway_vpc_attachment_state()56    elif function_name == "tag_transit_gateway_attachment":57        response = tgw.tag_transit_gateway_attachment()58    elif function_name == "subnet_deletion_event":59        response = tgw.subnet_deletion_event()60    elif function_name == "update_tags_if_failed":61        response = tgw.update_tags_if_failed()62    else:63        logger.info(ERROR_MESSAGE)...state_machine_router.py
Source:state_machine_router.py  
...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}52    logger.info(response)53    return response54def vpc(event, function_name):55    logger.info("Router FunctionName: {}".format(function_name))...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!!
