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