コード例 #1
0
 public ServiceResponse Send(ServiceRequest request, ExecutionContext context)
 {
     SignRequest(request, context);
     var response = SendCore(request, context);
     HandleResponse(response, context.ResponseHandlers);
     return response;
 }
コード例 #2
0
 private SetObjectAclCommand(IServiceClient client, Uri endpoint, 
                             ExecutionContext context,
                             SetObjectAclRequest request)
     : base(client, endpoint, context)
 {
     _request = request;
 }
コード例 #3
0
 private AbortMultipartUploadCommand(IServiceClient client, Uri endpoint, ExecutionContext context, 
                                     AbortMultipartUploadRequest abortMultipartUploadRequest)
     : base(client, endpoint, context)
     
 {
     _abortMultipartUploadRequest = abortMultipartUploadRequest;
 }
コード例 #4
0
 private CreateBucketCommand(IServiceClient client, Uri endpoint, ExecutionContext context,
                             string bucketName)
     : base(client, endpoint, context)
 {
     OssUtils.CheckBucketName(bucketName);
     _bucketName = bucketName;
 }
コード例 #5
0
 public static SetObjectAclCommand Create(IServiceClient client, Uri endpoint, 
                                          ExecutionContext context,
                                          SetObjectAclRequest request)
 {
     OssUtils.CheckBucketName(request.BucketName);
     OssUtils.CheckObjectKey(request.Key);
     return new SetObjectAclCommand(client, endpoint, context, request);
 }
コード例 #6
0
        private SetBucketAclCommand(IServiceClient client, Uri endpoint, ExecutionContext context,
                                    string bucketName, SetBucketAclRequest request)
            : base(client, endpoint, context)
        {
            OssUtils.CheckBucketName(bucketName);

            _bucketName = bucketName;
            _request = request;
        }
コード例 #7
0
        private DeleteObjectCommand(IServiceClient client, Uri endpoint, ExecutionContext context,
                                    string bucketName, string key)
            : base(client, endpoint, context)
        {
            OssUtils.CheckBucketName(bucketName);
            OssUtils.CheckObjectKey(key);

            _bucketName = bucketName;
            _key = key;
        }
コード例 #8
0
 public static AbortMultipartUploadCommand Create(IServiceClient client, Uri endpoint, ExecutionContext context,
                                          AbortMultipartUploadRequest abortMultipartUploadRequest)
 {
     OssUtils.CheckBucketName(abortMultipartUploadRequest.BucketName);
     OssUtils.CheckObjectKey(abortMultipartUploadRequest.Key);
     
     if (string.IsNullOrEmpty(abortMultipartUploadRequest.UploadId))
         throw new ArgumentException(Resources.ExceptionIfArgumentStringIsNullOrEmpty, "uploadId");          
     
     return new AbortMultipartUploadCommand(client, endpoint, context, abortMultipartUploadRequest);
 }
コード例 #9
0
 public ExecutionContext Build()
 {
     var context = new ExecutionContext
     {
         Signer = CreateSigner(Bucket, Key), 
         Credentials = Credentials
     };
     foreach(var h in ResponseHandlers)
     {
         context.ResponseHandlers.Add(h);
     }
     return context;
 }
コード例 #10
0
        private SetBucketLoggingCommand(IServiceClient client, Uri endpoint, ExecutionContext context,
                                    string bucketName, SetBucketLoggingRequest setBucketLoggingRequest)
            : base(client, endpoint, context)
        {
            OssUtils.CheckBucketName(setBucketLoggingRequest.BucketName);
            OssUtils.CheckBucketName(setBucketLoggingRequest.TargetBucket);

            if (!OssUtils.IsLoggingPrefixValid(setBucketLoggingRequest.TargetPrefix))
                throw new ArgumentException("Invalid logging prefix " + setBucketLoggingRequest.TargetPrefix);

            _bucketName = bucketName;
            _setBucketLoggingRequest = setBucketLoggingRequest;
        }
コード例 #11
0
        private SetBucketWebsiteCommand(IServiceClient client, Uri endpoint, ExecutionContext context,
                                       string bucketName, SetBucketWebsiteRequest setBucketWebsiteRequest)
            : base(client, endpoint, context)
        {
            OssUtils.CheckBucketName(bucketName);
            if (string.IsNullOrEmpty(setBucketWebsiteRequest.IndexDocument))
                throw new ArgumentException("index document must not be empty");
            if (!OssUtils.IsWebpageValid(setBucketWebsiteRequest.IndexDocument))
                throw new ArgumentException("Invalid index document, must be end with .html");
            if (!string.IsNullOrEmpty(setBucketWebsiteRequest.ErrorDocument)
                && !OssUtils.IsWebpageValid(setBucketWebsiteRequest.ErrorDocument))
                throw new ArgumentException("Invalid error document, must be end with .html");

            _bucketName = bucketName;
            _setBucketWebsiteRequest = setBucketWebsiteRequest;
        }
コード例 #12
0
 public static DeleteObjectCommand Create(IServiceClient client, Uri endpoint, ExecutionContext context,
                                          string bucketName, string key)
 {
     return new DeleteObjectCommand(client, endpoint, context, bucketName, key);
 }
コード例 #13
0
 protected abstract IAsyncResult BeginSendCore(ServiceRequest request, ExecutionContext context, 
     AsyncCallback callback, Object state);
コード例 #14
0
 public IAsyncResult BeginSend(ServiceRequest request, ExecutionContext context, 
     AsyncCallback callback, object state)
 {
     SignRequest(request, context);
     return BeginSendCore(request, context, callback, state);
 }
コード例 #15
0
 protected OssCommand(IServiceClient client, Uri endpoint, ExecutionContext context)
 {
     Client = client;
     Endpoint = endpoint;
     Context = context;
 }
コード例 #16
0
 public static SetBucketAclCommand Create(IServiceClient client, Uri endpoint, 
                                          ExecutionContext context,
                                          string bucketName, SetBucketAclRequest request)
 {
     return new SetBucketAclCommand(client, endpoint, context, bucketName, request);
 }
コード例 #17
0
 protected abstract ServiceResponse SendCore(ServiceRequest request, ExecutionContext context);
コード例 #18
0
 public static CreateBucketCommand Create(IServiceClient client, Uri endpoint,
                                          ExecutionContext context,
                                          string bucketName)
 {
     return new CreateBucketCommand(client, endpoint, context, bucketName);
 }
コード例 #19
0
 private static void SignRequest(ServiceRequest request, ExecutionContext context)
 {
     if (context.Signer != null)
         context.Signer.Sign(request, context.Credentials);
 }