Пример #1
0
        public IRequest Marshall(PutBucketRequestECS putBucketRequest)
        {
            var marshaller = new PutBucketRequestMarshaller();
            var request    = marshaller.Marshall(putBucketRequest);

            if (putBucketRequest.EnableFileSystem)
            {
                request.Headers.Add(COMMON.EMC_FS_ENABLED, "true");
            }
            if (putBucketRequest.StaleReadAllowed)
            {
                request.Headers.Add(COMMON.EMC_STALE_READ_ALLOWED, "true");
            }
            if (putBucketRequest.EnableCompliance)
            {
                request.Headers.Add(COMMON.EMC_COMPLIANCE_ENABLED, "true");
            }
            if (putBucketRequest.EnableServerSideEncryption)
            {
                request.Headers.Add(COMMON.EMC_DARE_ENABLED, "true");
            }
            if (putBucketRequest.IsSetNamespace())
            {
                request.Headers.Add(COMMON.EMC_NAMESPACE, ECSTransforms.ToStringValue(putBucketRequest.Namespace));
            }
            if (putBucketRequest.IsSetVirtualPoolId())
            {
                request.Headers.Add(COMMON.EMC_VPOOL, ECSTransforms.ToStringValue(putBucketRequest.VirtualPoolId));
            }
            if (putBucketRequest.IsSetRetentionPeriod())
            {
                request.Headers.Add(COMMON.EMC_RETENTION_PERIOD, ECSTransforms.ToStringValue(putBucketRequest.RetentionPeriod));
            }
            if (putBucketRequest.IsSetMetadataSearchKeys())
            {
                request.Headers.Add(COMMON.EMC_METADATA_SEARCH, ECSTransforms.ToStringValue(putBucketRequest.GetMetadataSearchKeys()));
            }

            return(request);
        }
Пример #2
0
        /// <summary>
        /// Initiates the asynchronous execution of the PutBucket operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the PutBucket operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<PutBucketResponse> PutBucketAsync(PutBucketRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new PutBucketRequestMarshaller();
            var unmarshaller = PutBucketResponseUnmarshaller.Instance;

            return InvokeAsync<PutBucketRequest,PutBucketResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
Пример #3
0
        internal PutBucketResponse PutBucket(PutBucketRequest request)
        {
            var marshaller = new PutBucketRequestMarshaller();
            var unmarshaller = PutBucketResponseUnmarshaller.Instance;

            return Invoke<PutBucketRequest,PutBucketResponse>(request, marshaller, unmarshaller);
        }
Пример #4
0
 IAsyncResult invokePutBucket(PutBucketRequest putBucketRequest, AsyncCallback callback, object state, bool synchronized)
 {
     var marshaller = new PutBucketRequestMarshaller();
     var unmarshaller = PutBucketResponseUnmarshaller.GetInstance();
     var result = Invoke(putBucketRequest, callback, state, synchronized, marshaller, unmarshaller, this.signer);
     return result;
 }
Пример #5
0
 /// <summary>
 /// Initiates the asynchronous execution of the PutBucket operation.
 /// This API is supported only when AWSConfigs.HttpClient is set to AWSConfigs.HttpClientOption.UnityWebRequest, the default value for this configuration option is AWSConfigs.HttpClientOption.UnityWWW
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the PutBucket operation on AmazonS3Client.</param>
 /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
 /// <param name="options">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 public void PutBucketAsync(PutBucketRequest request, AmazonServiceCallback<PutBucketRequest, PutBucketResponse> callback, AsyncOptions options = null)
 {
     if (AWSConfigs.HttpClient == AWSConfigs.HttpClientOption.UnityWWW)
     {
         throw new InvalidOperationException("PutBucket is only allowed with AWSConfigs.HttpClientOption.UnityWebRequest API option");
     }
     options = options == null?new AsyncOptions():options;
     var marshaller = new PutBucketRequestMarshaller();
     var unmarshaller = PutBucketResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<PutBucketRequest,PutBucketResponse> responseObject 
                     = new AmazonServiceResult<PutBucketRequest,PutBucketResponse>((PutBucketRequest)req, (PutBucketResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<PutBucketRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
Пример #6
0
        /// <summary>
        /// Initiates the asynchronous execution of the PutBucket operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the PutBucket operation on AmazonS3Client.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndPutBucket
        ///         operation.</returns>
        public IAsyncResult BeginPutBucket(PutBucketRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new PutBucketRequestMarshaller();
            var unmarshaller = PutBucketResponseUnmarshaller.Instance;

            return BeginInvoke<PutBucketRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
Пример #7
0
        /// <summary>
        /// Initiates the asynchronous execution of the PutBucket operation.
        /// <seealso cref="Amazon.S3.IAmazonS3.PutBucket"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the PutBucket operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
		public Task<PutBucketResponse> PutBucketAsync(PutBucketRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new PutBucketRequestMarshaller();
            var unmarshaller = PutBucketResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, PutBucketRequest, PutBucketResponse>(request, marshaller, unmarshaller, signer, cancellationToken);
        }
Пример #8
0
        /// <summary>
        /// <para>Creates a new bucket.</para>
        /// </summary>
        /// 
        /// <param name="putBucketRequest">Container for the necessary parameters to execute the PutBucket service method on AmazonS3.</param>
        /// 
        /// <returns>The response from the PutBucket service method, as returned by AmazonS3.</returns>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public async Task<PutBucketResponse> PutBucketAsync(PutBucketRequest putBucketRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new PutBucketRequestMarshaller();
            var unmarshaller = PutBucketResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, PutBucketRequest, PutBucketResponse>(putBucketRequest, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }