in functions/source/account_create.py [0:0]
def get_product_id():
''' Find the Product Id of AWS Control Tower Account Factory '''
filters = {'Owner': ['AWS Control Tower']}
af_product_name = 'AWS Control Tower Account Factory'
key = 'ProductViewSummary'
output = None
search_list = []
try:
search_list = SC.search_products_as_admin(
Filters=filters)['ProductViewDetails']
except Exception as exe:
LOGGER.error('Unable to find Product Id: %s', str(exe))
for item in search_list:
if key in item:
if item[key]['Name'] == af_product_name:
output = item[key]['ProductId']
break
else:
LOGGER.warning('Unexepected output recieved. Skipping: %s', item)
if not output:
LOGGER.error('Unable to find Product Id: %s', str(search_list))
return output