createJob method

Future<CreateJobResult> createJob({
  1. required String accountId,
  2. required JobManifest manifest,
  3. required JobOperation operation,
  4. required int priority,
  5. required JobReport report,
  6. required String roleArn,
  7. String? clientRequestToken,
  8. bool? confirmationRequired,
  9. String? description,
  10. List<S3Tag>? tags,
})

S3 Batch Operations performs large-scale Batch Operations on Amazon S3 objects. Batch Operations can run a single operation or action on lists of Amazon S3 objects that you specify. For more information, see S3 Batch Operations in the Amazon Simple Storage Service Developer Guide.

This operation creates an S3 Batch Operations job.

Related actions include:

May throw TooManyRequestsException. May throw BadRequestException. May throw IdempotencyException. May throw InternalServiceException.

Parameter accountId : The AWS account ID that creates the job.

Parameter manifest : Configuration parameters for the manifest.

Parameter operation : The operation that you want this job to perform on each object listed in the manifest. For more information about the available operations, see Operations in the Amazon Simple Storage Service Developer Guide.

Parameter priority : The numerical priority for this job. Higher numbers indicate higher priority.

Parameter report : Configuration parameters for the optional job-completion report.

Parameter roleArn : The Amazon Resource Name (ARN) for the AWS Identity and Access Management (IAM) role that Batch Operations will use to run this job's operation on each object in the manifest.

Parameter clientRequestToken : An idempotency token to ensure that you don't accidentally submit the same request twice. You can use any string up to the maximum length.

Parameter confirmationRequired : Indicates whether confirmation is required before Amazon S3 runs the job. Confirmation is only required for jobs created through the Amazon S3 console.

Parameter description : A description for this job. You can use any string within the permitted length. Descriptions don't need to be unique and can be used for multiple jobs.

Parameter tags : A set of tags to associate with the S3 Batch Operations job. This is an optional parameter.

Implementation

Future<CreateJobResult> createJob({
  required String accountId,
  required JobManifest manifest,
  required JobOperation operation,
  required int priority,
  required JobReport report,
  required String roleArn,
  String? clientRequestToken,
  bool? confirmationRequired,
  String? description,
  List<S3Tag>? tags,
}) async {
  ArgumentError.checkNotNull(accountId, 'accountId');
  _s.validateStringLength(
    'accountId',
    accountId,
    0,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(manifest, 'manifest');
  ArgumentError.checkNotNull(operation, 'operation');
  ArgumentError.checkNotNull(priority, 'priority');
  _s.validateNumRange(
    'priority',
    priority,
    0,
    2147483647,
    isRequired: true,
  );
  ArgumentError.checkNotNull(report, 'report');
  ArgumentError.checkNotNull(roleArn, 'roleArn');
  _s.validateStringLength(
    'roleArn',
    roleArn,
    1,
    2048,
    isRequired: true,
  );
  _s.validateStringLength(
    'clientRequestToken',
    clientRequestToken,
    1,
    64,
  );
  _s.validateStringLength(
    'description',
    description,
    1,
    256,
  );
  clientRequestToken ??= _s.generateIdempotencyToken();
  final headers = <String, String>{
    'x-amz-account-id': accountId.toString(),
  };
  final $result = await _protocol.send(
    method: 'POST',
    requestUri: '/v20180820/jobs',
    headers: headers,
    payload: CreateJobRequest(
            accountId: accountId,
            manifest: manifest,
            operation: operation,
            priority: priority,
            report: report,
            roleArn: roleArn,
            clientRequestToken: clientRequestToken,
            confirmationRequired: confirmationRequired,
            description: description,
            tags: tags)
        .toXml(
      'CreateJobRequest',
      attributes: [
        _s.XmlAttribute(_s.XmlName('xmlns'),
            'http://awss3control.amazonaws.com/doc/2018-08-20/'),
      ],
    ),
    exceptionFnMap: _exceptionFns,
  );
  return CreateJobResult.fromXml($result.body);
}