in create_managed_endpoint.py [0:0]
def exists_hz(hzonename):
# Detects if hosted zone exists. returns True if found, False if not found.
# If the hosted is public, then the program quits.
try:
responsehz = dnsclient.list_hosted_zones()
# Set hosted zone flag
hostedzonefound = False
# Return true if Hosted Zone exists
for hostedzone in responsehz['HostedZones']:
if ((hostedzone['Name'])==hzonename and hostedzone['Config']['PrivateZone']):
hostedzonefound = True
# exists if the Hosted Zone exists and is public
elif((hostedzone['Name'])==hzonename and not hostedzone['Config']['PrivateZone']):
print ("Supplied Hosted zone",hzonename,"exists and is a public hosted zone. Please provide either an existsing private hosted zone name, or a hosted zone name that doesn't exist.")
sys.exit(1)
return hostedzonefound
except ClientError as e:
print(e)
raise