listWorkflowRuns method

Future<ListWorkflowRunsResponse> listWorkflowRuns({
  1. required String workflowArn,
  2. int? maxResults,
  3. String? nextToken,
  4. String? workflowVersion,
})

Lists all runs for a specified workflow, with optional pagination and filtering support.

May throw AccessDeniedException. May throw InternalServerException. May throw OperationTimeoutException. May throw ThrottlingException. May throw ValidationException.

Parameter workflowArn : The Amazon Resource Name (ARN) of the workflow for which you want a list of runs.

Parameter maxResults : The maximum number of workflow runs to return in a single response.

Parameter nextToken : The pagination token you need to use to retrieve the next set of results. This value is returned from a previous call to ListWorkflowRuns.

Parameter workflowVersion : Optional. The specific version of the workflow for which you want a list of runs. If not specified, runs for all versions are returned.

Implementation

Future<ListWorkflowRunsResponse> listWorkflowRuns({
  required String workflowArn,
  int? maxResults,
  String? nextToken,
  String? workflowVersion,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AmazonMWAAServerless.ListWorkflowRuns'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'WorkflowArn': workflowArn,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (workflowVersion != null) 'WorkflowVersion': workflowVersion,
    },
  );

  return ListWorkflowRunsResponse.fromJson(jsonResponse.body);
}