startTaskExecution method

Future<StartTaskExecutionResponse> startTaskExecution({
  1. required String taskArn,
  2. List<FilterRule>? excludes,
  3. List<FilterRule>? includes,
  4. ManifestConfig? manifestConfig,
  5. Options? overrideOptions,
  6. List<TagListEntry>? tags,
  7. TaskReportConfig? taskReportConfig,
})

Starts an DataSync transfer task. For each task, you can only run one task execution at a time.

There are several steps to a task execution. For more information, see Task execution statuses.

May throw InternalException. May throw InvalidRequestException.

Parameter taskArn : Specifies the Amazon Resource Name (ARN) of the task that you want to start.

Parameter excludes : Specifies a list of filter rules that determines which files to exclude from a task. The list contains a single filter string that consists of the patterns to exclude. The patterns are delimited by "|" (that is, a pipe), for example, "/folder1|/folder2".

Parameter includes : Specifies a list of filter rules that determines which files to include when running a task. The pattern should contain a single filter string that consists of the patterns to include. The patterns are delimited by "|" (that is, a pipe), for example, "/folder1|/folder2".

Parameter manifestConfig : Configures a manifest, which is a list of files or objects that you want DataSync to transfer. For more information and configuration examples, see Specifying what DataSync transfers by using a manifest.

When using this parameter, your caller identity (the role that you're using DataSync with) must have the iam:PassRole permission. The AWSDataSyncFullAccess policy includes this permission.

To remove a manifest configuration, specify this parameter with an empty value.

Parameter tags : Specifies the tags that you want to apply to the Amazon Resource Name (ARN) representing the task execution.

Tags are key-value pairs that help you manage, filter, and search for your DataSync resources.

Parameter taskReportConfig : Specifies how you want to configure a task report, which provides detailed information about your DataSync transfer. For more information, see Monitoring your DataSync transfers with task reports.

When using this parameter, your caller identity (the role that you're using DataSync with) must have the iam:PassRole permission. The AWSDataSyncFullAccess policy includes this permission.

To remove a task report configuration, specify this parameter as empty.

Implementation

Future<StartTaskExecutionResponse> startTaskExecution({
  required String taskArn,
  List<FilterRule>? excludes,
  List<FilterRule>? includes,
  ManifestConfig? manifestConfig,
  Options? overrideOptions,
  List<TagListEntry>? tags,
  TaskReportConfig? taskReportConfig,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'FmrsService.StartTaskExecution'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'TaskArn': taskArn,
      if (excludes != null) 'Excludes': excludes,
      if (includes != null) 'Includes': includes,
      if (manifestConfig != null) 'ManifestConfig': manifestConfig,
      if (overrideOptions != null) 'OverrideOptions': overrideOptions,
      if (tags != null) 'Tags': tags,
      if (taskReportConfig != null) 'TaskReportConfig': taskReportConfig,
    },
  );

  return StartTaskExecutionResponse.fromJson(jsonResponse.body);
}