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.

May throw ExecutionDoesNotExist. May throw InvalidArn.

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 {
  ArgumentError.checkNotNull(executionArn, 'executionArn');
  _s.validateStringLength(
    'executionArn',
    executionArn,
    1,
    256,
    isRequired: true,
  );
  _s.validateStringLength(
    'cause',
    cause,
    0,
    32768,
  );
  _s.validateStringLength(
    'error',
    error,
    0,
    256,
  );
  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);
}