PutBucketVersioningRequest.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using COSXML.Common;
  5. using COSXML.Model.Tag;
  6. using COSXML.Network;
  7. namespace COSXML.Model.Bucket
  8. {
  9. public sealed class PutBucketVersioningRequest : BucketRequest
  10. {
  11. private VersioningConfiguration versioningConfiguration;
  12. public PutBucketVersioningRequest(string bucket)
  13. : base(bucket)
  14. {
  15. this.method = CosRequestMethod.PUT;
  16. this.queryParameters.Add("versioning", null);
  17. versioningConfiguration = new VersioningConfiguration();
  18. }
  19. public override Network.RequestBody GetRequestBody()
  20. {
  21. return GetXmlRequestBody(versioningConfiguration);
  22. }
  23. public void IsEnableVersionConfig(bool isEnable)
  24. {
  25. if (isEnable)
  26. {
  27. versioningConfiguration.status = "Enabled";
  28. }
  29. else
  30. {
  31. versioningConfiguration.status = "Suspended";
  32. }
  33. }
  34. }
  35. }