Best Python code snippet using localstack_python
acm.py
Source:acm.py
...26 with ActionOnExit('Check existing Certificates..') as act:27 for cert_summary in certificate_list:28 cert = acm.describe_certificate(CertificateArn=cert_summary['CertificateArn'])['Certificate']29 if cert['Status'] == 'PENDING_VALIDATION':30 resend_validation_email(acm, cert)31 elif cert['Status'] != 'ISSUED':32 continue33 elif (datetime.timedelta(weeks=8)34 > cert['NotAfter'] - datetime.datetime.now(cert['NotAfter'].tzinfo)):35 renew_certificate(acm, cert)36 domain_options = {}37 for options in cert['DomainValidationOptions']:38 domain_options[options['DomainName']] = options.get('ValidationDomain', options['DomainName'])39 if domain_options == domains:40 act.ok('found')41 found_cert = True42 if not found_cert:43 act.warning('nothing found')44 if not found_cert:45 request_acm_cert(acm, cert_domain_name, domains)46def renew_certificate(acm, cert):47 with ActionOnExit('Renew Certificate {}. Resend Validation...'48 .format(cert['CertificateArn'])) as act_renew:49 for d in cert["DomainValidationOptions"]:50 try:51 acm.resend_validation_email(52 CertificateArn=cert['CertificateArn'],53 Domain=d["DomainName"],54 ValidationDomain=d["ValidationDomain"]55 )56 except Exception:57 act_renew.error('found existing config')58def resend_validation_email(acm, cert):59 renewal_status = cert.get('RenewalSummary', {}).get('RenewalStatus')60 if renewal_status != 'PENDING_VALIDATION':61 info('Certificate {} in {}, not resending validation email'.format(cert['CertificateArn'], renewal_status))62 return63 with ActionOnExit('Certificate {} still Pending. Resend Validation...'64 .format(cert['CertificateArn'])):65 for d in cert["DomainValidationOptions"]:66 acm.resend_validation_email(67 CertificateArn=cert['CertificateArn'],68 Domain=d["DomainName"],69 ValidationDomain=d["ValidationDomain"]70 )71def request_acm_cert(acm: object, cert_domain_name, domains):72 with ActionOnExit('Create Certificate Request for {}..'.format(', '.join(domains.keys()))):73 acm.request_certificate(74 DomainName=cert_domain_name,75 SubjectAlternativeNames=list(domains.keys()),76 IdempotencyToken='sevenseconds',77 DomainValidationOptions=[78 {79 'DomainName': d,80 'ValidationDomain': v...
resend_validation_email.py
Source:resend_validation_email.py
...18# Create ACM client19acm = boto3.client('acm')2021# Resend validation email for one of the Subject or SANs of an ACM certificate.22response = acm.resend_validation_email(23 CertificateArn='arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012',24 Domain='*.subdomain1.example.com',25 ValidationDomain='example.com'26)2728print(response)293031 32 33# snippet-end:[acm.python.resend_validation.complete]34# snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.]35# snippet-sourcedescription:[resend_validation_email.py demonstrates how to resend the email that requests domain ownership validation.]36# snippet-keyword:[Python]...
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!!