public static UploadPartCommand Create(IServiceClient client, Uri endpoint, ExecutionContext context, UploadPartRequest uploadPartRequest) { OssUtils.CheckBucketName(uploadPartRequest.BucketName); OssUtils.CheckObjectKey(uploadPartRequest.Key); if (string.IsNullOrEmpty(uploadPartRequest.UploadId)) { throw new ArgumentException("uploadId should be specified"); } if (!uploadPartRequest.PartNumber.HasValue) { throw new ArgumentException("partNumber should be specified"); } if (!uploadPartRequest.PartSize.HasValue) { throw new ArgumentException("partSize should be specified"); } if (uploadPartRequest.InputStream == null) { throw new ArgumentException("inputStream should be specified"); } if (uploadPartRequest.PartSize < 0 || uploadPartRequest.PartSize > OssUtils.MaxFileSize) { throw new ArgumentException("partSize not live in valid range"); } if (!OssUtils.IsPartNumberInRange(uploadPartRequest.PartNumber)) { throw new ArgumentException("partNumber not live in valid range"); } var conf = OssUtils.GetClientConfiguration(client); var originalStream = uploadPartRequest.InputStream; var streamLength = uploadPartRequest.PartSize.Value; // wrap input stream in PartialWrapperStream originalStream = new PartialWrapperStream(originalStream, streamLength); // setup progress var callback = uploadPartRequest.StreamTransferProgress; if (callback != null) { originalStream = OssUtils.SetupProgressListeners(originalStream, conf.ProgressUpdateInterval, client, callback); uploadPartRequest.InputStream = originalStream; } // wrap input stream in MD5Stream if (conf.EnalbeMD5Check) { var hashStream = new MD5Stream(originalStream, null, streamLength); uploadPartRequest.InputStream = hashStream; context.ResponseHandlers.Add(new MD5DigestCheckHandler(hashStream)); } return(new UploadPartCommand(client, endpoint, context, DeserializerFactory.GetFactory().CreateUploadPartResultDeserializer(uploadPartRequest.PartNumber.Value), uploadPartRequest)); }
public static PostVodPlaylistCommand Create(IServiceClient client, Uri endpoint, ExecutionContext context, PostVodPlaylistRequest request) { OssUtils.CheckBucketName(request.BucketName); return(new PostVodPlaylistCommand(client, endpoint, context, request)); }
private CompleteBucketWormCommand(IServiceClient client, Uri endpoint, ExecutionContext context, CompleteBucketWormRequest request) : base(client, endpoint, context) { OssUtils.CheckBucketName(request.BucketName); _request = request; }
private SetBucketEncryptionCommand(IServiceClient client, Uri endpoint, ExecutionContext context, SetBucketEncryptionRequest request) : base(client, endpoint, context) { OssUtils.CheckBucketName(request.BucketName); _request = request; }
public static CompleteMultipartUploadCommand Create(IServiceClient client, Uri endpoint, ExecutionContext context, CompleteMultipartUploadRequest completeMultipartUploadRequest) { OssUtils.CheckBucketName(completeMultipartUploadRequest.BucketName); OssUtils.CheckObjectKey(completeMultipartUploadRequest.Key); if (string.IsNullOrEmpty(completeMultipartUploadRequest.UploadId)) { throw new ArgumentException("The parameter is empty or null.", "uploadId"); } // handle upload callback error 203 if (completeMultipartUploadRequest.IsCallbackRequest()) { context.ResponseHandlers.Add(new CallbackResponseHandler()); } var conf = OssUtils.GetClientConfiguration(client); if (conf.EnableCrcCheck) { context.ResponseHandlers.Add(new CompleteMultipartUploadCrc64Handler(completeMultipartUploadRequest)); } return(new CompleteMultipartUploadCommand(client, endpoint, context, DeserializerFactory.GetFactory().CreateCompleteUploadResultDeserializer(completeMultipartUploadRequest), completeMultipartUploadRequest)); }
private GetBucketLoggingCommand(IServiceClient client, Uri endpoint, ExecutionContext context, string bucketName, IDeserializer <ServiceResponse, BucketLoggingResult> deserializer) : base(client, endpoint, context, deserializer) { OssUtils.CheckBucketName(bucketName); _bucketName = bucketName; }
private DeleteBucketInventoryConfigurationCommand(IServiceClient client, Uri endpoint, ExecutionContext context, DeleteBucketInventoryConfigurationRequest request) : base(client, endpoint, context) { OssUtils.CheckBucketName(request.BucketName); _request = request; }
public static UploadPartCopyCommand Create(IServiceClient client, Uri endpoint, ExecutionContext context, UploadPartCopyRequest uploadPartCopyRequest) { OssUtils.CheckBucketName(uploadPartCopyRequest.SourceBucket); OssUtils.CheckObjectKey(uploadPartCopyRequest.SourceKey); OssUtils.CheckBucketName(uploadPartCopyRequest.TargetBucket); OssUtils.CheckObjectKey(uploadPartCopyRequest.TargetKey); if (!uploadPartCopyRequest.PartNumber.HasValue) { throw new ArgumentException("partNumber should be specfied"); } if (!uploadPartCopyRequest.PartSize.HasValue) { throw new ArgumentException("partSize should be specfied"); } if (!uploadPartCopyRequest.BeginIndex.HasValue) { throw new ArgumentException("beginIndex should be specfied"); } if (uploadPartCopyRequest.PartSize < 0 || uploadPartCopyRequest.PartSize > OssUtils.MaxFileSize) { throw new ArgumentException("partSize not live in valid range"); } if (!OssUtils.IsPartNumberInRange(uploadPartCopyRequest.PartNumber)) { throw new ArgumentException("partNumber not live in valid range"); } return(new UploadPartCopyCommand(client, endpoint, context, DeserializerFactory.GetFactory().CreateUploadPartCopyResultDeserializer(uploadPartCopyRequest.PartNumber.Value), uploadPartCopyRequest)); }
public static DeleteLiveChannelCommand Create(IServiceClient client, Uri endpoint, ExecutionContext context, DeleteLiveChannelRequest request) { OssUtils.CheckBucketName(request.BucketName); return(new DeleteLiveChannelCommand(client, endpoint, context, request)); }
private DeleteBucketWebsiteCommand(IServiceClient client, Uri endpoint, ExecutionContext context, string bucketName) : base(client, endpoint, context) { OssUtils.CheckBucketName(bucketName); _bucketName = bucketName; }
private GetBucketLifecycleCommand(IServiceClient client, Uri endpoint, ExecutionContext context, string bucketName, IDeserializer <ServiceResponse, IList <LifecycleRule> > deserializer) : base(client, endpoint, context, deserializer) { OssUtils.CheckBucketName(bucketName); _bucketName = bucketName; }
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)); }
public static DeleteObjectTaggingCommand Create(IServiceClient client, Uri endpoint, ExecutionContext context, DeleteObjectTaggingRequest request) { OssUtils.CheckBucketName(request.BucketName); OssUtils.CheckObjectKey(request.Key); return(new DeleteObjectTaggingCommand(client, endpoint, context, request)); }
private SetBucketLifecycleCommand(IServiceClient client, Uri endpoint, ExecutionContext context, string bucketName, SetBucketLifecycleRequest setBucketLifecycleRequest) : base(client, endpoint, context) { OssUtils.CheckBucketName(bucketName); _bucketName = bucketName; _setBucketLifecycleRequest = setBucketLifecycleRequest; }
private CreateBucketCommand(IServiceClient client, Uri endpoint, ExecutionContext context, string bucketName, StorageClass?storageClass) : base(client, endpoint, context) { OssUtils.CheckBucketName(bucketName); _bucketName = bucketName; StorageClass = storageClass; }
/// <summary> /// Creates a new instance of <see cref="GenerateRtmpPresignedUriRequest" />. /// </summary> /// <param name="bucketName">bucket name</param> /// <param name="channelName">object key</param> public GenerateRtmpPresignedUriRequest(string bucketName, string channelName, string playlistName) { OssUtils.CheckBucketName(bucketName); BucketName = bucketName; ChannelName = channelName; PlaylistName = playlistName; Expiration = DateTime.Now.AddMinutes(15); }
public static DeleteObjectsCommand Create(IServiceClient client, Uri endpoint, ExecutionContext context, DeleteObjectsRequest deleteObjectsRequest) { OssUtils.CheckBucketName(deleteObjectsRequest.BucketName); return(new DeleteObjectsCommand(client, endpoint, context, DeserializerFactory.GetFactory().CreateDeleteObjectsResultDeserializer(), deleteObjectsRequest)); }
private ListBucketInventoryConfigurationCommand(IServiceClient client, Uri endpoint, ExecutionContext context, ListBucketInventoryConfigurationRequest request, IDeserializer <ServiceResponse, ListBucketInventoryConfigurationResult> deserializer) : base(client, endpoint, context, deserializer) { OssUtils.CheckBucketName(request.BucketName); _request = request; }
private ListMultipartUploadsCommand(IServiceClient client, Uri endpoint, ExecutionContext context, IDeserializer <ServiceResponse, MultipartUploadListing> deserializeMethod, ListMultipartUploadsRequest listMultipartUploadsRequest) : base(client, endpoint, context, deserializeMethod) { OssUtils.CheckBucketName(listMultipartUploadsRequest.BucketName); _listMultipartUploadsRequest = listMultipartUploadsRequest; }
private RestoreObjectCommand(IServiceClient client, Uri endpoint, ExecutionContext context, RestoreObjectRequest request, IDeserializer <ServiceResponse, RestoreObjectResult> deserializer) : base(client, endpoint, context, deserializer) { OssUtils.CheckBucketName(request.BucketName); OssUtils.CheckObjectKey(request.Key); _request = request; this.ParametersInUri = true; // in restore request, the parameter restore needs to be in uri }
public static GetObjectCommand Create(IServiceClient client, Uri endpoint, ExecutionContext context, GetObjectRequest getObjectRequest) { OssUtils.CheckBucketName(getObjectRequest.BucketName); OssUtils.CheckObjectKey(getObjectRequest.Key); return(new GetObjectCommand(client, endpoint, context, DeserializerFactory.GetFactory().CreateGetObjectResultDeserializer(getObjectRequest), getObjectRequest)); }
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; }
private GetObjectAclCommand(IServiceClient client, Uri endpoint, ExecutionContext context, GetObjectAclRequest request, IDeserializer <ServiceResponse, AccessControlList> deserializer) : base(client, endpoint, context, deserializer) { OssUtils.CheckBucketName(request.BucketName); OssUtils.CheckObjectKey(request.Key); _request = request; }
private GetSymlinkCommand(IServiceClient client, Uri endpoint, ExecutionContext context, IDeserializer <ServiceResponse, OssSymlink> deserializer, GetSymlinkRequest request) : base(client, endpoint, context, deserializer) { OssUtils.CheckBucketName(request.BucketName); OssUtils.CheckObjectKey(request.Key); _request = request; }
public static GetLiveChannelInfoCommand Create(IServiceClient client, Uri endpoint, ExecutionContext context, GetLiveChannelInfoRequest request) { OssUtils.CheckBucketName(request.BucketName); return(new GetLiveChannelInfoCommand(client, endpoint, context, DeserializerFactory.GetFactory().CreateGetLiveChannelInfoResultDeserializer(), request)); }
private SetBucketRequestPaymentCommand(IServiceClient client, Uri endpoint, ExecutionContext context, string bucketName, SetBucketRequestPaymentRequest request) : base(client, endpoint, context) { OssUtils.CheckBucketName(bucketName); _bucketName = bucketName; _request = request; }
public static CopyObjectCommand Create(IServiceClient client, Uri endpoint, ExecutionContext context, CopyObjectRequest copyObjectRequest) { OssUtils.CheckBucketName(copyObjectRequest.SourceBucketName); OssUtils.CheckObjectKey(copyObjectRequest.SourceKey); OssUtils.CheckBucketName(copyObjectRequest.DestinationBucketName); OssUtils.CheckObjectKey(copyObjectRequest.DestinationKey); return(new CopyObjectCommand(client, endpoint, context, DeserializerFactory.GetFactory().CreateCopyObjectResultDeserializer(), copyObjectRequest)); }
private InitiateBucketWormCommand(IServiceClient client, Uri endpoint, ExecutionContext context, InitiateBucketWormRequest request, IDeserializer <ServiceResponse, InitiateBucketWormResult> deserializer) : base(client, endpoint, context, deserializer) { OssUtils.CheckBucketName(request.BucketName); _request = request; }
public static InitiateMultipartUploadCommand Create(IServiceClient client, Uri endpoint, ExecutionContext context, InitiateMultipartUploadRequest initiateMultipartUploadRequest) { OssUtils.CheckBucketName(initiateMultipartUploadRequest.BucketName); OssUtils.CheckObjectKey(initiateMultipartUploadRequest.Key); return(new InitiateMultipartUploadCommand(client, endpoint, context, DeserializerFactory.GetFactory().CreateInitiateMultipartUploadResultDeserializer(), initiateMultipartUploadRequest)); }
private DeleteObjectCommand(IServiceClient client, Uri endpoint, ExecutionContext context, IDeserializer <ServiceResponse, DeleteObjectResult> deserialize, DeleteObjectRequest request) : base(client, endpoint, context, deserialize) { OssUtils.CheckBucketName(request.BucketName); OssUtils.CheckObjectKey(request.Key); _request = request; }