Jump to Content

Class GetBucketTaggingCommandProtected

Returns the tag set associated with the 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:

Example

Use a bare-bones client and the command you need to make an API call.

import { S3Client, GetBucketTaggingCommand } from "@aws-sdk/client-s3"; // ES Modules import
// const { S3Client, GetBucketTaggingCommand } = require("@aws-sdk/client-s3"); // CommonJS import
const client = new S3Client(config);
const input = {
Bucket: "STRING_VALUE", // required
ExpectedBucketOwner: "STRING_VALUE",
};
const command = new GetBucketTaggingCommand(input);
const response = await client.send(command);

Param

GetBucketTaggingCommandInput

Returns

GetBucketTaggingCommandOutput

See

Example

To get tag set associated with a bucket

// The following example returns tag set associated with a bucket
const input = {
"Bucket": "examplebucket"
};
const command = new GetBucketTaggingCommand(input);
const response = await client.send(command);
/* response ==
{
"TagSet": [
{
"Key": "key1",
"Value": "value1"
},
{
"Key": "key2",
"Value": "value2"
}
]
}
*/
// example id: to-get-tag-set-associated-with-a-bucket-1481593232107

Hierarchy

Constructors

Properties

Methods