Best Python code snippet using localstack_python
main.py
Source:main.py
...37 zones[zid] = zone38 else:39 print("No HostedZones found")40 return zones41def get_query_logging_config(client):42 configs = client.list_query_logging_configs()['QueryLoggingConfigs']43 if len(configs) > 0:44 print("QueryLoggingConfigs:")45 for con in configs:46 print(f"ZoneID: {con['HostedZoneId']} :: CloudWatchLogsLogGroupArn: {con['CloudWatchLogsLogGroupArn']}")47 else:48 print("No QueryLoggingConfigs found")49 return configs50def zones_plus_config(zones, configs):51 for con in configs:52 if con['HostedZoneId'] in zones.keys():53 zones[con['HostedZoneId']].update({'CloudWatchLogsLogGroupArn': con['CloudWatchLogsLogGroupArn']})54 zones[con['HostedZoneId']].update({'QueryLoggingConfigId': con['Id']})55 return zones56def main(args, pacu_main):57 session = pacu_main.get_active_session()58 print = pacu_main.print59 args = parser.parse_args(args)60 try:61 client = pacu_main.get_boto3_client('route53')62 except ClientError as error:63 print(f'Failed to initialize boto client for route53: {error}')64 data = {}65 try:66 zones = get_hosted_zones(client=client)67 except ClientError as error:68 print(f'Failed to list R53 Hosted Zones: {error}')69 return70 try:71 confs = get_query_logging_config(client=client)72 except ClientError as error:73 print(f'Failed to list R53 Hosted Zone Query Logging Configurations: {error}')74 return75 data = zones_plus_config(zones=zones, configs=confs)76 session.update(pacu_main.database, Route53=data)77 return data78def summary(data, pacu_main):79 if len(data) > 0:80 return f"Found {len(data)} hosted zones:\n{json.dumps(data, indent=2)}"81 else:...
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!!