private CreateBucketCommand(IServiceClient client, Uri endpoint, ExecutionContext context,
                             string bucketName)
     : base(client, endpoint, context)
 {
     OssUtils.CheckBucketName(bucketName);
     _bucketName = bucketName;
 }
예제 #2
0
 public ServiceResponse Send(ServiceRequest request, ExecutionContext context)
 {
     SignRequest(request, context);
     var response = SendCore(request, context);
     HandleResponse(response, context.ResponseHandlers);
     return response;
 }
 private AbortMultipartUploadCommand(IServiceClient client, Uri endpoint, ExecutionContext context, 
                                     AbortMultipartUploadRequest abortMultipartUploadRequest)
     : base(client, endpoint, context)
     
 {
     _abortMultipartUploadRequest = abortMultipartUploadRequest;
 }
 private SetObjectAclCommand(IServiceClient client, Uri endpoint, 
                             ExecutionContext context,
                             SetObjectAclRequest request)
     : base(client, endpoint, context)
 {
     _request = request;
 }
 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);
 }
        private SetBucketAclCommand(IServiceClient client, Uri endpoint, ExecutionContext context,
                                    string bucketName, SetBucketAclRequest request)
            : base(client, endpoint, context)
        {
            OssUtils.CheckBucketName(bucketName);

            _bucketName = bucketName;
            _request = request;
        }
        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;
        }
 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);
 }
        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;
        }
 public ExecutionContext Build()
 {
     var context = new ExecutionContext
     {
         Signer = CreateSigner(Bucket, Key), 
         Credentials = Credentials
     };
     foreach(var h in ResponseHandlers)
     {
         context.ResponseHandlers.Add(h);
     }
     return context;
 }
        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
 protected abstract ServiceResponse SendCore(ServiceRequest request, ExecutionContext context);
예제 #17
0
 public static SetBucketAclCommand Create(IServiceClient client, Uri endpoint, 
                                          ExecutionContext context,
                                          string bucketName, SetBucketAclRequest request)
 {
     return new SetBucketAclCommand(client, endpoint, context, bucketName, request);
 }
예제 #18
0
 private static void SignRequest(ServiceRequest request, ExecutionContext context)
 {
     if (context.Signer != null)
         context.Signer.Sign(request, context.Credentials);
 }
예제 #19
0
 public static CreateBucketCommand Create(IServiceClient client, Uri endpoint,
                                          ExecutionContext context,
                                          string bucketName)
 {
     return new CreateBucketCommand(client, endpoint, context, bucketName);
 }
 public ServiceResponse Send(ServiceRequest request, ExecutionContext context)
 {
     return(SendImpl(request, context, 0));
 }