cancelDataRepositoryTask method

Future<CancelDataRepositoryTaskResponse> cancelDataRepositoryTask({
  1. required String taskId,
})

Cancels an existing Amazon FSx for Lustre data repository task if that task is in either the PENDING or EXECUTING state. When you cancel a task, Amazon FSx does the following.

  • Any files that FSx has already exported are not reverted.
  • FSx continues to export any files that are "in-flight" when the cancel operation is received.
  • FSx does not export any files that have not yet been exported.

May throw BadRequest. May throw UnsupportedOperation. May throw DataRepositoryTaskNotFound. May throw DataRepositoryTaskEnded. May throw InternalServerError.

Parameter taskId : Specifies the data repository task to cancel.

Implementation

Future<CancelDataRepositoryTaskResponse> cancelDataRepositoryTask({
  required String taskId,
}) async {
  ArgumentError.checkNotNull(taskId, 'taskId');
  _s.validateStringLength(
    'taskId',
    taskId,
    12,
    128,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSSimbaAPIService_v20180301.CancelDataRepositoryTask'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'TaskId': taskId,
    },
  );

  return CancelDataRepositoryTaskResponse.fromJson(jsonResponse.body);
}