How to use describe_local_gateways method in localstack

Best Python code snippet using localstack_python

vpc_description.py

Source:vpc_description.py Github

copy

Full Screen

1from __future__ import absolute_import2import boto33import datetime4import splunksdc.log as logging5import splunk_ta_aws.common.ta_aws_consts as tac6from . import description as desc7logger = logging.get_module_logger()8CREDENTIAL_THRESHOLD=datetime.timedelta(minutes=20)9def get_vpc_conn(config):10 return desc.BotoRetryWrapper(boto_client=boto3.client(11 'ec2',12 region_name=config[tac.region],13 aws_access_key_id=config[tac.key_id],14 aws_secret_access_key=config[tac.secret_key],15 aws_session_token=config.get('aws_session_token')16 ))17@desc.generate_credentials18@desc.decorate19def vpcs(config):20 vpc_conn = get_vpc_conn(config)21 paginator = vpc_conn.get_paginator('describe_vpcs')22 for page in paginator.paginate():23 for vpc in page.get('Vpcs', []):24 yield vpc25 desc.refresh_credentials(config,CREDENTIAL_THRESHOLD,vpc_conn)26@desc.generate_credentials27@desc.decorate28def vpc_subnets(config):29 vpc_conn = get_vpc_conn(config)30 paginator = vpc_conn.get_paginator('describe_subnets')31 for page in paginator.paginate():32 for subnet in page.get('Subnets', []):33 yield subnet34 desc.refresh_credentials(config,CREDENTIAL_THRESHOLD,vpc_conn)35@desc.generate_credentials36@desc.decorate37def vpc_network_acls(config):38 vpc_conn = get_vpc_conn(config)39 paginator = vpc_conn.get_paginator('describe_network_acls')40 for page in paginator.paginate():41 for network_acl in page.get('NetworkAcls', []):42 yield network_acl43 desc.refresh_credentials(config,CREDENTIAL_THRESHOLD,vpc_conn)44@desc.generate_credentials45@desc.decorate46def vpn_gateways(config):47 vpc_conn = get_vpc_conn(config)48 res = vpc_conn.describe_vpn_gateways()49 50 for vpn_gateway in res.get('VpnGateways', []):51 yield vpn_gateway52@desc.generate_credentials53@desc.decorate54def internet_gateways(config):55 vpc_conn = get_vpc_conn(config)56 paginator = vpc_conn.get_paginator('describe_internet_gateways')57 for page in paginator.paginate():58 for internet_gateway in page.get('InternetGateways', []):59 yield internet_gateway60 desc.refresh_credentials(config,CREDENTIAL_THRESHOLD,vpc_conn)61@desc.generate_credentials62@desc.decorate63def customer_gateways(config):64 vpc_conn = get_vpc_conn(config)65 res = vpc_conn.describe_customer_gateways()66 for customer_gateway in res.get('CustomerGateways', []):67 yield customer_gateway68@desc.generate_credentials69@desc.decorate70def nat_gateways(config):71 vpc_conn = get_vpc_conn(config)72 paginator = vpc_conn.get_paginator('describe_nat_gateways')73 for page in paginator.paginate():74 for nat_gateway in page.get('NatGateways', []):75 yield nat_gateway76 desc.refresh_credentials(config,CREDENTIAL_THRESHOLD,vpc_conn)77@desc.generate_credentials78@desc.decorate79def local_gateways(config):80 vpc_conn = get_vpc_conn(config)81 paginator = vpc_conn.get_paginator('describe_local_gateways')82 for page in paginator.paginate():83 for local_gateway in page.get('LocalGateways', []):84 yield local_gateway85 desc.refresh_credentials(config,CREDENTIAL_THRESHOLD,vpc_conn)86@desc.generate_credentials87@desc.decorate88def carrier_gateways(config):89 vpc_conn = get_vpc_conn(config)90 paginator = vpc_conn.get_paginator('describe_carrier_gateways')91 for page in paginator.paginate():92 for carrier_gateway in page.get('CarrierGateways', []):93 yield carrier_gateway94 desc.refresh_credentials(config,CREDENTIAL_THRESHOLD,vpc_conn)95@desc.generate_credentials96@desc.decorate97def transit_gateways(config):98 vpc_conn = get_vpc_conn(config)99 paginator = vpc_conn.get_paginator('describe_transit_gateways')100 for page in paginator.paginate():101 for transit_gateway in page.get('TransitGateways', []):102 yield transit_gateway...

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