in src/stepfunctions/workflow/stepfunctions.py [0:0]
def list_workflows(cls, max_items=100, client=None, html=False):
"""
Lists all the workflows in the account.
Args:
max_items (int, optional): The maximum number of items to be returned. (default: 100)
client (SFN.Client, optional): boto3 client to use for the query. If not provided, a default boto3 client for Step Functions will be automatically created and used. (default: None)
html (bool, optional): Renders the list as an HTML table (If running in an IPython environment). If the parameter is not provided, or set to False, a Python list is returned. (default: False)
Returns:
list: The list of workflows. Refer to :meth:`.SFN.Client.list_state_machines()` for the response structure.
"""
if client is None:
logger.debug("The argument 'client' is not provided. Creating a new boto3 client instance with default settings.")
client = boto3.client('stepfunctions')
logger.debug("Retrieving list of workflows from AWS Step Functions.")
paginator = client.get_paginator('list_state_machines')
params = {
'PaginationConfig': {
'MaxItems': max_items,
'PageSize': 1000
}
}
response_iterator = paginator.paginate(**params)
workflows = []
for page in response_iterator:
for workflow in page['stateMachines']:
workflows.append(workflow)
workflows_list = WorkflowList(workflows)
if html:
return HTML(workflows_list.to_html())
else:
return workflows_list