Esempio n. 1
0
        internal PutBucketVersioningResponse PutBucketVersioning(PutBucketVersioningRequest request)
        {
            var marshaller = new PutBucketVersioningRequestMarshaller();
            var unmarshaller = PutBucketVersioningResponseUnmarshaller.Instance;

            return Invoke<PutBucketVersioningRequest,PutBucketVersioningResponse>(request, marshaller, unmarshaller);
        }
Esempio n. 2
0
        /// <summary>
        /// Initiates the asynchronous execution of the PutBucketVersioning operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the PutBucketVersioning 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<PutBucketVersioningResponse> PutBucketVersioningAsync(PutBucketVersioningRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new PutBucketVersioningRequestMarshaller();
            var unmarshaller = PutBucketVersioningResponseUnmarshaller.Instance;

            return InvokeAsync<PutBucketVersioningRequest,PutBucketVersioningResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.S3.Model.PutBucketVersioningRequest();

            if (cmdletContext.BucketName != null)
            {
                request.BucketName = cmdletContext.BucketName;
            }

            // populate MfaCodes
            var requestMfaCodesIsNull = true;

            request.MfaCodes = new Amazon.S3.Model.MfaCodes();
            System.String requestMfaCodes_mfaCodes_SerialNumber = null;
            if (cmdletContext.MfaCodes_SerialNumber != null)
            {
                requestMfaCodes_mfaCodes_SerialNumber = cmdletContext.MfaCodes_SerialNumber;
            }
            if (requestMfaCodes_mfaCodes_SerialNumber != null)
            {
                request.MfaCodes.SerialNumber = requestMfaCodes_mfaCodes_SerialNumber;
                requestMfaCodesIsNull         = false;
            }
            System.String requestMfaCodes_mfaCodes_AuthenticationValue = null;
            if (cmdletContext.MfaCodes_AuthenticationValue != null)
            {
                requestMfaCodes_mfaCodes_AuthenticationValue = cmdletContext.MfaCodes_AuthenticationValue;
            }
            if (requestMfaCodes_mfaCodes_AuthenticationValue != null)
            {
                request.MfaCodes.AuthenticationValue = requestMfaCodes_mfaCodes_AuthenticationValue;
                requestMfaCodesIsNull = false;
            }
            // determine if request.MfaCodes should be set to null
            if (requestMfaCodesIsNull)
            {
                request.MfaCodes = null;
            }

            // populate VersioningConfig
            var requestVersioningConfigIsNull = true;

            request.VersioningConfig = new Amazon.S3.Model.S3BucketVersioningConfig();
            System.Boolean?requestVersioningConfig_versioningConfig_EnableMfaDelete = null;
            if (cmdletContext.VersioningConfig_EnableMfaDelete != null)
            {
                requestVersioningConfig_versioningConfig_EnableMfaDelete = cmdletContext.VersioningConfig_EnableMfaDelete.Value;
            }
            if (requestVersioningConfig_versioningConfig_EnableMfaDelete != null)
            {
                request.VersioningConfig.EnableMfaDelete = requestVersioningConfig_versioningConfig_EnableMfaDelete.Value;
                requestVersioningConfigIsNull            = false;
            }
            Amazon.S3.VersionStatus requestVersioningConfig_versioningConfig_Status = null;
            if (cmdletContext.VersioningConfig_Status != null)
            {
                requestVersioningConfig_versioningConfig_Status = cmdletContext.VersioningConfig_Status;
            }
            if (requestVersioningConfig_versioningConfig_Status != null)
            {
                request.VersioningConfig.Status = requestVersioningConfig_versioningConfig_Status;
                requestVersioningConfigIsNull   = false;
            }
            // determine if request.VersioningConfig should be set to null
            if (requestVersioningConfigIsNull)
            {
                request.VersioningConfig = null;
            }
            if (cmdletContext.ExpectedBucketOwner != null)
            {
                request.ExpectedBucketOwner = cmdletContext.ExpectedBucketOwner;
            }

            CmdletOutput output;

            // issue call
            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            try
            {
                var    response       = CallAWSServiceOperation(client, request);
                object pipelineOutput = null;
                pipelineOutput = cmdletContext.Select(response, this);
                output         = new CmdletOutput
                {
                    PipelineOutput  = pipelineOutput,
                    ServiceResponse = response
                };
            }
            catch (Exception e)
            {
                output = new CmdletOutput {
                    ErrorResponse = e
                };
            }

            return(output);
        }
 private Amazon.S3.Model.PutBucketVersioningResponse CallAWSServiceOperation(IAmazonS3 client, Amazon.S3.Model.PutBucketVersioningRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Storage Service (S3)", "PutBucketVersioning");
     try
     {
         #if DESKTOP
         return(client.PutBucketVersioning(request));
         #elif CORECLR
         return(client.PutBucketVersioningAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }
 /// <summary>
 /// Initiates the asynchronous execution of the PutBucketVersioning operation.
 /// <seealso cref="Amazon.S3.IAmazonS3.PutBucketVersioning"/>
 /// </summary>
 /// 
 /// <param name="putBucketVersioningRequest">Container for the necessary parameters to execute the PutBucketVersioning operation on
 ///          AmazonS3.</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>
 public IAsyncResult BeginPutBucketVersioning(PutBucketVersioningRequest putBucketVersioningRequest, AsyncCallback callback, object state)
 {
     return invokePutBucketVersioning(putBucketVersioningRequest, callback, state, false);
 }
 IAsyncResult invokePutBucketVersioning(PutBucketVersioningRequest putBucketVersioningRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new PutBucketVersioningRequestMarshaller().Marshall(putBucketVersioningRequest);
     var unmarshaller = PutBucketVersioningResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
Esempio n. 7
0
 /// <summary>
 /// Initiates the asynchronous execution of the PutBucketVersioning 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 PutBucketVersioning 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 PutBucketVersioningAsync(PutBucketVersioningRequest request, AmazonServiceCallback<PutBucketVersioningRequest, PutBucketVersioningResponse> callback, AsyncOptions options = null)
 {
     if (AWSConfigs.HttpClient == AWSConfigs.HttpClientOption.UnityWWW)
     {
         throw new InvalidOperationException("PutBucketVersioning is only allowed with AWSConfigs.HttpClientOption.UnityWebRequest API option");
     }
     options = options == null?new AsyncOptions():options;
     var marshaller = new PutBucketVersioningRequestMarshaller();
     var unmarshaller = PutBucketVersioningResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<PutBucketVersioningRequest,PutBucketVersioningResponse> responseObject 
                     = new AmazonServiceResult<PutBucketVersioningRequest,PutBucketVersioningResponse>((PutBucketVersioningRequest)req, (PutBucketVersioningResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<PutBucketVersioningRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
 /// <summary>
 /// <para>Puts the versioning state of an existing bucket. To set the versioning state, you must be the bucket owner.</para>
 /// </summary>
 /// 
 /// <param name="putBucketVersioningRequest">Container for the necessary parameters to execute the PutBucketVersioning service method on
 ///          AmazonS3.</param>
 /// 
 public PutBucketVersioningResponse PutBucketVersioning(PutBucketVersioningRequest putBucketVersioningRequest)
 {
     IAsyncResult asyncResult = invokePutBucketVersioning(putBucketVersioningRequest, null, null, true);
     return EndPutBucketVersioning(asyncResult);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the PutBucketVersioning operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the PutBucketVersioning 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 EndPutBucketVersioning
        ///         operation.</returns>
        public IAsyncResult BeginPutBucketVersioning(PutBucketVersioningRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new PutBucketVersioningRequestMarshaller();
            var unmarshaller = PutBucketVersioningResponseUnmarshaller.Instance;

            return BeginInvoke<PutBucketVersioningRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
Esempio n. 10
0
        /// <summary>
        /// Initiates the asynchronous execution of the PutBucketVersioning operation.
        /// <seealso cref="Amazon.S3.IAmazonS3.PutBucketVersioning"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the PutBucketVersioning 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<PutBucketVersioningResponse> PutBucketVersioningAsync(PutBucketVersioningRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new PutBucketVersioningRequestMarshaller();
            var unmarshaller = PutBucketVersioningResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, PutBucketVersioningRequest, PutBucketVersioningResponse>(request, marshaller, unmarshaller, signer, cancellationToken);
        }
Esempio n. 11
0
        /// <summary>
        /// <para>Puts the versioning state of an existing bucket. To set the versioning state, you must be the bucket owner.</para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the PutBucketVersioning service method on
        /// AmazonS3.</param>
		public PutBucketVersioningResponse PutBucketVersioning(PutBucketVersioningRequest request)
        {
            var task = PutBucketVersioningAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
Esempio n. 12
0
        /// <summary>
        /// <para>Puts the versioning state of an existing bucket. To set the versioning state, you must be the bucket owner.</para>
        /// </summary>
        /// 
        /// <param name="putBucketVersioningRequest">Container for the necessary parameters to execute the PutBucketVersioning service method on
        /// AmazonS3.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public async Task<PutBucketVersioningResponse> PutBucketVersioningAsync(PutBucketVersioningRequest putBucketVersioningRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new PutBucketVersioningRequestMarshaller();
            var unmarshaller = PutBucketVersioningResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, PutBucketVersioningRequest, PutBucketVersioningResponse>(putBucketVersioningRequest, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
Esempio n. 13
0
        /// <summary>
        /// <para>Puts the versioning state of an existing bucket. To set the versioning state, you must be the bucket owner.</para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the PutBucketVersioning service method on
        /// AmazonS3.</param>
		public PutBucketVersioningResponse PutBucketVersioning(PutBucketVersioningRequest request)
        {
            var task = PutBucketVersioningAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }