1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- /*
- * Copyright (C) Alibaba Cloud Computing
- * All rights reserved.
- *
- * 版权所有 (C)阿里云计算有限公司
- */
- using System;
- using System.Collections.Generic;
- using System.IO;
- using Aliyun.OSS.Common.Communication;
- using Aliyun.OSS.Util;
- using Aliyun.OSS.Transform;
- namespace Aliyun.OSS.Commands
- {
- internal class SetBucketCorsCommand : OssCommand
- {
- private readonly string _bucketName;
- private readonly SetBucketCorsRequest _setBucketCorsRequest;
- protected override HttpMethod Method
- {
- get { return HttpMethod.Put; }
- }
- protected override string Bucket
- {
- get
- {
- return _bucketName;
- }
- }
- protected override Stream Content
- {
- get
- {
- return SerializerFactory.GetFactory().CreateSetBucketCorsRequestSerializer()
- .Serialize(_setBucketCorsRequest);
- }
- }
- private SetBucketCorsCommand(IServiceClient client, Uri endpoint, ExecutionContext context,
- string bucketName, SetBucketCorsRequest setBucketCorsRequest)
- : base(client, endpoint, context)
- {
- OssUtils.CheckBucketName(bucketName);
- _bucketName = bucketName;
- _setBucketCorsRequest = setBucketCorsRequest;
- }
- public static SetBucketCorsCommand Create(IServiceClient client, Uri endpoint,
- ExecutionContext context,
- string bucketName, SetBucketCorsRequest setBucketCorsRequest)
- {
- return new SetBucketCorsCommand(client, endpoint, context, bucketName, setBucketCorsRequest);
- }
- protected override IDictionary<string, string> Parameters
- {
- get
- {
- return new Dictionary<string, string>()
- {
- { RequestParameters.SUBRESOURCE_CORS, null }
- };
- }
- }
- }
- }
|