CreateBucketCommand.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (C) Alibaba Cloud Computing
  3. * All rights reserved.
  4. *
  5. * 版权所有 (C)阿里云计算有限公司
  6. */
  7. using System;
  8. using Aliyun.OSS.Common.Communication;
  9. using Aliyun.OSS.Util;
  10. namespace Aliyun.OSS.Commands
  11. {
  12. internal class CreateBucketCommand : OssCommand
  13. {
  14. private readonly string _bucketName;
  15. protected override HttpMethod Method
  16. {
  17. get { return HttpMethod.Put; }
  18. }
  19. protected override string Bucket
  20. {
  21. get { return _bucketName; }
  22. }
  23. private CreateBucketCommand(IServiceClient client, Uri endpoint, ExecutionContext context,
  24. string bucketName)
  25. : base(client, endpoint, context)
  26. {
  27. OssUtils.CheckBucketName(bucketName);
  28. _bucketName = bucketName;
  29. }
  30. public static CreateBucketCommand Create(IServiceClient client, Uri endpoint,
  31. ExecutionContext context,
  32. string bucketName)
  33. {
  34. return new CreateBucketCommand(client, endpoint, context, bucketName);
  35. }
  36. }
  37. }