createDataRepositoryTask method

Future<CreateDataRepositoryTaskResponse> createDataRepositoryTask({
  1. required String fileSystemId,
  2. required CompletionReport report,
  3. required DataRepositoryTaskType type,
  4. String? clientRequestToken,
  5. List<String>? paths,
  6. List<Tag>? tags,
})

Creates an Amazon FSx for Lustre data repository task. You use data repository tasks to perform bulk operations between your Amazon FSx file system and its linked data repository. An example of a data repository task is exporting any data and metadata changes, including POSIX metadata, to files, directories, and symbolic links (symlinks) from your FSx file system to its linked data repository. A CreateDataRepositoryTask operation will fail if a data repository is not linked to the FSx file system. To learn more about data repository tasks, see Data Repository Tasks. To learn more about linking a data repository to your file system, see Linking your file system to an S3 bucket.

May throw BadRequest. May throw UnsupportedOperation. May throw FileSystemNotFound. May throw IncompatibleParameterError. May throw ServiceLimitExceeded. May throw InternalServerError. May throw DataRepositoryTaskExecuting.

Parameter report : Defines whether or not Amazon FSx provides a CompletionReport once the task has completed. A CompletionReport provides a detailed report on the files that Amazon FSx processed that meet the criteria specified by the Scope parameter. For more information, see Working with Task Completion Reports.

Parameter type : Specifies the type of data repository task to create.

Parameter paths : (Optional) The path or paths on the Amazon FSx file system to use when the data repository task is processed. The default path is the file system root directory. The paths you provide need to be relative to the mount point of the file system. If the mount point is /mnt/fsx and /mnt/fsx/path1 is a directory or file on the file system you want to export, then the path to provide is path1. If a path that you provide isn't valid, the task fails.

Implementation

Future<CreateDataRepositoryTaskResponse> createDataRepositoryTask({
  required String fileSystemId,
  required CompletionReport report,
  required DataRepositoryTaskType type,
  String? clientRequestToken,
  List<String>? paths,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(fileSystemId, 'fileSystemId');
  _s.validateStringLength(
    'fileSystemId',
    fileSystemId,
    11,
    21,
    isRequired: true,
  );
  ArgumentError.checkNotNull(report, 'report');
  ArgumentError.checkNotNull(type, 'type');
  _s.validateStringLength(
    'clientRequestToken',
    clientRequestToken,
    1,
    63,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSSimbaAPIService_v20180301.CreateDataRepositoryTask'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'FileSystemId': fileSystemId,
      'Report': report,
      'Type': type.toValue(),
      'ClientRequestToken':
          clientRequestToken ?? _s.generateIdempotencyToken(),
      if (paths != null) 'Paths': paths,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateDataRepositoryTaskResponse.fromJson(jsonResponse.body);
}