S3 / Client / get_bucket_tagging
get_bucket_tagging¶
- S3.Client.get_bucket_tagging(**kwargs)¶
Note
This operation is not supported for directory buckets.
Returns the tag set associated with the general purpose bucket.
if ABAC is not enabled for the bucket. When you enable ABAC for a general purpose bucket, you can no longer use this operation for that bucket and must use ListTagsForResource instead.
To use this operation, you must have permission to perform the
s3:GetBucketTaggingaction. By default, the bucket owner has this permission and can grant this permission to others.GetBucketTagginghas the following special error:Error code:
NoSuchTagSetDescription: There is no tag set associated with the bucket.
The following operations are related to
GetBucketTagging:Warning
You must URL encode any signed header values that contain spaces. For example, if your header value is
my file.txt, containing two spaces aftermy, you must URL encode this value tomy%20%20file.txt.See also: AWS API Documentation
Request Syntax
response = client.get_bucket_tagging( Bucket='string', ExpectedBucketOwner='string' )
- Parameters:
Bucket (string) –
[REQUIRED]
The name of the bucket for which to get the tagging information.
ExpectedBucketOwner (string) – 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).
- Return type:
dict
- Returns:
Response Syntax
{ 'TagSet': [ { 'Key': 'string', 'Value': 'string' }, ] }
Response Structure
(dict) –
TagSet (list) –
Contains the tag set.
(dict) –
A container of a key value name pair.
Key (string) –
Name of the object key.
Value (string) –
Value of the tag.
Examples
The following example returns tag set associated with a bucket
response = client.get_bucket_tagging( Bucket='examplebucket', ) print(response)
Expected Output:
{ 'TagSet': [ { 'Key': 'key1', 'Value': 'value1', }, { 'Key': 'key2', 'Value': 'value2', }, ], 'ResponseMetadata': { '...': '...', }, }