getBucketTagging method

Future<GetBucketTaggingOutput> getBucketTagging({
  1. required String bucket,
  2. String? expectedBucketOwner,
})
Returns the tag set associated with the general purpose bucket.

To use this operation, you must have permission to perform the s3:GetBucketTagging action. By default, the bucket owner has this permission and can grant this permission to others.

GetBucketTagging has the following special error:

  • Error code: NoSuchTagSet
    • Description: There is no tag set associated with the bucket.
The following operations are related to GetBucketTagging:

Parameter bucket : The name of the bucket for which to get the tagging information.

Parameter expectedBucketOwner : The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code 403 Forbidden (access denied).

Implementation

Future<GetBucketTaggingOutput> getBucketTagging({
  required String bucket,
  String? expectedBucketOwner,
}) async {
  final headers = <String, String>{
    if (expectedBucketOwner != null)
      'x-amz-expected-bucket-owner': expectedBucketOwner.toString(),
  };
  final $result = await _protocol.send(
    method: 'GET',
    requestUri: '/${Uri.encodeComponent(bucket)}?tagging',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return GetBucketTaggingOutput.fromXml($result.body);
}