代码修改后的版本,全部提交
This commit is contained in:
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user