cancelTask method

Future<CancelTaskOutput> cancelTask({
  1. required String taskId,
})

Sends a cancel request for a specified task. You can cancel a task only if it's still in a QUEUED state. Tasks that are already running can't be cancelled.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter taskId : The ID of the task that you are attempting to cancel. You can retrieve a task ID by using the ListTasks operation.

Implementation

Future<CancelTaskOutput> cancelTask({
  required String taskId,
}) async {
  final response = await _protocol.send(
    payload: null,
    method: 'POST',
    requestUri: '/task/${Uri.encodeComponent(taskId)}/cancel',
    exceptionFnMap: _exceptionFns,
  );
  return CancelTaskOutput.fromJson(response);
}