private DeleteBucketCorsCommand(IServiceClient client, Uri endpoint, ExecutionContext context,
                             string bucketName)
     : base(client, endpoint, context)
 {
     OssUtils.CheckBucketName(bucketName);
     _bucketName = bucketName;
 }
Ejemplo n.º 2
0
 public ServiceResponse Send(ServiceRequest request, ExecutionContext context)
 {
     SignRequest(request, context);
     var response = SendCore(request, context);
     HandleResponse(response, context.ResponseHandlers);
     return response;
 }
        private SetBucketLifecycleCommand(IServiceClient client, Uri endpoint, ExecutionContext context,
                                    string bucketName, SetBucketLifecycleRequest setBucketLifecycleRequest)
            : base(client, endpoint, context)
        {
            OssUtils.CheckBucketName(bucketName);

            _bucketName = bucketName;
            _setBucketLifecycleRequest = setBucketLifecycleRequest;
        }
Ejemplo n.º 4
0
        private HeadObjectCommand(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;
        }
 public static DeleteBucketCorsCommand Create(IServiceClient client, Uri endpoint,
                                          ExecutionContext context,
                                          string bucketName)
 {
     return new DeleteBucketCorsCommand(client, endpoint, context, bucketName);
 }
Ejemplo n.º 10
0
 public IAsyncResult BeginSend(ServiceRequest request, ExecutionContext context,
                               AsyncCallback callback, object state)
 {
     SignRequest(request, context);
     return(BeginSendCore(request, context, callback, state));
 }
 public static SetBucketLifecycleCommand Create(IServiceClient client, Uri endpoint,
                                          ExecutionContext context,
                                          string bucketName, SetBucketLifecycleRequest setBucketLifecycleRequest)
 {
     return new SetBucketLifecycleCommand(client, endpoint, context, bucketName, setBucketLifecycleRequest);
 }
Ejemplo n.º 12
0
 protected abstract ServiceResponse SendCore(ServiceRequest request, ExecutionContext context);
Ejemplo n.º 13
0
 public static HeadObjectCommand Create(IServiceClient client, Uri endpoint,
                                          ExecutionContext context,
                                          string bucketName, string key)
 {
     return new HeadObjectCommand(client, endpoint, context, bucketName, key);
 }
Ejemplo n.º 14
0
 protected OssCommand(IServiceClient client, Uri endpoint, ExecutionContext context)
 {
     Client = client;
     Endpoint = endpoint;
     Context = context;
 }
Ejemplo n.º 15
0
 protected abstract IAsyncResult BeginSendCore(ServiceRequest request, ExecutionContext context,
                                               AsyncCallback callback, Object state);
Ejemplo n.º 16
0
 protected abstract IAsyncResult BeginSendCore(ServiceRequest request, ExecutionContext context, 
     AsyncCallback callback, Object state);
 private AbortMultipartUploadCommand(IServiceClient client, Uri endpoint, ExecutionContext context, 
                                         AbortMultipartUploadRequest abortMultipartUploadRequest)
     : base(client, endpoint, context)
 {
     _abortMultipartUploadRequest = abortMultipartUploadRequest;
 }
Ejemplo n.º 18
0
 public IAsyncResult BeginSend(ServiceRequest request, ExecutionContext context, 
     AsyncCallback callback, object state)
 {
     SignRequest(request, context);
     return BeginSendCore(request, context, callback, state);
 }
Ejemplo n.º 19
0
 private static void SignRequest(ServiceRequest request, ExecutionContext context)
 {
     if (context.Signer != null)
         context.Signer.Sign(request, context.Credentials);
 }
Ejemplo n.º 20
0
 protected abstract ServiceResponse SendCore(ServiceRequest request, ExecutionContext context);