API | Operation | Description |
Setting bucket tags | Sets tags for an existing bucket | |
Querying bucket tags | Queries the existing tags of a bucket | |
Deleting bucket tags | Deletes the tags of a 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 | 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 |
BucketLoggingConfiguration
member:Parameter | Description | Type |
tagSets | Collection of tags for the bucket | List<TagSet> |
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<String, String> |
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.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 |
Was this page helpful?