12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using COSXML.Common;
- using COSXML.Utils;
- using COSXML.Model.Tag;
- namespace COSXML.Model.Bucket
- {
- /// <summary>
- /// 创建 Bucket
- /// <see href="https://cloud.tencent.com/document/product/436/7738"/>
- /// </summary>
- public sealed class PutBucketRequest : BucketRequest
- {
- public PutBucketRequest(string bucket)
- : base(bucket)
- {
- this.method = CosRequestMethod.PUT;
- }
- /// <summary>
- /// 定义 Object 的 acl 属性。有效值:private,public-read-write,public-read;默认值:private
- /// <see href="Common.CosACL"/>
- /// </summary>
- /// <param name="cosACL"></param>
- public void SetCosACL(string cosACL)
- {
- if (cosACL != null)
- {
- SetRequestHeader(CosRequestHeaderKey.X_COS_ACL, cosACL);
- }
- }
- /// <summary>
- /// 定义 Object 的 acl 属性。有效值:private,public-read-write,public-read;默认值:private
- /// <see href="Common.CosACL"/>
- /// </summary>
- /// <param name="cosACL"></param>
- public void SetCosACL(CosACL cosACL)
- {
- SetCosACL(EnumUtils.GetValue(cosACL));
- }
- /// <summary>
- /// 赋予被授权者读的权限
- /// <see href="Model.Tag.GrantAccount"/>
- /// </summary>
- /// <param name="grantAccount"></param>
- public void SetXCosGrantRead(GrantAccount grantAccount)
- {
- if (grantAccount != null)
- {
- SetRequestHeader(CosRequestHeaderKey.X_COS_GRANT_READ, grantAccount.GetGrantAccounts());
- }
- }
- /// <summary>
- /// 赋予被授权者写的权限
- /// <see href="Model.Tag.GrantAccount"/>
- /// </summary>
- /// <param name="grantAccount"></param>
- public void SetXCosGrantWrite(GrantAccount grantAccount)
- {
- if (grantAccount != null)
- {
- SetRequestHeader(CosRequestHeaderKey.X_COS_GRANT_WRITE, grantAccount.GetGrantAccounts());
- }
- }
- /// <summary>
- /// 赋予被授权者所有的权限
- /// <see href="Model.Tag.GrantAccount"/>
- /// </summary>
- /// <param name="grantAccount"></param>
- public void SetXCosReadWrite(GrantAccount grantAccount)
- {
- if (grantAccount != null)
- {
- SetRequestHeader(CosRequestHeaderKey.X_COS_GRANT_FULL_CONTROL, grantAccount.GetGrantAccounts());
- }
- }
- }
- }
|