PutBucketTaggingRequest.cs 882 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Text;
  3. using COSXML.Common;
  4. using COSXML.Model.Tag;
  5. using COSXML.Network;
  6. namespace COSXML.Model.Bucket
  7. {
  8. /// <summary>
  9. /// 添加存储桶标签
  10. /// <see href="https://cloud.tencent.com/document/product/436/7735"/>
  11. /// </summary>
  12. public sealed class PutBucketTaggingRequest : BucketRequest
  13. {
  14. private Tagging tagging;
  15. public PutBucketTaggingRequest(string bucket)
  16. : base(bucket)
  17. {
  18. this.method = CosRequestMethod.PUT;
  19. this.tagging = new Tagging();
  20. this.queryParameters.Add("tagging", null);
  21. }
  22. public void AddTag(string key, string value)
  23. {
  24. this.tagging.AddTag(key, value);
  25. }
  26. public override Network.RequestBody GetRequestBody()
  27. {
  28. return GetXmlRequestBody(tagging);
  29. }
  30. }
  31. }