stopExecution method

Future<StopExecutionOutput> stopExecution({
  1. required String executionArn,
  2. String? cause,
  3. String? error,
})

Stops an execution.

This API action is not supported by EXPRESS state machines.

For an execution with encryption enabled, Step Functions will encrypt the error and cause fields using the KMS key for the execution role.

A caller can stop an execution without using any KMS permissions in the execution role if the caller provides a null value for both error and cause fields because no data needs to be encrypted.

May throw ExecutionDoesNotExist. May throw InvalidArn. May throw KmsAccessDeniedException. May throw KmsInvalidStateException. May throw KmsThrottlingException. May throw ValidationException.

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

Parameter cause : A more detailed explanation of the cause of the failure.

Parameter error : The error code of the failure.

Implementation

Future<StopExecutionOutput> stopExecution({
  required String executionArn,
  String? cause,
  String? error,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AWSStepFunctions.StopExecution'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'executionArn': executionArn,
      if (cause != null) 'cause': cause,
      if (error != null) 'error': error,
    },
  );

  return StopExecutionOutput.fromJson(jsonResponse.body);
}