API | 操作名 | 操作描述 |
设置存储桶标签 | 为已存在的存储桶设置标签 | |
查询存储桶标签 | 查询指定存储桶下已有的存储桶标签 | |
删除存储桶标签 | 删除指定的存储桶标签 |
try{// 存储桶名称,此处填入格式必须为 bucketname-APPID, 其中 APPID 获取参考 https://console.tencentcloud.com/developerstring bucket = "examplebucket-1250000000";PutBucketTaggingRequest request = new PutBucketTaggingRequest(bucket);string akey = "aTagKey";string avalue = "aTagValue";string bkey = "bTagKey";string bvalue = "bTagValue";request.AddTag(akey, avalue);request.AddTag(bkey, bvalue);//执行请求PutBucketTaggingResult result = cosXml.PutBucketTagging(request);//请求成功Console.WriteLine(result.GetResultInfo());}catch (COSXML.CosException.CosClientException clientEx){//请求失败Console.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){//请求失败Console.WriteLine("CosServerException: " + serverEx.GetInfo());}
try{// 存储桶名称,此处填入格式必须为 bucketname-APPID, 其中 APPID 获取参考 https://console.tencentcloud.com/developerstring bucket = "examplebucket-1250000000";GetBucketTaggingRequest request = new GetBucketTaggingRequest(bucket);//执行请求GetBucketTaggingResult result = cosXml.GetBucketTagging(request);//请求成功Tagging tagging = result.tagging;Console.WriteLine(tagging);}catch (COSXML.CosException.CosClientException clientEx){//请求失败Console.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){//请求失败Console.WriteLine("CosServerException: " + serverEx.GetInfo());}
try{// 存储桶名称,此处填入格式必须为 bucketname-APPID, 其中 APPID 获取参考 https://console.tencentcloud.com/developerstring bucket = "examplebucket-1250000000";DeleteBucketTaggingRequest request = new DeleteBucketTaggingRequest(bucket);//执行请求DeleteBucketTaggingResult result = cosXml.DeleteBucketTagging(request);//请求成功Console.WriteLine(result.GetResultInfo());}catch (COSXML.CosException.CosClientException clientEx){//请求失败Console.WriteLine("CosClientException: " + clientEx);}catch (COSXML.CosException.CosServerException serverEx){//请求失败Console.WriteLine("CosServerException: " + serverEx.GetInfo());}
本页内容是否解决了您的问题?