Setting Bucket Tags

If you have any questions during development, post them on the Issues page of GitHub. For details about parameters and usage of each API, see the API Reference

You can call ObsClient.SetBucketTagging to set bucket tags. Sample code is as follows:

// Create an instance of ObsClient.
ObsClient client = new ObsClient("*** Provide your Access Key ***", "*** Provide your Secret Key ***", "https://your-endpoint");
// Set bucket tags.
try
{
    SetBucketTaggingRequest request = new SetBucketTaggingRequest();
    request.BucketName = "bucketname";
    Tag tag1 = new Tag();
    tag1.Key = "tag1";
    tag1.Value = "value1";
    Tag tag2 = new Tag();
    tag2.Key = "tag2";
    tag2.Value = "value2";
    request.Tags.Add(tag2);
    request.Tags.Add(tag1);
    SetBucketTaggingResponse response = client.SetBucketTagging(request);
    Console.WriteLine("Set bucket tag response: {0}", response.StatusCode);
}
catch (ObsException ex)
{
    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
}
  • A bucket can have up to 10 tags.
  • The key and value pair of a tag can be composed of Unicode characters.