in code/ct_flowlog_lifecycle.py [0:0]
def list_stack_instance_by_account(target_session, stack_set_name, account_id):
'''
List all stack instances based on the StackSet name and Account Id
'''
try:
cfn_client = target_session.client('cloudformation')
cfn_paginator = cfn_client.get_paginator('list_stack_instances')
operation_parameters = {
'StackSetName': stack_set_name,
'StackInstanceAccount': account_id
}
stackset_result = cfn_paginator.paginate(**operation_parameters)
stackset_list = []
for page in stackset_result:
if 'Summaries' in page:
stackset_list.extend(page['Summaries'])
return stackset_list
except Exception as e:
LOGGER.error("List Stack Instance error: %s" % e)
return []