in customizations/AccountFactory/BatchUpdate/update_pp.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
try:
search_list = SC.search_products_as_admin(Filters=filters)['ProductViewDetails']
except Exception as exe:
error_and_exit('Unable to find Product Id: ' + 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: {}'.format(item))
if not output:
error_and_exit('Unable to find Product Id: ' + str(search_list))
return output