in create_managed_endpoint.py [0:0]
def exists_hz_record (hzonename,recordname):
# Detects if cname exists in the hosted zone. returns True if found, false if not found.
try:
hzid = hosted_zone_id(hzonename)
# Add a '.' at the end if it wasn't added
strlen = len(recordname)
if recordname[strlen-1]!='.':
recordname=recordname+'.'
recordfound = False
responsehzr = dnsclient.list_resource_record_sets(
HostedZoneId=hzid,
StartRecordName=recordname,
StartRecordType='CNAME'
)
recordfound = False
for i in responsehzr['ResourceRecordSets']:
if (i['Name'] == recordname and i['Type']=='CNAME'):
recordfound = True
return recordfound #return true if record found and false if not
except ClientError as e:
print(e)
raise