in source/core-api/custom_resources/intersect_az.py [0:0]
def create_update(event, _):
"""
This function is responsible for generating a sorted, intersection list of
AZ names supported by all the specified VPC endpoint services.
"""
print(event)
# these are the service names to process
service_names = event["ResourceProperties"]["ServiceNames"]
print(f"Service names: {json.dumps(service_names)}")
# get the endpoint AZs for each service
response = client.describe_vpc_endpoint_services(
ServiceNames=service_names)
print(response)
# find the AZs common to all services
intersect_az = set(response['ServiceDetails'][0]['AvailabilityZones'])
for details in response['ServiceDetails'][1:]:
intersect_az = intersect_az & set(details['AvailabilityZones'])
# sort and return the intesecting AZ list
sorted_az = sorted(intersect_az)
print(f"Intersecting AZs: {json.dumps(sorted_az)}")
helper.Data.update({"intersect_az": sorted_az})