This document provides an overview of APIs and SDK code samples related to bucket tagging.
API | Operation | Description |
---|---|---|
PUT Bucket tagging | Setting bucket tags | Sets tags for an existing bucket |
GET Bucket tagging | Querying bucket tags | Queries the existing tags of a bucket |
DELETE Bucket tagging | Deleting bucket tags | Deletes the tags of a bucket |
This API is used to set tags for an existing bucket.
public void setBucketTaggingConfiguration(SetBucketTaggingConfigurationRequest setBucketTaggingConfigurationRequest);
public void setBucketTaggingConfiguration(String bucketName, BucketTaggingConfiguration bucketTaggingConfiguration);
String bucketName = "examplebucket-1250000000";
List<TagSet> tagSetList = new LinkedList<TagSet>();
TagSet tagSet = new TagSet();
tagSet.setTag("age", "18");
tagSet.setTag("name", "xiaoming");
tagSetList.add(tagSet);
BucketTaggingConfiguration bucketTaggingConfiguration = new BucketTaggingConfiguration();
bucketTaggingConfiguration.setTagSets(tagSetList);
SetBucketTaggingConfigurationRequest setBucketTaggingConfigurationRequest =
new SetBucketTaggingConfigurationRequest(bucketName, bucketTaggingConfiguration);
cosClient.setBucketTaggingConfiguration(setBucketTaggingConfigurationRequest);
Parameter | Description | Type |
---|---|---|
setBucketTaggingConfigurationRequest | Request to set the bucket tag | SetBucketTaggingConfigurationRequest |
Request member description:
Request Member | Set Method | Description | Type |
---|---|---|---|
bucketName | Constructor or set method | Bucket that the tag is set for, formatted as BucketName-APPID . For more information, please see Naming Conventions. |
String |
taggingConfiguration | Constructor or set method | Tagging configuration of the bucket | BucketTaggingConfiguration |
Description of the BucketLoggingConfiguration
member:
Parameter | Description | Type |
---|---|---|
tagSets | Collection of tags for the bucket | List&dxlt;TagSet&dxgt; |
Description of the TagSet
member:
Parameter | Description | Type |
---|---|---|
tags | The tag’s key and value, which cannot exceed 128 bytes and can contain letters, digits, spaces, plus signs (+), minus signs (−), underscores (_), equal signs (=), dots (.), colons (:), and slashes (/). | Map&dxlt;String, String&dxgt; |
This API is used to query the existing tags of a specified bucket.
public BucketTaggingConfiguration getBucketTaggingConfiguration(String bucketName);
String bucketName = "examplebucket-1250000000";
BucketTaggingConfiguration bucketTaggingConfiguration = cosClient.getBucketTaggingConfiguration(bucketName);
Parameter | Description | Type |
---|---|---|
bucketName | Bucket to query the tags from, formatted as BucketName-APPID . For more information, please see Naming Conventions. |
String |
BucketTaggingConfiguration
, including the bucket’s tagging configuration.This API is used to delete the existing tags from a bucket.
public void deleteBucketTaggingConfiguration(String bucketName);
String bucketName = "examplebucket-1250000000";
cosClient.deleteBucketTaggingConfiguration(bucketName);
Parameter | Description | Type |
---|---|---|
bucketName | Bucket to delete the tags from, formatted as BucketName-APPID . For more information, please see Naming Conventions. |
String |
Apakah halaman ini membantu?