in functions/source/new_account_handler.py [0:0]
def list_of_accounts():
'''Return list of accounts in the organization'''
result = list()
account_list = list()
root_id = list_org_roots()
try:
org_paginator = ORG.get_paginator('list_accounts_for_parent')
org_page_iterator = org_paginator.paginate(ParentId=root_id)
except ClientError as exe:
LOGGER.error('Unable to get Accounts list: %s', str(exe))
for page in org_page_iterator:
result += page['Accounts']
for item in result:
account_list.append(item['Email'])
return account_list