首次推送
This commit is contained in:
117
COSXML/Model/Bucket/BucketRequest.cs
Normal file
117
COSXML/Model/Bucket/BucketRequest.cs
Normal file
@@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.CosException;
|
||||
using COSXML.Common;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/2/2018 8:03:59 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/**
|
||||
* Buceket request for cos
|
||||
* base class
|
||||
* provider bucket,region property
|
||||
*/
|
||||
public abstract class BucketRequest : CosRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// cos 存储桶,即 Bucket
|
||||
/// </summary>
|
||||
protected string bucket;
|
||||
|
||||
/// <summary>
|
||||
/// Bucket 所在的地域
|
||||
/// </summary>
|
||||
protected string region;
|
||||
|
||||
public BucketRequest(string bucket)
|
||||
{
|
||||
this.bucket = bucket;
|
||||
this.path = "/";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bucket 名称, "BucketName-APPID"
|
||||
/// </summary>
|
||||
public string Bucket
|
||||
{
|
||||
get { return this.bucket; }
|
||||
set { this.bucket = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bucket 所在地域
|
||||
/// <see cref="COSXML.Common.CosRegion"/>
|
||||
/// </summary>
|
||||
public string Region
|
||||
{
|
||||
get { return this.region; }
|
||||
set { this.region = value; }
|
||||
}
|
||||
|
||||
public override Network.RequestBody GetRequestBody()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public override string GetCOSHost() {
|
||||
StringBuilder hostBuilder = new StringBuilder();
|
||||
hostBuilder.Append(bucket);
|
||||
if (!String.IsNullOrEmpty(appid) && !bucket.EndsWith("-" + appid))
|
||||
{
|
||||
hostBuilder.Append("-")
|
||||
.Append(appid);
|
||||
}
|
||||
hostBuilder.Append(".cos.")
|
||||
.Append(region)
|
||||
.Append(".myqcloud.com");
|
||||
return hostBuilder.ToString();
|
||||
}
|
||||
|
||||
public override string GetHost()
|
||||
{
|
||||
StringBuilder hostBuilder = new StringBuilder();
|
||||
if (!String.IsNullOrEmpty(serviceConfig.host)) {
|
||||
hostBuilder.Append(serviceConfig.host);
|
||||
} else {
|
||||
hostBuilder.Append(bucket);
|
||||
if (!String.IsNullOrEmpty(appid) && !bucket.EndsWith("-" + appid))
|
||||
{
|
||||
hostBuilder.Append("-")
|
||||
.Append(appid);
|
||||
}
|
||||
if (serviceConfig.endpointSuffix != null) {
|
||||
hostBuilder.Append(".")
|
||||
.Append(serviceConfig.endpointSuffix);
|
||||
} else {
|
||||
hostBuilder.Append(".cos.")
|
||||
.Append(region)
|
||||
.Append(".myqcloud.com");
|
||||
}
|
||||
}
|
||||
return hostBuilder.ToString();
|
||||
}
|
||||
|
||||
public override void CheckParameters()
|
||||
{
|
||||
if (requestUrlWithSign != null) return;
|
||||
//if (appid == null)
|
||||
//{
|
||||
// throw new CosClientException((int)CosClientError.INVALID_ARGUMENT, "appid is null");
|
||||
//}
|
||||
if (bucket == null)
|
||||
{
|
||||
throw new CosClientException((int)CosClientError.INVALID_ARGUMENT, "bucket is null");
|
||||
}
|
||||
// if (region == null)
|
||||
// {
|
||||
// throw new CosClientException((int)CosClientError.INVALID_ARGUMENT, "region is null");
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
25
COSXML/Model/Bucket/DeleteBucketCORSRequest.cs
Normal file
25
COSXML/Model/Bucket/DeleteBucketCORSRequest.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/2/2018 8:33:02 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 删除 Bucket CORS
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/8283"/>
|
||||
/// </summary>
|
||||
public sealed class DeleteBucketCORSRequest : BucketRequest
|
||||
{
|
||||
public DeleteBucketCORSRequest(string bucket) : base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.DELETE;
|
||||
this.queryParameters.Add("cors", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
COSXML/Model/Bucket/DeleteBucketCORSResult.cs
Normal file
19
COSXML/Model/Bucket/DeleteBucketCORSResult.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/2/2018 8:37:56 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 删除 Bucket CORS 返回的结果
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/8283"/>
|
||||
/// </summary>
|
||||
public sealed class DeleteBucketCORSResult : CosResult
|
||||
{
|
||||
}
|
||||
}
|
||||
26
COSXML/Model/Bucket/DeleteBucketInventoryRequest.cs
Normal file
26
COSXML/Model/Bucket/DeleteBucketInventoryRequest.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using COSXML.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class DeleteBucketInventoryRequest : BucketRequest
|
||||
{
|
||||
public DeleteBucketInventoryRequest(string bucket) : base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.DELETE;
|
||||
this.queryParameters.Add("inventory", null);
|
||||
}
|
||||
|
||||
public void SetInventoryId(string inventoryId)
|
||||
{
|
||||
if (inventoryId != null)
|
||||
{
|
||||
SetQueryParameter("id", inventoryId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
11
COSXML/Model/Bucket/DeleteBucketInventoryResult.cs
Normal file
11
COSXML/Model/Bucket/DeleteBucketInventoryResult.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class DeleteBucketInventoryResult : CosResult
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
26
COSXML/Model/Bucket/DeleteBucketLifecycleRequest.cs
Normal file
26
COSXML/Model/Bucket/DeleteBucketLifecycleRequest.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/2/2018 8:39:37 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 删除 Bucket Lifecycle
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/8284"/>
|
||||
/// </summary>
|
||||
public sealed class DeleteBucketLifecycleRequest : BucketRequest
|
||||
{
|
||||
public DeleteBucketLifecycleRequest(string bucket)
|
||||
: base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.DELETE;
|
||||
this.queryParameters.Add("lifecycle", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
COSXML/Model/Bucket/DeleteBucketLifecycleResult.cs
Normal file
19
COSXML/Model/Bucket/DeleteBucketLifecycleResult.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/2/2018 8:40:44 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 删除 Bucket Lifecycle 返回的结果
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/8284"/>
|
||||
/// </summary>
|
||||
public sealed class DeleteBucketLifecycleResult : CosResult
|
||||
{
|
||||
}
|
||||
}
|
||||
25
COSXML/Model/Bucket/DeleteBucketPolicyRequest.cs
Normal file
25
COSXML/Model/Bucket/DeleteBucketPolicyRequest.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/12/2018 9:22:06 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 删除 Bucket 权限策略
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/8285"/>
|
||||
/// </summary>
|
||||
public sealed class DeleteBucketPolicyRequest : BucketRequest
|
||||
{
|
||||
public DeleteBucketPolicyRequest(string bucket)
|
||||
: base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.DELETE;
|
||||
this.queryParameters.Add("policy", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
18
COSXML/Model/Bucket/DeleteBucketPolicyResult.cs
Normal file
18
COSXML/Model/Bucket/DeleteBucketPolicyResult.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/12/2018 9:23:46 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 删除 Bucket 权限策略返回的结果
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/8285"/>
|
||||
/// </summary>
|
||||
public sealed class DeleteBucketPolicyResult : CosResult
|
||||
{
|
||||
}
|
||||
}
|
||||
22
COSXML/Model/Bucket/DeleteBucketReplicationRequest.cs
Normal file
22
COSXML/Model/Bucket/DeleteBucketReplicationRequest.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/2/2018 8:44:41 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class DeleteBucketReplicationRequest : BucketRequest
|
||||
{
|
||||
public DeleteBucketReplicationRequest(string bucket)
|
||||
: base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.DELETE;
|
||||
this.queryParameters.Add("replication", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
15
COSXML/Model/Bucket/DeleteBucketReplicationResult.cs
Normal file
15
COSXML/Model/Bucket/DeleteBucketReplicationResult.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/2/2018 8:48:08 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class DeleteBucketReplicationResult : CosResult
|
||||
{
|
||||
}
|
||||
}
|
||||
25
COSXML/Model/Bucket/DeleteBucketRequest.cs
Normal file
25
COSXML/Model/Bucket/DeleteBucketRequest.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/2/2018 9:03:15 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class DeleteBucketRequest : BucketRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 删除 空 Bucket
|
||||
/// </summary>
|
||||
/// <param name="bucket"></param>
|
||||
public DeleteBucketRequest(string bucket)
|
||||
: base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.DELETE;
|
||||
}
|
||||
}
|
||||
}
|
||||
18
COSXML/Model/Bucket/DeleteBucketResult.cs
Normal file
18
COSXML/Model/Bucket/DeleteBucketResult.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/2/2018 9:04:44 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 删除 空 Bucket返回的结果
|
||||
/// </summary>
|
||||
public sealed class DeleteBucketResult : CosResult
|
||||
{
|
||||
}
|
||||
}
|
||||
19
COSXML/Model/Bucket/DeleteBucketTaggingRequest.cs
Normal file
19
COSXML/Model/Bucket/DeleteBucketTaggingRequest.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using COSXML.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class DeleteBucketTaggingRequest:BucketRequest
|
||||
{
|
||||
public DeleteBucketTaggingRequest(string bucket) : base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.DELETE;
|
||||
this.queryParameters.Add("tagging", null);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
8
COSXML/Model/Bucket/DeleteBucketTaggingResult.cs
Normal file
8
COSXML/Model/Bucket/DeleteBucketTaggingResult.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class DeleteBucketTaggingResult : CosResult
|
||||
{
|
||||
}
|
||||
}
|
||||
17
COSXML/Model/Bucket/DeleteBucketWebsiteRequest.cs
Normal file
17
COSXML/Model/Bucket/DeleteBucketWebsiteRequest.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using COSXML.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class DeleteBucketWebsiteRequest:BucketRequest
|
||||
{
|
||||
public DeleteBucketWebsiteRequest(string bucket) : base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.DELETE;
|
||||
this.queryParameters.Add("website", null);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
8
COSXML/Model/Bucket/DeleteBucketWebsiteResult.cs
Normal file
8
COSXML/Model/Bucket/DeleteBucketWebsiteResult.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class DeleteBucketWebsiteResult : CosResult
|
||||
{
|
||||
}
|
||||
}
|
||||
26
COSXML/Model/Bucket/GetBucketACLRequest.cs
Normal file
26
COSXML/Model/Bucket/GetBucketACLRequest.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/2/2018 9:07:34 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取 Bucket 的访问权限控制列表
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/7733"/>
|
||||
/// </summary>
|
||||
public sealed class GetBucketACLRequest : BucketRequest
|
||||
{
|
||||
public GetBucketACLRequest(string bucket)
|
||||
: base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.GET;
|
||||
this.queryParameters.Add("acl", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
38
COSXML/Model/Bucket/GetBucketACLResult.cs
Normal file
38
COSXML/Model/Bucket/GetBucketACLResult.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Model.Tag;
|
||||
using System.IO;
|
||||
using COSXML.Transfer;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/2/2018 9:08:55 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取 Bucket 访问权限列表返回的结果
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/7733"/>
|
||||
/// </summary>
|
||||
public sealed class GetBucketACLResult : CosResult
|
||||
{
|
||||
/// <summary>
|
||||
/// 访问权限列表信息
|
||||
/// <see cref="COSXML.Model.Tag.AccessControlPolicy"/>
|
||||
/// </summary>
|
||||
public AccessControlPolicy accessControlPolicy;
|
||||
|
||||
internal override void ParseResponseBody(Stream inputStream, string contentType, long contentLength)
|
||||
{
|
||||
accessControlPolicy = new AccessControlPolicy();
|
||||
XmlParse.ParseAccessControlPolicy(inputStream, accessControlPolicy);
|
||||
}
|
||||
|
||||
public override string GetResultInfo()
|
||||
{
|
||||
return base.GetResultInfo() + (accessControlPolicy == null ? "" : "\n" + accessControlPolicy.GetInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
26
COSXML/Model/Bucket/GetBucketCORSRequest.cs
Normal file
26
COSXML/Model/Bucket/GetBucketCORSRequest.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/2/2018 9:59:44 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取 Bucket CORS 配置信息
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/8274"/>
|
||||
/// </summary>
|
||||
public sealed class GetBucketCORSRequest : BucketRequest
|
||||
{
|
||||
public GetBucketCORSRequest(string bucket)
|
||||
: base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.GET;
|
||||
this.queryParameters.Add("cors", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
38
COSXML/Model/Bucket/GetBucketCORSResult.cs
Normal file
38
COSXML/Model/Bucket/GetBucketCORSResult.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Transfer;
|
||||
/**
|
||||
* Copyright (c) 2018 Tencent Cloud. All rights reserved.
|
||||
* 11/2/2018 10:01:37 PM
|
||||
* bradyxiao
|
||||
*/
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取 Bucket CORS 返回的结果
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/8274"/>
|
||||
/// </summary>
|
||||
public class GetBucketCORSResult : CosResult
|
||||
{
|
||||
/// <summary>
|
||||
/// 跨域资源共享配置的所有信息,最多可以包含100条 CORSRule
|
||||
/// <see cref="COSXML.Model.Tag.CORSConfiguration"/>
|
||||
/// </summary>
|
||||
public CORSConfiguration corsConfiguration;
|
||||
|
||||
internal override void ParseResponseBody(System.IO.Stream inputStream, string contentType, long contentLength)
|
||||
{
|
||||
corsConfiguration = new CORSConfiguration();
|
||||
XmlParse.ParseCORSConfiguration(inputStream, corsConfiguration);
|
||||
}
|
||||
|
||||
public override string GetResultInfo()
|
||||
{
|
||||
return base.GetResultInfo() + (corsConfiguration == null ? "" : "\n " + corsConfiguration.GetInfo());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
18
COSXML/Model/Bucket/GetBucketDomainRequest.cs
Normal file
18
COSXML/Model/Bucket/GetBucketDomainRequest.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using COSXML.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class GetBucketDomainRequest :BucketRequest
|
||||
{
|
||||
public GetBucketDomainRequest(string bucket) : base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.GET;
|
||||
this.queryParameters.Add("domain", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
21
COSXML/Model/Bucket/GetBucketDomainResult.cs
Normal file
21
COSXML/Model/Bucket/GetBucketDomainResult.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Transfer;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class GetBucketDomainResult : CosResult
|
||||
{
|
||||
public DomainConfiguration domainConfiguration;
|
||||
|
||||
internal override void ParseResponseBody(System.IO.Stream inputStream, string contentType, long contentLength)
|
||||
{
|
||||
domainConfiguration = new DomainConfiguration();
|
||||
XmlParse.ParseBucketDomain(inputStream, domainConfiguration);
|
||||
}
|
||||
|
||||
public override string GetResultInfo()
|
||||
{
|
||||
return base.GetResultInfo() + (domainConfiguration == null ? "" : "\n" + domainConfiguration.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
24
COSXML/Model/Bucket/GetBucketInventoryRequest.cs
Normal file
24
COSXML/Model/Bucket/GetBucketInventoryRequest.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using COSXML.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class GetBucketInventoryRequest : BucketRequest
|
||||
{
|
||||
public GetBucketInventoryRequest(string bucket) : base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.GET;
|
||||
this.queryParameters.Add("inventory", null);
|
||||
}
|
||||
|
||||
public void SetInventoryId(string inventoryId)
|
||||
{
|
||||
if (inventoryId != null)
|
||||
{
|
||||
SetQueryParameter("id", inventoryId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
COSXML/Model/Bucket/GetBucketInventoryResult.cs
Normal file
21
COSXML/Model/Bucket/GetBucketInventoryResult.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Transfer;
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class GetBucketInventoryResult : CosResult
|
||||
{
|
||||
|
||||
public InventoryConfiguration inventoryConfiguration;
|
||||
|
||||
internal override void ParseResponseBody(System.IO.Stream inputStream, string contentType, long contentLength)
|
||||
{
|
||||
inventoryConfiguration = new InventoryConfiguration();
|
||||
XmlParse.ParseInventoryConfiguration(inputStream, inventoryConfiguration);
|
||||
}
|
||||
|
||||
public override string GetResultInfo()
|
||||
{
|
||||
return base.GetResultInfo() + (inventoryConfiguration == null ? "" : "\n" + inventoryConfiguration.GetInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
22
COSXML/Model/Bucket/GetBucketLifecycleRequest.cs
Normal file
22
COSXML/Model/Bucket/GetBucketLifecycleRequest.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询 Bucket 的生命周期配置
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/8278"/>
|
||||
/// </summary>
|
||||
public sealed class GetBucketLifecycleRequest : BucketRequest
|
||||
{
|
||||
public GetBucketLifecycleRequest(string bucket)
|
||||
: base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.GET;
|
||||
this.queryParameters.Add("lifecycle", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
33
COSXML/Model/Bucket/GetBucketLifecycleResult.cs
Normal file
33
COSXML/Model/Bucket/GetBucketLifecycleResult.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Transfer;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询 Bucket 的生命周期配置 返回的结果
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/8278"/>
|
||||
/// </summary>
|
||||
public sealed class GetBucketLifecycleResult : CosResult
|
||||
{
|
||||
/// <summary>
|
||||
/// 生命周期配置信息
|
||||
/// <see cref="COSXML.Model.Tag.LifecycleConfiguration"/>
|
||||
/// </summary>
|
||||
public LifecycleConfiguration lifecycleConfiguration;
|
||||
|
||||
internal override void ParseResponseBody(System.IO.Stream inputStream, string contentType, long contentLength)
|
||||
{
|
||||
lifecycleConfiguration = new LifecycleConfiguration();
|
||||
XmlParse.ParseLifecycleConfiguration(inputStream, lifecycleConfiguration);
|
||||
}
|
||||
|
||||
public override string GetResultInfo()
|
||||
{
|
||||
return base.GetResultInfo() + (lifecycleConfiguration == null ? "" : "\n " + lifecycleConfiguration.GetInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
21
COSXML/Model/Bucket/GetBucketLocationRequest.cs
Normal file
21
COSXML/Model/Bucket/GetBucketLocationRequest.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取 Bucket 地域信息
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/8275"/>
|
||||
/// </summary>
|
||||
public sealed class GetBucketLocationRequest : BucketRequest
|
||||
{
|
||||
public GetBucketLocationRequest(string bucket) : base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.GET;
|
||||
this.queryParameters.Add("location", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
33
COSXML/Model/Bucket/GetBucketLocationResult.cs
Normal file
33
COSXML/Model/Bucket/GetBucketLocationResult.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Transfer;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询 Bucket 地域信息返回的结果
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/8275"/>
|
||||
/// </summary>
|
||||
public sealed class GetBucketLocationResult : CosResult
|
||||
{
|
||||
/// <summary>
|
||||
/// 地域信息
|
||||
/// <see cref="COSXML.Model.Tag.LocationConstraint"/>
|
||||
/// </summary>
|
||||
public LocationConstraint locationConstraint;
|
||||
|
||||
internal override void ParseResponseBody(System.IO.Stream inputStream, string contentType, long contentLength)
|
||||
{
|
||||
locationConstraint = new LocationConstraint();
|
||||
XmlParse.ParseLocationConstraint(inputStream, locationConstraint);
|
||||
}
|
||||
|
||||
public override string GetResultInfo()
|
||||
{
|
||||
return base.GetResultInfo() + (locationConstraint == null ? "" : "\n" + locationConstraint.GetInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
16
COSXML/Model/Bucket/GetBucketLoggingRequest.cs
Normal file
16
COSXML/Model/Bucket/GetBucketLoggingRequest.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using COSXML.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class GetBucketLoggingRequest : BucketRequest
|
||||
{
|
||||
public GetBucketLoggingRequest(string bucket) : base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.GET;
|
||||
this.queryParameters.Add("logging", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
23
COSXML/Model/Bucket/GetBucketLoggingResult.cs
Normal file
23
COSXML/Model/Bucket/GetBucketLoggingResult.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Transfer;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class GetBucketLoggingResult : CosResult
|
||||
{
|
||||
public BucketLoggingStatus bucketLoggingStatus;
|
||||
internal override void ParseResponseBody(System.IO.Stream inputStream, string contentType, long contentLength)
|
||||
{
|
||||
bucketLoggingStatus = new BucketLoggingStatus();
|
||||
XmlParse.ParseBucketLoggingStatus(inputStream, bucketLoggingStatus);
|
||||
}
|
||||
|
||||
public override string GetResultInfo()
|
||||
{
|
||||
return base.GetResultInfo() + (bucketLoggingStatus == null ? "" : "\n" + bucketLoggingStatus.GetInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
21
COSXML/Model/Bucket/GetBucketPolicyRequest.cs
Normal file
21
COSXML/Model/Bucket/GetBucketPolicyRequest.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using COSXML.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取 Bucket 权限策略
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/8276"/>
|
||||
/// </summary>
|
||||
public sealed class GetBucketPolicyRequest : BucketRequest
|
||||
{
|
||||
public GetBucketPolicyRequest(string bucket)
|
||||
: base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.GET;
|
||||
this.queryParameters.Add("policy", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
14
COSXML/Model/Bucket/GetBucketPolicyResult.cs
Normal file
14
COSXML/Model/Bucket/GetBucketPolicyResult.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取 Bucket 权限策略
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/8276"/>
|
||||
/// </summary>
|
||||
public sealed class GetBucketPolicyResult : CosResult
|
||||
{
|
||||
}
|
||||
}
|
||||
18
COSXML/Model/Bucket/GetBucketReplicationRequest.cs
Normal file
18
COSXML/Model/Bucket/GetBucketReplicationRequest.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class GetBucketReplicationRequest : BucketRequest
|
||||
{
|
||||
public GetBucketReplicationRequest(string bucket)
|
||||
: base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.GET;
|
||||
this.queryParameters.Add("replication", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
25
COSXML/Model/Bucket/GetBucketReplicationResult.cs
Normal file
25
COSXML/Model/Bucket/GetBucketReplicationResult.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Transfer;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class GetBucketReplicationResult : CosResult
|
||||
{
|
||||
public ReplicationConfiguration replicationConfiguration;
|
||||
|
||||
internal override void ParseResponseBody(System.IO.Stream inputStream, string contentType, long contentLength)
|
||||
{
|
||||
replicationConfiguration = new ReplicationConfiguration();
|
||||
XmlParse.ParseReplicationConfiguration(inputStream, replicationConfiguration);
|
||||
}
|
||||
|
||||
public override string GetResultInfo()
|
||||
{
|
||||
return base.GetResultInfo() + (replicationConfiguration == null ? "" : "\n" + replicationConfiguration.GetInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
84
COSXML/Model/Bucket/GetBucketRequest.cs
Normal file
84
COSXML/Model/Bucket/GetBucketRequest.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取 Bucket 中对象列表
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/7734"/>
|
||||
/// </summary>
|
||||
public sealed class GetBucketRequest : BucketRequest
|
||||
{
|
||||
public GetBucketRequest(string bucket)
|
||||
: base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.GET;
|
||||
this.queryParameters.Add("max-keys", 1000.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 前缀匹配,用来规定返回的文件前缀地址
|
||||
/// </summary>
|
||||
/// <param name="prefix"></param>
|
||||
public void SetPrefix(string prefix)
|
||||
{
|
||||
if (prefix != null)
|
||||
{
|
||||
SetQueryParameter("prefix", prefix);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 定界符为一个符号,
|
||||
/// 如果有 Prefix,则将 Prefix 到 delimiter 之间的相同路径归为一类,定义为 Common Prefix,然后列出所有 Common Prefix。
|
||||
/// 如果没有 Prefix,则从路径起点开始
|
||||
/// </summary>
|
||||
/// <param name="delimiter"></param>
|
||||
public void SetDelimiter(string delimiter)
|
||||
{
|
||||
if (delimiter != null)
|
||||
{
|
||||
SetQueryParameter("delimiter", delimiter);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 规定返回值的编码方式,可选值:url
|
||||
/// </summary>
|
||||
/// <param name="encodingType"></param>
|
||||
public void SetEncodingType(string encodingType)
|
||||
{
|
||||
if (encodingType != null)
|
||||
{
|
||||
SetQueryParameter("encoding-type", encodingType);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 默认以 UTF-8 二进制顺序列出条目,所有列出条目从 marker 开始
|
||||
/// </summary>
|
||||
/// <param name="marker"></param>
|
||||
public void SetMarker(string marker)
|
||||
{
|
||||
if (marker != null)
|
||||
{
|
||||
SetQueryParameter("marker", marker);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 单次返回最大的条目数量,默认 1000
|
||||
/// </summary>
|
||||
/// <param name="maxKeys"></param>
|
||||
public void SetMaxKeys(string maxKeys)
|
||||
{
|
||||
if (maxKeys != null)
|
||||
{
|
||||
SetQueryParameter("max-keys", maxKeys);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
34
COSXML/Model/Bucket/GetBucketResult.cs
Normal file
34
COSXML/Model/Bucket/GetBucketResult.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Transfer;
|
||||
using System.IO;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取 Bucket 对象列表返回的jieguo
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/7734"/>
|
||||
/// </summary>
|
||||
public sealed class GetBucketResult : CosResult
|
||||
{
|
||||
/// <summary>
|
||||
/// 保存 Get Bucket 请求结果的所有信息
|
||||
/// <see cref="COSXML.Model.Tag.ListBucket"/>
|
||||
/// </summary>
|
||||
public ListBucket listBucket;
|
||||
|
||||
internal override void ParseResponseBody(System.IO.Stream inputStream, string contentType, long contentLength)
|
||||
{
|
||||
listBucket = new ListBucket();
|
||||
XmlParse.ParseListBucket(inputStream, listBucket);
|
||||
}
|
||||
|
||||
public override string GetResultInfo()
|
||||
{
|
||||
return base.GetResultInfo() + (listBucket == null ? "" : "\n" + listBucket.GetInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
17
COSXML/Model/Bucket/GetBucketTaggingRequest.cs
Normal file
17
COSXML/Model/Bucket/GetBucketTaggingRequest.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class GetBucketTaggingRequest : BucketRequest
|
||||
{
|
||||
public GetBucketTaggingRequest(string bucket) : base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.GET;
|
||||
this.queryParameters.Add("tagging", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
20
COSXML/Model/Bucket/GetBucketTaggingResult.cs
Normal file
20
COSXML/Model/Bucket/GetBucketTaggingResult.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Transfer;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class GetBucketTaggingResult : CosResult
|
||||
{
|
||||
public Tagging tagging;
|
||||
|
||||
internal override void ParseResponseBody(System.IO.Stream inputStream, string contentType, long contentLength)
|
||||
{
|
||||
tagging = new Tagging();
|
||||
XmlParse.ParseTagging(inputStream, tagging);
|
||||
}
|
||||
}
|
||||
}
|
||||
17
COSXML/Model/Bucket/GetBucketVersioningRequest.cs
Normal file
17
COSXML/Model/Bucket/GetBucketVersioningRequest.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class GetBucketVersioningRequest : BucketRequest
|
||||
{
|
||||
public GetBucketVersioningRequest(string bucket) : base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.GET;
|
||||
this.queryParameters.Add("versioning", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
25
COSXML/Model/Bucket/GetBucketVersioningResult.cs
Normal file
25
COSXML/Model/Bucket/GetBucketVersioningResult.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Transfer;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class GetBucketVersioningResult : CosResult
|
||||
{
|
||||
public VersioningConfiguration versioningConfiguration;
|
||||
|
||||
internal override void ParseResponseBody(System.IO.Stream inputStream, string contentType, long contentLength)
|
||||
{
|
||||
versioningConfiguration = new VersioningConfiguration();
|
||||
XmlParse.ParseVersioningConfiguration(inputStream, versioningConfiguration);
|
||||
}
|
||||
|
||||
public override string GetResultInfo()
|
||||
{
|
||||
return base.GetResultInfo() + (versioningConfiguration == null ? "" : "\n" + versioningConfiguration.GetInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
16
COSXML/Model/Bucket/GetBucketWebsiteRequest.cs
Normal file
16
COSXML/Model/Bucket/GetBucketWebsiteRequest.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using COSXML.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class GetBucketWebsiteRequest :BucketRequest
|
||||
{
|
||||
public GetBucketWebsiteRequest(string bucket) : base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.GET;
|
||||
this.queryParameters.Add("website", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
21
COSXML/Model/Bucket/GetBucketWebsiteResult.cs
Normal file
21
COSXML/Model/Bucket/GetBucketWebsiteResult.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Transfer;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class GetBucketWebsiteResult : CosResult
|
||||
{
|
||||
public WebsiteConfiguration websiteConfiguration;
|
||||
|
||||
internal override void ParseResponseBody(System.IO.Stream inputStream, string contentType, long contentLength)
|
||||
{
|
||||
websiteConfiguration = new WebsiteConfiguration();
|
||||
XmlParse.ParseWebsiteConfig(inputStream, websiteConfiguration);
|
||||
}
|
||||
|
||||
public override string GetResultInfo()
|
||||
{
|
||||
return base.GetResultInfo() + (websiteConfiguration == null ? "" : "\n" + websiteConfiguration.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
21
COSXML/Model/Bucket/HeadBucketRequest.cs
Normal file
21
COSXML/Model/Bucket/HeadBucketRequest.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 检索 Bucket 是否存在
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/7735"/>
|
||||
/// </summary>
|
||||
public sealed class HeadBucketRequest : BucketRequest
|
||||
{
|
||||
public HeadBucketRequest(string bucket)
|
||||
: base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.HEAD;
|
||||
}
|
||||
}
|
||||
}
|
||||
16
COSXML/Model/Bucket/HeadBucketResult.cs
Normal file
16
COSXML/Model/Bucket/HeadBucketResult.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 检索 Bucket 是否存在的返回结果
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/7735"/>
|
||||
/// </summary>
|
||||
public sealed class HeadBucketResult : CosResult
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
25
COSXML/Model/Bucket/ListBucketInventoryRequest.cs
Normal file
25
COSXML/Model/Bucket/ListBucketInventoryRequest.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using COSXML.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class ListBucketInventoryRequest: BucketRequest
|
||||
{
|
||||
private String continuationToken;
|
||||
public ListBucketInventoryRequest(string bucket) : base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.GET;
|
||||
this.queryParameters.Add("inventory", null);
|
||||
}
|
||||
|
||||
public void SetContinuationToken(String continuationToken)
|
||||
{
|
||||
if (continuationToken != null)
|
||||
{
|
||||
SetQueryParameter("continuation-token", continuationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
COSXML/Model/Bucket/ListBucketInventoryResult.cs
Normal file
21
COSXML/Model/Bucket/ListBucketInventoryResult.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Transfer;
|
||||
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class ListBucketInventoryResult : CosResult
|
||||
{
|
||||
public ListInventoryConfiguration listInventoryConfiguration;
|
||||
internal override void ParseResponseBody(System.IO.Stream inputStream, string contentType, long contentLength)
|
||||
{
|
||||
listInventoryConfiguration = new ListInventoryConfiguration();
|
||||
XmlParse.ParseListInventoryConfiguration(inputStream, listInventoryConfiguration);
|
||||
}
|
||||
|
||||
public override string GetResultInfo()
|
||||
{
|
||||
return base.GetResultInfo() + (listInventoryConfiguration == null ? "" : "\n" + listInventoryConfiguration.GetInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
70
COSXML/Model/Bucket/ListBucketVersionsRequest.cs
Normal file
70
COSXML/Model/Bucket/ListBucketVersionsRequest.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class ListBucketVersionsRequest : BucketRequest
|
||||
{
|
||||
public ListBucketVersionsRequest(string bucket)
|
||||
: base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.GET;
|
||||
this.queryParameters.Add("versions", null);
|
||||
}
|
||||
|
||||
public void SetPrefix(string prefix)
|
||||
{
|
||||
if (prefix != null)
|
||||
{
|
||||
SetQueryParameter("prefix", prefix);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetKeyMarker(string keyMarker)
|
||||
{
|
||||
if (keyMarker != null)
|
||||
{
|
||||
SetQueryParameter("key-marker", keyMarker);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetVersionIdMarker(string versionIdMarker)
|
||||
{
|
||||
if (versionIdMarker != null)
|
||||
{
|
||||
SetQueryParameter("version-id-marker", versionIdMarker);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetDelimiter(string delimiter)
|
||||
{
|
||||
if (delimiter != null)
|
||||
{
|
||||
SetQueryParameter("delimiter", delimiter);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetEncodingType(string encodingType)
|
||||
{
|
||||
if (encodingType != null)
|
||||
{
|
||||
SetQueryParameter("encoding-type", encodingType);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetMaxKeys(string maxKeys)
|
||||
{
|
||||
if (maxKeys != null)
|
||||
{
|
||||
SetQueryParameter("max-keys", maxKeys);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetQueryParameter("max-keys", "1000");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
25
COSXML/Model/Bucket/ListBucketVersionsResult.cs
Normal file
25
COSXML/Model/Bucket/ListBucketVersionsResult.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Transfer;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class ListBucketVersionsResult :CosResult
|
||||
{
|
||||
public ListBucketVersions listBucketVersions;
|
||||
|
||||
internal override void ParseResponseBody(System.IO.Stream inputStream, string contentType, long contentLength)
|
||||
{
|
||||
listBucketVersions = new ListBucketVersions();
|
||||
XmlParse.ParseListBucketVersions(inputStream, listBucketVersions);
|
||||
}
|
||||
|
||||
public override string GetResultInfo()
|
||||
{
|
||||
return base.GetResultInfo() + (listBucketVersions == null ? "" : "\n" + listBucketVersions.GetInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
104
COSXML/Model/Bucket/ListMultiUploadsRequest.cs
Normal file
104
COSXML/Model/Bucket/ListMultiUploadsRequest.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询 Bucket 正在进行中的分块上传
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/7736"/>
|
||||
/// </summary>
|
||||
public sealed class ListMultiUploadsRequest : BucketRequest
|
||||
{
|
||||
public ListMultiUploadsRequest(string bucket)
|
||||
: base(bucket)
|
||||
{
|
||||
this.bucket = bucket;
|
||||
this.method = CosRequestMethod.GET;
|
||||
this.queryParameters.Add("uploads", null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 定界符为一个符号,
|
||||
/// 对 Object 名字包含指定前缀且第一次出现 delimiter 字符之间的 Object 作为一组元素:common prefix。
|
||||
/// 如果没有 prefix,则从路径起点开始
|
||||
/// </summary>
|
||||
/// <param name="delimiter"></param>
|
||||
public void SetDelimiter(string delimiter)
|
||||
{
|
||||
if (delimiter != null)
|
||||
{
|
||||
SetQueryParameter("delimiter", delimiter);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 规定返回值的编码格式,合法值:url
|
||||
/// </summary>
|
||||
/// <param name="encodingType"></param>
|
||||
public void SetEncodingType(string encodingType)
|
||||
{
|
||||
if (encodingType != null)
|
||||
{
|
||||
SetQueryParameter("Encoding-type", encodingType);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 与 upload-id-marker 一起使用.
|
||||
/// 当 upload-id-marker 未被指定时,ObjectName 字母顺序大于 key-marker 的条目将被列出.
|
||||
/// 当upload-id-marker被指定时,ObjectName 字母顺序大于key-marker的条目被列出,
|
||||
/// ObjectName 字母顺序等于 key-marker 同时 UploadID 大于 upload-id-marker 的条目将被列出。
|
||||
/// </summary>
|
||||
/// <param name="keyMarker"></param>
|
||||
public void SetKeyMarker(string keyMarker)
|
||||
{
|
||||
if (keyMarker != null)
|
||||
{
|
||||
SetQueryParameter("key-marker", keyMarker);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置最大返回的 multipart 数量,合法取值从1到1000,默认1000
|
||||
/// </summary>
|
||||
/// <param name="maxUploads"></param>
|
||||
public void SetMaxUploads(string maxUploads)
|
||||
{
|
||||
if (maxUploads != null)
|
||||
{
|
||||
SetQueryParameter("max-uploads", maxUploads);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 限定返回的 Object key 必须以 Prefix 作为前缀。
|
||||
/// 注意使用 prefix 查询时,返回的 key 中仍会包含 Prefix
|
||||
/// </summary>
|
||||
/// <param name="prefix"></param>
|
||||
public void SetPrefix(string prefix)
|
||||
{
|
||||
if (prefix != null)
|
||||
{
|
||||
SetQueryParameter("Prefix", prefix);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 与 key-marker 一起使用.
|
||||
/// 当 key-marker 未被指定时,upload-id-marker 将被忽略.
|
||||
/// 当 key-marker 被指定时,ObjectName字母顺序大于 key-marker 的条目被列出,
|
||||
/// ObjectName 字母顺序等于 key-marker 同时 UploadID 大于 upload-id-marker 的条目将被列出.
|
||||
/// </summary>
|
||||
/// <param name="uploadIdMarker"></param>
|
||||
public void SetUploadIdMarker(string uploadIdMarker)
|
||||
{
|
||||
if (uploadIdMarker != null)
|
||||
{
|
||||
SetQueryParameter("upload-id-marker", uploadIdMarker);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
33
COSXML/Model/Bucket/ListMultiUploadsResult.cs
Normal file
33
COSXML/Model/Bucket/ListMultiUploadsResult.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Transfer;
|
||||
using COSXML.Model.Tag;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询 Bucket 正在进行中的分块上传返回的结果
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/7736"/>
|
||||
/// </summary>
|
||||
public sealed class ListMultiUploadsResult : CosResult
|
||||
{
|
||||
/// <summary>
|
||||
/// 所有分块上传的信息
|
||||
/// <see cref="COSXML.Model.Tag.ListMultipartUploads"/>
|
||||
/// </summary>
|
||||
public ListMultipartUploads listMultipartUploads;
|
||||
|
||||
internal override void ParseResponseBody(System.IO.Stream inputStream, string contentType, long contentLength)
|
||||
{
|
||||
listMultipartUploads = new ListMultipartUploads();
|
||||
XmlParse.ParseListMultipartUploads(inputStream, listMultipartUploads);
|
||||
}
|
||||
|
||||
public override string GetResultInfo()
|
||||
{
|
||||
return base.GetResultInfo() + (listMultipartUploads == null ? "" : "\n" + listMultipartUploads.GetInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
87
COSXML/Model/Bucket/PutBucketACLRequest.cs
Normal file
87
COSXML/Model/Bucket/PutBucketACLRequest.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
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 的ACL
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/7737"/>
|
||||
/// </summary>
|
||||
public sealed class PutBucketACLRequest : BucketRequest
|
||||
{
|
||||
public PutBucketACLRequest(string bucket)
|
||||
: base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.PUT;
|
||||
this.queryParameters.Add("acl", null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 定义 Object 的 acl 属性。有效值:private,public-read-write,public-read;默认值:private
|
||||
/// <see cref="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 cref="Common.CosACL"/>
|
||||
/// </summary>
|
||||
/// <param name="cosACL"></param>
|
||||
public void SetCosACL(CosACL cosACL)
|
||||
{
|
||||
SetRequestHeader(CosRequestHeaderKey.X_COS_ACL, EnumUtils.GetValue(cosACL));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 赋予被授权者读的权限
|
||||
/// <see cref="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 cref="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 cref="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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
COSXML/Model/Bucket/PutBucketACLResult.cs
Normal file
15
COSXML/Model/Bucket/PutBucketACLResult.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 设置 Bucket ACL返回的结果
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/7737"/>
|
||||
/// </summary>
|
||||
public sealed class PutBucketACLResult : CosResult
|
||||
{
|
||||
}
|
||||
}
|
||||
73
COSXML/Model/Bucket/PutBucketCORSRequest.cs
Normal file
73
COSXML/Model/Bucket/PutBucketCORSRequest.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Network;
|
||||
using COSXML.CosException;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 设置 Bucket CORS
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/8279"/>
|
||||
/// </summary>
|
||||
public sealed class PutBucketCORSRequest : BucketRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// CORS 配置信息
|
||||
/// <see cref="Model.Tag.CORSConfiguration"/>
|
||||
/// </summary>
|
||||
private CORSConfiguration corsConfiguration;
|
||||
|
||||
public PutBucketCORSRequest(string bucket)
|
||||
: base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.PUT;
|
||||
this.queryParameters.Add("cors", null);
|
||||
corsConfiguration = new CORSConfiguration();
|
||||
corsConfiguration.corsRules = new List<CORSConfiguration.CORSRule>();
|
||||
this.needMD5 = true;
|
||||
}
|
||||
|
||||
public override Network.RequestBody GetRequestBody()
|
||||
{
|
||||
string content = Transfer.XmlBuilder.BuildCORSConfigXML(corsConfiguration);
|
||||
byte[] data = Encoding.UTF8.GetBytes(content);
|
||||
ByteRequestBody body = new ByteRequestBody(data);
|
||||
return body;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置 CORS 规则
|
||||
/// <see cref="Model.Tag.CORSConfiguration.CORSRule"/>
|
||||
/// </summary>
|
||||
/// <param name="corsRule"></param>
|
||||
public void SetCORSRule(CORSConfiguration.CORSRule corsRule)
|
||||
{
|
||||
if (corsRule != null)
|
||||
{
|
||||
corsConfiguration.corsRules.Add(corsRule);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 设置 CORS 规则
|
||||
/// <see cref="Model.Tag.CORSConfiguration.CORSRule"/>
|
||||
/// </summary>
|
||||
/// <param name="corsRules"></param>
|
||||
public void SetCORSRules(List<CORSConfiguration.CORSRule> corsRules)
|
||||
{
|
||||
if (corsRules != null)
|
||||
{
|
||||
corsConfiguration.corsRules.AddRange(corsRules);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CheckParameters()
|
||||
{
|
||||
base.CheckParameters();
|
||||
if (corsConfiguration.corsRules.Count == 0) throw new CosClientException((int)CosClientError.INVALID_ARGUMENT, "corsConfiguration.corsRules.Count = 0");
|
||||
}
|
||||
}
|
||||
}
|
||||
15
COSXML/Model/Bucket/PutBucketCORSResult.cs
Normal file
15
COSXML/Model/Bucket/PutBucketCORSResult.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 设置 Bucket CORS 返回的结果
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/8279"
|
||||
/// </summary>
|
||||
public sealed class PutBucketCORSResult : CosResult
|
||||
{
|
||||
}
|
||||
}
|
||||
34
COSXML/Model/Bucket/PutBucketDomainRequest.cs
Normal file
34
COSXML/Model/Bucket/PutBucketDomainRequest.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
using COSXML.Common;
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Network;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 检索 Bucket 是否存在
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/7735"/>
|
||||
/// </summary>
|
||||
public sealed class PutBucketDomainRequest : BucketRequest
|
||||
{
|
||||
private DomainConfiguration domain;
|
||||
|
||||
public PutBucketDomainRequest(string bucket, DomainConfiguration domain)
|
||||
: base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.PUT;
|
||||
this.domain = domain;
|
||||
this.queryParameters.Add("domain", null);
|
||||
}
|
||||
|
||||
public override Network.RequestBody GetRequestBody()
|
||||
{
|
||||
string content = Transfer.XmlBuilder.BuildDomain(this.domain);
|
||||
byte[] data = Encoding.UTF8.GetBytes(content);
|
||||
ByteRequestBody body = new ByteRequestBody(data);
|
||||
return body;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
COSXML/Model/Bucket/PutBucketDomainResult.cs
Normal file
11
COSXML/Model/Bucket/PutBucketDomainResult.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class PutBucketDomainResult : CosResult
|
||||
{
|
||||
}
|
||||
}
|
||||
96
COSXML/Model/Bucket/PutBucketInventoryRequest.cs
Normal file
96
COSXML/Model/Bucket/PutBucketInventoryRequest.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
using COSXML.Common;
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Network;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class PutBucketInventoryRequest : BucketRequest
|
||||
{
|
||||
private InventoryConfiguration inventoryConfiguration;
|
||||
public PutBucketInventoryRequest(string bucket, string id) : base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.PUT;
|
||||
this.queryParameters.Add("inventory", null);
|
||||
this.queryParameters.Add("id", id);
|
||||
this.IsNeedMD5 = true;
|
||||
inventoryConfiguration = new InventoryConfiguration();
|
||||
inventoryConfiguration.isEnabled = true;
|
||||
inventoryConfiguration.id = id;
|
||||
inventoryConfiguration.schedule = new InventoryConfiguration.Schedule();
|
||||
inventoryConfiguration.destination = new InventoryConfiguration.Destination();
|
||||
inventoryConfiguration.destination.cosBucketDestination = new InventoryConfiguration.COSBucketDestination();
|
||||
}
|
||||
|
||||
public void IsEnable(bool isEnabled)
|
||||
{
|
||||
inventoryConfiguration.isEnabled = isEnabled;
|
||||
}
|
||||
|
||||
public void SetFilter(string prefix)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(prefix))
|
||||
{
|
||||
inventoryConfiguration.filter = new InventoryConfiguration.Filter();
|
||||
inventoryConfiguration.filter.prefix = prefix;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetDestination(string format, string accountId, string bucket, string region, string prefix)
|
||||
{
|
||||
if (format != null) inventoryConfiguration.destination.cosBucketDestination.format = format;
|
||||
if (accountId != null) inventoryConfiguration.destination.cosBucketDestination.accountId = accountId;
|
||||
if (bucket != null && region != null)
|
||||
{
|
||||
inventoryConfiguration.destination.cosBucketDestination.bucket = "qcs::cos:" + region
|
||||
+ "::" + bucket;
|
||||
}
|
||||
if (prefix != null) inventoryConfiguration.destination.cosBucketDestination.prefix = prefix;
|
||||
}
|
||||
|
||||
public void enableSSE() {
|
||||
inventoryConfiguration.destination.cosBucketDestination.encryption = new InventoryConfiguration.Encryption();
|
||||
inventoryConfiguration.destination.cosBucketDestination.encryption.sSECOS = ""; //默认不填
|
||||
}
|
||||
|
||||
public void SetScheduleFrequency(String frequency)
|
||||
{
|
||||
if (frequency != null)
|
||||
{
|
||||
inventoryConfiguration.schedule.frequency = frequency;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetOptionalFields(string field)
|
||||
{
|
||||
if (field != null)
|
||||
{
|
||||
if (inventoryConfiguration.optionalFields == null)
|
||||
{
|
||||
inventoryConfiguration.optionalFields = new InventoryConfiguration.OptionalFields();
|
||||
inventoryConfiguration.optionalFields.fields = new List<string>(6);
|
||||
}
|
||||
inventoryConfiguration.optionalFields.fields.Add(field);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetIncludedObjectVersions(string includedObjectVersions)
|
||||
{
|
||||
if (includedObjectVersions != null)
|
||||
{
|
||||
inventoryConfiguration.includedObjectVersions = includedObjectVersions;
|
||||
}
|
||||
}
|
||||
|
||||
public override Network.RequestBody GetRequestBody()
|
||||
{
|
||||
string content = Transfer.XmlBuilder.BuildInventoryConfiguration(inventoryConfiguration);
|
||||
byte[] data = Encoding.UTF8.GetBytes(content);
|
||||
ByteRequestBody body = new ByteRequestBody(data);
|
||||
return body;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
10
COSXML/Model/Bucket/PutBucketInventoryResult.cs
Normal file
10
COSXML/Model/Bucket/PutBucketInventoryResult.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class PutBucketInventoryResult : CosResult
|
||||
{
|
||||
}
|
||||
}
|
||||
69
COSXML/Model/Bucket/PutBucketLifecycleRequest.cs
Normal file
69
COSXML/Model/Bucket/PutBucketLifecycleRequest.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Network;
|
||||
using COSXML.CosException;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 设置 Bucket 生命周期
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/8280"/>
|
||||
/// </summary>
|
||||
public sealed class PutBucketLifecycleRequest : BucketRequest
|
||||
{
|
||||
private LifecycleConfiguration lifecycleConfiguration;
|
||||
|
||||
public PutBucketLifecycleRequest(string bucket)
|
||||
: base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.PUT;
|
||||
this.queryParameters.Add("lifecycle", null);
|
||||
lifecycleConfiguration = new LifecycleConfiguration();
|
||||
lifecycleConfiguration.rules = new List<LifecycleConfiguration.Rule>();
|
||||
this.needMD5 = true;
|
||||
}
|
||||
|
||||
public override Network.RequestBody GetRequestBody()
|
||||
{
|
||||
string content = Transfer.XmlBuilder.BuildLifecycleConfiguration(lifecycleConfiguration);
|
||||
byte[] data = Encoding.UTF8.GetBytes(content);
|
||||
ByteRequestBody body = new ByteRequestBody(data);
|
||||
return body;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置生命周期规则
|
||||
/// <see cref="Model.Tag.LifecycleConfiguration.Rule"/>
|
||||
/// </summary>
|
||||
/// <param name="rule"></param>
|
||||
public void SetRule(LifecycleConfiguration.Rule rule)
|
||||
{
|
||||
if(rule != null)
|
||||
{
|
||||
lifecycleConfiguration.rules.Add(rule);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 设置生命周期规则
|
||||
/// <see cref="Model.Tag.LifecycleConfiguration.Rule"/>
|
||||
/// </summary>
|
||||
/// <param name="rules"></param>
|
||||
public void SetRules(List<LifecycleConfiguration.Rule> rules)
|
||||
{
|
||||
if (rules != null)
|
||||
{
|
||||
lifecycleConfiguration.rules.AddRange(rules);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CheckParameters()
|
||||
{
|
||||
base.CheckParameters();
|
||||
if (lifecycleConfiguration.rules.Count == 0) throw new CosClientException((int)CosClientError.INVALID_ARGUMENT, "lifecycleConfiguration.rules.Count = 0");
|
||||
}
|
||||
}
|
||||
}
|
||||
16
COSXML/Model/Bucket/PutBucketLifecycleResult.cs
Normal file
16
COSXML/Model/Bucket/PutBucketLifecycleResult.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 设置 Bucket 生命周期的返回结果
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/8280"/>
|
||||
/// </summary>
|
||||
public sealed class PutBucketLifecycleResult : CosResult
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
39
COSXML/Model/Bucket/PutBucketLoggingRequest.cs
Normal file
39
COSXML/Model/Bucket/PutBucketLoggingRequest.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using COSXML.Common;
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Network;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class PutBucketLoggingRequest : BucketRequest
|
||||
{
|
||||
private BucketLoggingStatus bucketLoggingStatus;
|
||||
public PutBucketLoggingRequest(string bucket):base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.PUT;
|
||||
this.queryParameters.Add("logging", null);
|
||||
this.bucketLoggingStatus = new BucketLoggingStatus();
|
||||
}
|
||||
|
||||
public void SetTarget(string targetBucket, string targetPrefix)
|
||||
{
|
||||
if (targetPrefix == null && targetPrefix == null) return;
|
||||
if (bucketLoggingStatus.loggingEnabled == null)
|
||||
{
|
||||
bucketLoggingStatus.loggingEnabled = new BucketLoggingStatus.LoggingEnabled();
|
||||
}
|
||||
if(targetBucket != null) bucketLoggingStatus.loggingEnabled.targetBucket = targetBucket;
|
||||
if(targetPrefix != null) bucketLoggingStatus.loggingEnabled.targetPrefix = targetPrefix;
|
||||
}
|
||||
|
||||
public override Network.RequestBody GetRequestBody()
|
||||
{
|
||||
string content = Transfer.XmlBuilder.BuildBucketLogging(bucketLoggingStatus);
|
||||
byte[] data = Encoding.UTF8.GetBytes(content);
|
||||
ByteRequestBody body = new ByteRequestBody(data);
|
||||
return body;
|
||||
}
|
||||
}
|
||||
}
|
||||
10
COSXML/Model/Bucket/PutBucketLoggingResult.cs
Normal file
10
COSXML/Model/Bucket/PutBucketLoggingResult.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class PutBucketLoggingResult : CosResult
|
||||
{
|
||||
}
|
||||
}
|
||||
18
COSXML/Model/Bucket/PutBucketPolicyRequest.cs
Normal file
18
COSXML/Model/Bucket/PutBucketPolicyRequest.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using COSXML.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class PutBucketPolicyRequest : BucketRequest
|
||||
{
|
||||
public PutBucketPolicyRequest(string bucket)
|
||||
: base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.PUT;
|
||||
this.queryParameters.Add("policy ", null);
|
||||
this.needMD5 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
10
COSXML/Model/Bucket/PutBucketPolicyResult.cs
Normal file
10
COSXML/Model/Bucket/PutBucketPolicyResult.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class PutBucketPolicyResult : CosResult
|
||||
{
|
||||
}
|
||||
}
|
||||
100
COSXML/Model/Bucket/PutBucketReplicationRequest.cs
Normal file
100
COSXML/Model/Bucket/PutBucketReplicationRequest.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Network;
|
||||
using COSXML.CosException;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public sealed class PutBucketReplicationRequest : BucketRequest
|
||||
{
|
||||
private ReplicationConfiguration replicationConfiguration;
|
||||
|
||||
public PutBucketReplicationRequest(string bucket)
|
||||
: base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.PUT;
|
||||
this.needMD5 = true;
|
||||
this.queryParameters.Add("replication", null);
|
||||
replicationConfiguration = new ReplicationConfiguration();
|
||||
replicationConfiguration.rules = new List<ReplicationConfiguration.Rule>();
|
||||
}
|
||||
|
||||
public override Network.RequestBody GetRequestBody()
|
||||
{
|
||||
string content = Transfer.XmlBuilder.BuildReplicationConfiguration(replicationConfiguration);
|
||||
byte[] data = Encoding.UTF8.GetBytes(content);
|
||||
ByteRequestBody body = new ByteRequestBody(data);
|
||||
return body;
|
||||
}
|
||||
|
||||
public void SetReplicationConfiguration(string ownerUin, string subUin, List<RuleStruct> ruleStructs)
|
||||
{
|
||||
SetReplicationConfigurationWithRole(ownerUin, subUin);
|
||||
if (ruleStructs != null)
|
||||
{
|
||||
foreach (RuleStruct ruleStruct in ruleStructs)
|
||||
{
|
||||
SetReplicationConfigurationWithRule(ruleStruct);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetReplicationConfigurationWithRole(string ownerUin, string subUin)
|
||||
{
|
||||
if (ownerUin != null && subUin != null)
|
||||
{
|
||||
string role = "qcs::cam::uin/" + ownerUin + ":uin/" + subUin;
|
||||
replicationConfiguration.role = role;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetReplicationConfigurationWithRule(RuleStruct ruleStruct)
|
||||
{
|
||||
if (ruleStruct != null)
|
||||
{
|
||||
ReplicationConfiguration.Rule rule = new ReplicationConfiguration.Rule();
|
||||
rule.id = ruleStruct.id;
|
||||
rule.status = ruleStruct.isEnable ? "Enabled" : "Disabled";
|
||||
rule.prefix = ruleStruct.prefix;
|
||||
ReplicationConfiguration.Destination destination = new ReplicationConfiguration.Destination();
|
||||
destination.storageClass = ruleStruct.storageClass;
|
||||
string bucketName = ruleStruct.bucket;
|
||||
if (ruleStruct.bucket.EndsWith("-" + ruleStruct.appid))
|
||||
{
|
||||
bucketName = ruleStruct.bucket.Replace("-" + ruleStruct.appid, "");
|
||||
}
|
||||
StringBuilder bucket = new StringBuilder();
|
||||
bucket.Append("qcs:id/0:cos:").Append(ruleStruct.region).Append(":appid/")
|
||||
.Append(ruleStruct.appid).Append(":").Append(bucketName);
|
||||
destination.bucket = bucket.ToString();
|
||||
rule.destination = destination;
|
||||
replicationConfiguration.rules.Add(rule);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CheckParameters()
|
||||
{
|
||||
base.CheckParameters();
|
||||
if (replicationConfiguration.rules.Count == 0) throw new CosClientException((int)CosClientError.INVALID_ARGUMENT, "replicationConfiguration.rules.Count = 0");
|
||||
}
|
||||
|
||||
public sealed class RuleStruct
|
||||
{
|
||||
public string appid;
|
||||
public string region;
|
||||
public string bucket;
|
||||
public string storageClass;
|
||||
public string id;
|
||||
public string prefix;
|
||||
public bool isEnable;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
12
COSXML/Model/Bucket/PutBucketReplicationResult.cs
Normal file
12
COSXML/Model/Bucket/PutBucketReplicationResult.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class PutBucketReplicationResult : CosResult
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
87
COSXML/Model/Bucket/PutBucketRequest.cs
Normal file
87
COSXML/Model/Bucket/PutBucketRequest.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
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 cref="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 cref="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 cref="Common.CosACL"/>
|
||||
/// </summary>
|
||||
/// <param name="cosACL"></param>
|
||||
public void SetCosACL(CosACL cosACL)
|
||||
{
|
||||
SetRequestHeader(CosRequestHeaderKey.X_COS_ACL, EnumUtils.GetValue(cosACL));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 赋予被授权者读的权限
|
||||
/// <see cref="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 cref="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 cref="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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
COSXML/Model/Bucket/PutBucketResult.cs
Normal file
15
COSXML/Model/Bucket/PutBucketResult.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建 Bucket 返回的结果
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/7738"/>
|
||||
/// </summary>
|
||||
public sealed class PutBucketResult : CosResult
|
||||
{
|
||||
}
|
||||
}
|
||||
40
COSXML/Model/Bucket/PutBucketTaggingRequest.cs
Normal file
40
COSXML/Model/Bucket/PutBucketTaggingRequest.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
using COSXML.Common;
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Network;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
/// <summary>
|
||||
/// 检索 Bucket 是否存在
|
||||
/// <see cref="https://cloud.tencent.com/document/product/436/7735"/>
|
||||
/// </summary>
|
||||
public sealed class PutBucketTaggingRequest : BucketRequest
|
||||
{
|
||||
private Tagging tagging;
|
||||
|
||||
public PutBucketTaggingRequest(string bucket)
|
||||
: base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.PUT;
|
||||
this.tagging = new Tagging();
|
||||
this.IsNeedMD5 = true;
|
||||
this.queryParameters.Add("tagging", null);
|
||||
}
|
||||
|
||||
public void AddTag(string key, string value) {
|
||||
this.tagging.AddTag(key, value);
|
||||
}
|
||||
|
||||
|
||||
public override Network.RequestBody GetRequestBody()
|
||||
{
|
||||
string content = Transfer.XmlBuilder.BuildTagging(tagging);
|
||||
byte[] data = Encoding.UTF8.GetBytes(content);
|
||||
ByteRequestBody body = new ByteRequestBody(data);
|
||||
return body;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
COSXML/Model/Bucket/PutBucketTaggingResult.cs
Normal file
11
COSXML/Model/Bucket/PutBucketTaggingResult.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class PutBucketTaggingResult : CosResult
|
||||
{
|
||||
}
|
||||
}
|
||||
44
COSXML/Model/Bucket/PutBucketVersioningRequest.cs
Normal file
44
COSXML/Model/Bucket/PutBucketVersioningRequest.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
using COSXML.Common;
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Network;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class PutBucketVersioningRequest : BucketRequest
|
||||
{
|
||||
private VersioningConfiguration versioningConfiguration;
|
||||
|
||||
public PutBucketVersioningRequest(string bucket)
|
||||
: base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.PUT;
|
||||
this.queryParameters.Add("versioning", null);
|
||||
versioningConfiguration = new VersioningConfiguration();
|
||||
}
|
||||
|
||||
public override Network.RequestBody GetRequestBody()
|
||||
{
|
||||
string content = Transfer.XmlBuilder.BuildVersioningConfiguration(versioningConfiguration);
|
||||
byte[] data = Encoding.UTF8.GetBytes(content);
|
||||
ByteRequestBody body = new ByteRequestBody(data);
|
||||
return body;
|
||||
}
|
||||
|
||||
|
||||
public void IsEnableVersionConfig(bool isEnable)
|
||||
{
|
||||
if (isEnable)
|
||||
{
|
||||
versioningConfiguration.status = "Enabled";
|
||||
}
|
||||
else
|
||||
{
|
||||
versioningConfiguration.status = "Suspended";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
COSXML/Model/Bucket/PutBucketVersioningResult.cs
Normal file
11
COSXML/Model/Bucket/PutBucketVersioningResult.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class PutBucketVersioningResult : CosResult
|
||||
{
|
||||
}
|
||||
}
|
||||
69
COSXML/Model/Bucket/PutBucketWebsiteRequest.cs
Normal file
69
COSXML/Model/Bucket/PutBucketWebsiteRequest.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
|
||||
|
||||
using COSXML.Common;
|
||||
using COSXML.Model.Tag;
|
||||
using COSXML.Network;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class PutBucketWebsiteRequest:BucketRequest
|
||||
{
|
||||
private WebsiteConfiguration websiteConfiguration;
|
||||
|
||||
public PutBucketWebsiteRequest(string bucket) : base(bucket)
|
||||
{
|
||||
this.method = CosRequestMethod.PUT;
|
||||
this.queryParameters.Add("website", null);
|
||||
websiteConfiguration = new WebsiteConfiguration();
|
||||
}
|
||||
|
||||
public void SetIndexDocument(string suffix)
|
||||
{
|
||||
if (suffix != null)
|
||||
{
|
||||
if (websiteConfiguration.indexDocument == null) websiteConfiguration.indexDocument = new WebsiteConfiguration.IndexDocument();
|
||||
websiteConfiguration.indexDocument.suffix = suffix;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetErrorDocument(string key)
|
||||
{
|
||||
if (key != null)
|
||||
{
|
||||
if (websiteConfiguration.errorDocument == null) websiteConfiguration.errorDocument = new WebsiteConfiguration.ErrorDocument();
|
||||
websiteConfiguration.errorDocument.key = key;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetRedirectAllRequestTo(string protocol)
|
||||
{
|
||||
if (protocol != null)
|
||||
{
|
||||
if (websiteConfiguration.redirectAllRequestTo == null) websiteConfiguration.redirectAllRequestTo = new WebsiteConfiguration.RedirectAllRequestTo();
|
||||
websiteConfiguration.redirectAllRequestTo.protocol = protocol;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetRoutingRules(List<WebsiteConfiguration.RoutingRule> rules)
|
||||
{
|
||||
if (rules != null && rules.Count > 0)
|
||||
{
|
||||
if (websiteConfiguration.routingRules == null) websiteConfiguration.routingRules = new List<WebsiteConfiguration.RoutingRule>();
|
||||
foreach (WebsiteConfiguration.RoutingRule rule in rules)
|
||||
{
|
||||
websiteConfiguration.routingRules.Add(rule);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override Network.RequestBody GetRequestBody()
|
||||
{
|
||||
string content = Transfer.XmlBuilder.BuildWebsiteConfiguration(websiteConfiguration);
|
||||
byte[] data = Encoding.UTF8.GetBytes(content);
|
||||
ByteRequestBody body = new ByteRequestBody(data);
|
||||
return body;
|
||||
}
|
||||
}
|
||||
}
|
||||
9
COSXML/Model/Bucket/PutBucketWebsiteResult.cs
Normal file
9
COSXML/Model/Bucket/PutBucketWebsiteResult.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
namespace COSXML.Model.Bucket
|
||||
{
|
||||
public sealed class PutBucketWebsiteResult : CosResult
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user