Setting Bucket Tags

You can call setBucketTagging to set the bucket quota. Sample code is as follows:

static OBSClient *client;
NSString *endPoint = @"your-endpoint";
NSString *SK = @"*** Provide your Secret Key ***";
NSString *AK = @"*** Provide your Access Key ***";
    
// Initialize identity authentication.
OBSStaticCredentialProvider *credentialProvider = [[OBSStaticCredentialProvider alloc] initWithAccessKey:AK secretKey:SK];
    
//Initialize service configuration.
OBSServiceConfiguration *conf = [[OBSServiceConfiguration alloc] initWithURLString:endPoint credentialProvider:credentialProvider];
    
// Initialize an instance of OBSClient.
client = [[OBSClient alloc] initWithConfiguration:conf];
    
// Set bucket tags.
OBSSetBucketTaggingRequest *request = [[OBSSetBucketTaggingRequest alloc]initWithBucketName:@"bucketname"];
[request.tagList addObject:[[OBSBucketTag alloc]initWithKey:@"tagkey" value:@"tagvalue"]];
[request.tagList addObject:[[OBSBucketTag alloc]initWithKey:@"tagkey1" value:@"tagvalue1"]];
    
[client setBucketTagging:request completionHandler:^(OBSSetBucketTaggingResponse *response, NSError *error){
    NSLog(@"%@",response);
 }];
  • A bucket can have up to 10 tags.
  • The key and the value of a tag can be composed of Unicode characters.