def list_all_domains()

in CWMetricsToOpenSearch/handler.py [0:0]


def list_all_domains():
    ''' Loops through the list of REGIONS, listing out all domains for this
        account in that region. Returns a list of domain names. 
    '''
    doms = {}
    for region in REGIONS:
        es = boto3.client('es', region)
        try:
            resp = es.list_domain_names()
            resp = resp['DomainNames']
            doms[region] = [val['DomainName'] for val in resp]
        except Exception as e:
            print('Failed to get domain names in region: {}'.format(region))
            print(e)
    return doms