-
-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathhoist_literals.min.py
More file actions
12 lines (12 loc) · 839 Bytes
/
hoist_literals.min.py
File metadata and controls
12 lines (12 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
def validate(arn,props):
H='Value';G='Type';F='Name';E='ValidationStatus';D='PENDING_VALIDATION';C=False;B='ValidationMethod';A='ResourceRecord'
if B in props and props[B]=='DNS':
all_records_created=C
while not all_records_created:
all_records_created=True;certificate=acm.describe_certificate(CertificateArn=arn)['Certificate']
if certificate['Status']!=D:return
for v in certificate['DomainValidationOptions']:
if E not in v or A not in v:all_records_created=C;continue
records=[]
if v[E]==D:records.append({'Action':'UPSERT','ResourceRecordSet':{F:v[A][F],G:v[A][G],'TTL':60,'ResourceRecords':[{H:v[A][H]}]}})
if records:response=boto3.client('route53').change_resource_record_sets(HostedZoneId=get_zone_for(v['DomainName'],props),ChangeBatch={'Comment':'Domain validation for %s'%arn,'Changes':records})