Best Python code snippet using localstack_python
aws_acm_certificate.py
Source:aws_acm_certificate.py
...71 IdempotencyToken=idempotency_token72 )73 return result['CertificateArn']74@AWSRetry.backoff(tries=5, delay=5, backoff=2.0)75def add_tags_to_certificate(client, certificate_arn, key=None, value=None):76 if key is None:77 return78 response = client.add_tags_to_certificate(79 CertificateArn=certificate_arn,80 Tags=[81 {82 'Key': key,83 'Value': value84 },85 ]86 )87def request_certificate(client, module, validation_method=None, idempotency_token=None, domain_name=None):88 statuses=['PENDING_VALIDATION', 'ISSUED', 'INACTIVE', 'EXPIRED', 'VALIDATION_TIMED_OUT', 'REVOKED', 'FAILED']89 try:90 all_certificates = list_certificates_with_backoff(client, statuses)91 except botocore.exceptions.ClientError as e:92 module.fail_json(msg="Couldn't obtain certificates",93 exception=traceback.format_exc(),94 **camel_dict_to_snake_dict(e.response))95 certificates = [cert for cert in all_certificates if cert['DomainName'] == domain_name]96 results = []97 if len(certificates) > 0:98 return99 try:100 certificate_arn = request_certificate_with_backoff(client, domain_name, validation_method, idempotency_token)101 add_tags_to_certificate(client, certificate_arn, key='Name', value=domain_name)102 except botocore.exceptions.ClientError as e:103 module.fail_json(msg="Couldn't request certificate",104 exception=traceback.format_exc(),105 **camel_dict_to_snake_dict(e.response))106 return certificate_arn107def main():108 argument_spec = ec2_argument_spec()109 argument_spec.update(110 dict(111 domain_name=dict(aliases=['name']),112 validation_method=dict(choices=['DNS', 'EMAIL'], default='DNS'),113 idempotency_token=dict(default='ansible'),114 )115 )...
add_tags_to_certificate.py
Source:add_tags_to_certificate.py
...18# Create ACM client19acm = boto3.client('acm')2021# Add tag(s) to the specified certificate.22response = acm.add_tags_to_certificate(23 CertificateArn='arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012',24 Tags=[25 {26 'Key': 'TagKey1',27 'Value': 'TagValue1'28 },29 {30 'Key': 'TagKey2',31 'Value': 'TagValue2'32 },33 ]34)3536print(response)
...
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!!