Best Python code snippet using localstack_python
SetupAWS.py
Source:SetupAWS.py
...78def setup():79 prereq()80def cleanup():81 delete_prereq()82def list_certificates():83 client = boto3.client('iot')84 certs = client.list_certificates()['certificates']85 print(certs)86def list_things():87 client = boto3.client('iot')88 things = client.list_things()['things']89 print(things)90def list_policies():91 client = boto3.client('iot')92 policies = client.list_policies()['policies']93 print(policies)94if __name__ == "__main__":95 arg_parser = argparse.ArgumentParser()96 sub_arg_parser = arg_parser.add_subparsers(help='Available commands',97 dest='command')98 setup_parser = sub_arg_parser.add_parser('setup', help='setup aws iot')99 clean_parser = sub_arg_parser.add_parser('cleanup', help='cleanup aws iot')100 list_cert_parser = sub_arg_parser.add_parser('list_certificates',101 help='list certificates')102 list_thing_parser = sub_arg_parser.add_parser('list_things',103 help='list things')104 list_policy_parser = sub_arg_parser.add_parser('list_policies',105 help='list policies')106 prereq_parser = sub_arg_parser.add_parser('prereq',107 help='Setup Prerequisites for aws iot')108 update_creds = sub_arg_parser.add_parser('update_creds',109 help='Update credential files')110 delete_prereq_parser = sub_arg_parser.add_parser('delete_prereq',111 help='Delete prerequisites created')112 cleanup_creds_parser = sub_arg_parser.add_parser('cleanup_creds',113 help='Cleanup credential files')114 args = arg_parser.parse_args()115 check_aws_configuration()116 if args.command == 'setup':117 setup()118 elif args.command == 'cleanup':119 cleanup()120 elif args.command == 'list_certificates':121 list_certificates()122 elif args.command == 'list_things':123 list_things()124 elif args.command == 'list_policies':125 list_policies()126 elif args.command == 'prereq':127 prereq()128 elif args.command == 'delete_prereq':129 delete_prereq()130 elif args.command == 'cleanup_creds':131 cleanup_creds()132 else:...
list_certificates.py
Source:list_certificates.py
1# Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.2#3# Licensed under the Apache License, Version 2.0 (the "License"). You4# may not use this file except in compliance with the License. A copy of5# the License is located at6#7# http://aws.amazon.com/apache2.0/8#9# or in the "license" file accompanying this file. This file is10# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF11# ANY KIND, either express or implied. See the License for the specific12# language governing permissions and limitations under the License. 13# snippet-start:[acm.python.list_certificates.complete]1415import boto3161718# Create ACM client19acm = boto3.client('acm')2021# List certificates with the pagination interface22paginator = acm.get_paginator('list_certificates')23for response in paginator.paginate():24 for certificate in response['CertificateSummaryList']:25 print(certificate)26 27 28# snippet-end:[acm.python.list_certificates.complete]29# snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.]30# snippet-sourcedescription:[list_certificates.py demonstrates how to retrieve a list of certificate ARNs and domain names.]31# snippet-keyword:[Python]32# snippet-sourcesyntax:[python]33# snippet-sourcesyntax:[python]34# snippet-keyword:[AWS SDK for Python (Boto3)]35# snippet-keyword:[Code Sample]36# snippet-keyword:[AWS Certificate Manager]37# snippet-service:[acm]38# snippet-sourcetype:[full-example]39# snippet-sourcedate:[2018-12-26]40# snippet-sourceauthor:[walkerk1980]
...
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!!