cancelTaskExecution method

Future<void> cancelTaskExecution({
  1. required String taskExecutionArn,
})

Cancels execution of a task.

When you cancel a task execution, the transfer of some files is abruptly interrupted. The contents of files that are transferred to the destination might be incomplete or inconsistent with the source files. However, if you start a new task execution on the same task and you allow the task execution to complete, file content on the destination is complete and consistent. This applies to other unexpected failures that interrupt a task execution. In all of these cases, AWS DataSync successfully complete the transfer when you start the next task execution.

May throw InvalidRequestException. May throw InternalException.

Parameter taskExecutionArn : The Amazon Resource Name (ARN) of the task execution to cancel.

Implementation

Future<void> cancelTaskExecution({
  required String taskExecutionArn,
}) async {
  ArgumentError.checkNotNull(taskExecutionArn, 'taskExecutionArn');
  _s.validateStringLength(
    'taskExecutionArn',
    taskExecutionArn,
    0,
    128,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'FmrsService.CancelTaskExecution'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'TaskExecutionArn': taskExecutionArn,
    },
  );
}