getExecutionHistory method

Future<GetExecutionHistoryOutput> getExecutionHistory({
  1. required String executionArn,
  2. bool? includeExecutionData,
  3. int? maxResults,
  4. String? nextToken,
  5. bool? reverseOrder,
})

Returns the history of the specified execution as a list of events. By default, the results are returned in ascending order of the timeStamp of the events. Use the reverseOrder parameter to get the latest events first.

If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. Using an expired pagination token will return an HTTP 400 InvalidToken error.

This API action is not supported by EXPRESS state machines.

May throw ExecutionDoesNotExist. May throw InvalidArn. May throw InvalidToken.

Parameter executionArn : The Amazon Resource Name (ARN) of the execution.

Parameter includeExecutionData : You can select whether execution data (input or output of a history event) is returned. The default is true.

Parameter maxResults : The maximum number of results that are returned per call. You can use nextToken to obtain further pages of results. The default is 100 and the maximum allowed page size is 1000. A value of 0 uses the default.

This is only an upper limit. The actual number of results returned per call might be fewer than the specified maximum.

Parameter nextToken : If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. Using an expired pagination token will return an HTTP 400 InvalidToken error.

Parameter reverseOrder : Lists events in descending order of their timeStamp.

Implementation

Future<GetExecutionHistoryOutput> getExecutionHistory({
  required String executionArn,
  bool? includeExecutionData,
  int? maxResults,
  String? nextToken,
  bool? reverseOrder,
}) async {
  ArgumentError.checkNotNull(executionArn, 'executionArn');
  _s.validateStringLength(
    'executionArn',
    executionArn,
    1,
    256,
    isRequired: true,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    0,
    1000,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    1024,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AWSStepFunctions.GetExecutionHistory'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'executionArn': executionArn,
      if (includeExecutionData != null)
        'includeExecutionData': includeExecutionData,
      if (maxResults != null) 'maxResults': maxResults,
      if (nextToken != null) 'nextToken': nextToken,
      if (reverseOrder != null) 'reverseOrder': reverseOrder,
    },
  );

  return GetExecutionHistoryOutput.fromJson(jsonResponse.body);
}