QCloudPutBucketTaggingRequest Class Reference
Inherits from | QCloudBizHTTPRequest |
---|---|
Declared in | QCloudPutBucketTaggingRequest.h QCloudPutBucketTaggingRequest.m |
Overview
设置存储桶标签的方法
功能说明
PUT Bucket tagging 用于为已存在的存储桶设置标签。
关于为已存在的存储桶设置标签接口描述,请查看 https://cloud.tencent.com/document/product/436/34838.
示例
@code
QCloudPutBucketTaggingRequest *putReq = [QCloudPutBucketTaggingRequest new];
// 存储桶名称,格式为 BucketName-APPID
putReq.bucket = @"examplebucket-1250000000";
// 标签集合
QCloudBucketTagging *taggings = [QCloudBucketTagging new];
QCloudBucketTag *tag1 = [QCloudBucketTag new];
// 标签的 Key,长度不超过128字节, 支持英文字母、数字、空格、加号、减号、下划线、等号、点号、
// 冒号、斜线
tag1.key = @"age";
// 标签的 Value,长度不超过256字节, 支持英文字母、数字、空格、加号、减号、下划线、等号、点号
// 、冒号、斜线
tag1.value = @"20";
QCloudBucketTag *tag2 = [QCloudBucketTag new];
tag2.key = @"name";
tag2.value = @"karis";
// 标签集合,最多支持10个标签
QCloudBucketTagSet *tagSet = [QCloudBucketTagSet new];
tagSet.tag = @[tag1,tag2];
taggings.tagSet = tagSet;
// 标签集合
putReq.taggings = taggings;
[putReq setFinishBlock:^(id outputObject, NSError *error) {
// outputObject 包含所有的响应 http 头部
NSDictionary* info = (NSDictionary *) outputObject;
}];
[[QCloudCOSXMLService defaultCOSXML] PutBucketTagging:putReq];