startTaskExecution method

Future<StartTaskExecutionResponse> startTaskExecution({
  1. required String taskArn,
  2. List<FilterRule>? includes,
  3. Options? overrideOptions,
})

Starts a specific invocation of a task. A TaskExecution value represents an individual run of a task. Each task can have at most one TaskExecution at a time.

TaskExecution has the following transition phases: INITIALIZING | PREPARING | TRANSFERRING | VERIFYING | SUCCESS/FAILURE.

For detailed information, see the Task Execution section in the Components and Terminology topic in the AWS DataSync User Guide.

May throw InvalidRequestException. May throw InternalException.

Parameter taskArn : The Amazon Resource Name (ARN) of the task to start.

Parameter includes : 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"

Implementation

Future<StartTaskExecutionResponse> startTaskExecution({
  required String taskArn,
  List<FilterRule>? includes,
  Options? overrideOptions,
}) async {
  ArgumentError.checkNotNull(taskArn, 'taskArn');
  _s.validateStringLength(
    'taskArn',
    taskArn,
    0,
    128,
    isRequired: true,
  );
  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 (includes != null) 'Includes': includes,
      if (overrideOptions != null) 'OverrideOptions': overrideOptions,
    },
  );

  return StartTaskExecutionResponse.fromJson(jsonResponse.body);
}