putJobTagging method

Future<void> putJobTagging({
  1. required String accountId,
  2. required String jobId,
  3. required List<S3Tag> tags,
})

Sets the supplied tag-set on an S3 Batch Operations job.

A tag is a key-value pair. You can associate S3 Batch Operations tags with any job by sending a PUT request against the tagging subresource that is associated with the job. To modify the existing tag set, you can either replace the existing tag set entirely, or make changes within the existing tag set by retrieving the existing tag set using GetJobTagging, modify that tag set, and use this action to replace the tag set with the one you modified. For more information, see Controlling access and labeling jobs using tags in the Amazon Simple Storage Service Developer Guide.

  • If you send this request with an empty tag set, Amazon S3 deletes the existing tag set on the Batch Operations job. If you use this method, you are charged for a Tier 1 Request (PUT). For more information, see Amazon S3 pricing.
  • For deleting existing tags for your Batch Operations job, a DeleteJobTagging request is preferred because it achieves the same result without incurring charges.
  • A few things to consider about using tags:
    • Amazon S3 limits the maximum number of tags to 50 tags per job.
    • You can associate up to 50 tags with a job as long as they have unique tag keys.
    • A tag key can be up to 128 Unicode characters in length, and tag values can be up to 256 Unicode characters in length.
    • The key and values are case sensitive.
    • For tagging-related restrictions related to characters and encodings, see User-Defined Tag Restrictions in the AWS Billing and Cost Management User Guide.

To use this operation, you must have permission to perform the s3:PutJobTagging action.

Related actions include:

May throw InternalServiceException. May throw TooManyRequestsException. May throw NotFoundException. May throw TooManyTagsException.

Parameter accountId : The AWS account ID associated with the S3 Batch Operations job.

Parameter jobId : The ID for the S3 Batch Operations job whose tags you want to replace.

Parameter tags : The set of tags to associate with the S3 Batch Operations job.

Implementation

Future<void> putJobTagging({
  required String accountId,
  required String jobId,
  required List<S3Tag> tags,
}) async {
  ArgumentError.checkNotNull(accountId, 'accountId');
  _s.validateStringLength(
    'accountId',
    accountId,
    0,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(jobId, 'jobId');
  _s.validateStringLength(
    'jobId',
    jobId,
    5,
    36,
    isRequired: true,
  );
  ArgumentError.checkNotNull(tags, 'tags');
  final headers = <String, String>{
    'x-amz-account-id': accountId.toString(),
  };
  await _protocol.send(
    method: 'PUT',
    requestUri: '/v20180820/jobs/${Uri.encodeComponent(jobId)}/tagging',
    headers: headers,
    payload:
        PutJobTaggingRequest(accountId: accountId, jobId: jobId, tags: tags)
            .toXml(
      'PutJobTaggingRequest',
      attributes: [
        _s.XmlAttribute(_s.XmlName('xmlns'),
            'http://awss3control.amazonaws.com/doc/2018-08-20/'),
      ],
    ),
    exceptionFnMap: _exceptionFns,
  );
}