public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.S3.Model.DeleteBucketWebsiteRequest();

            if (cmdletContext.BucketName != null)
            {
                request.BucketName = cmdletContext.BucketName;
            }
            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);
        }
예제 #2
0
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteBucketWebsite operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DeleteBucketWebsite 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<DeleteBucketWebsiteResponse> DeleteBucketWebsiteAsync(DeleteBucketWebsiteRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DeleteBucketWebsiteRequestMarshaller();
            var unmarshaller = DeleteBucketWebsiteResponseUnmarshaller.Instance;

            return InvokeAsync<DeleteBucketWebsiteRequest,DeleteBucketWebsiteResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
예제 #3
0
        internal DeleteBucketWebsiteResponse DeleteBucketWebsite(DeleteBucketWebsiteRequest request)
        {
            var marshaller = new DeleteBucketWebsiteRequestMarshaller();
            var unmarshaller = DeleteBucketWebsiteResponseUnmarshaller.Instance;

            return Invoke<DeleteBucketWebsiteRequest,DeleteBucketWebsiteResponse>(request, marshaller, unmarshaller);
        }
예제 #4
0
 IAsyncResult invokeDeleteBucketWebsite(DeleteBucketWebsiteRequest deleteBucketWebsiteRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new DeleteBucketWebsiteRequestMarshaller().Marshall(deleteBucketWebsiteRequest);
     var unmarshaller = DeleteBucketWebsiteResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
예제 #5
0
 /// <summary>
 /// Initiates the asynchronous execution of the DeleteBucketWebsite operation.
 /// <seealso cref="Amazon.S3.IAmazonS3.DeleteBucketWebsite"/>
 /// </summary>
 /// 
 /// <param name="deleteBucketWebsiteRequest">Container for the necessary parameters to execute the DeleteBucketWebsite 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 BeginDeleteBucketWebsite(DeleteBucketWebsiteRequest deleteBucketWebsiteRequest, AsyncCallback callback, object state)
 {
     return invokeDeleteBucketWebsite(deleteBucketWebsiteRequest, callback, state, false);
 }
예제 #6
0
 /// <summary>
 /// <para>This operation removes the website configuration from the bucket.</para>
 /// </summary>
 /// 
 /// <param name="deleteBucketWebsiteRequest">Container for the necessary parameters to execute the DeleteBucketWebsite service method on
 ///          AmazonS3.</param>
 /// 
 public DeleteBucketWebsiteResponse DeleteBucketWebsite(DeleteBucketWebsiteRequest deleteBucketWebsiteRequest)
 {
     IAsyncResult asyncResult = invokeDeleteBucketWebsite(deleteBucketWebsiteRequest, null, null, true);
     return EndDeleteBucketWebsite(asyncResult);
 }
예제 #7
0
 /// <summary>
 /// Initiates the asynchronous execution of the DeleteBucketWebsite 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 DeleteBucketWebsite 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 DeleteBucketWebsiteAsync(DeleteBucketWebsiteRequest request, AmazonServiceCallback<DeleteBucketWebsiteRequest, DeleteBucketWebsiteResponse> callback, AsyncOptions options = null)
 {
     if (AWSConfigs.HttpClient == AWSConfigs.HttpClientOption.UnityWWW)
     {
         throw new InvalidOperationException("DeleteBucketWebsite is only allowed with AWSConfigs.HttpClientOption.UnityWebRequest API option");
     }
     options = options == null?new AsyncOptions():options;
     var marshaller = new DeleteBucketWebsiteRequestMarshaller();
     var unmarshaller = DeleteBucketWebsiteResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<DeleteBucketWebsiteRequest,DeleteBucketWebsiteResponse> responseObject 
                     = new AmazonServiceResult<DeleteBucketWebsiteRequest,DeleteBucketWebsiteResponse>((DeleteBucketWebsiteRequest)req, (DeleteBucketWebsiteResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<DeleteBucketWebsiteRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
예제 #8
0
 /// <summary>
 /// This operation removes the website configuration from the bucket.
 /// This API is supported only when AWSConfigs.HttpClient is set to AWSConfigs.HttpClientOption.UnityWebRequest, the default value of this configuration option is AWSConfigs.HttpClientOption.UnityWWW
 /// </summary>
 /// <param name="bucketName">A property of DeleteBucketWebsiteRequest used to execute the DeleteBucketWebsite service method.</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>
 /// 
 /// <returns>The response from the DeleteBucketWebsite service method, as returned by S3.</returns>
 public void DeleteBucketWebsiteAsync(string bucketName,  AmazonServiceCallback<DeleteBucketWebsiteRequest, DeleteBucketWebsiteResponse> callback, AsyncOptions options = null)
 {
     var request = new DeleteBucketWebsiteRequest();
     request.BucketName = bucketName;
     DeleteBucketWebsiteAsync(request, callback, options);
 }
 private Amazon.S3.Model.DeleteBucketWebsiteResponse CallAWSServiceOperation(IAmazonS3 client, Amazon.S3.Model.DeleteBucketWebsiteRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Storage Service (S3)", "DeleteBucketWebsite");
     try
     {
         #if DESKTOP
         return(client.DeleteBucketWebsite(request));
         #elif CORECLR
         return(client.DeleteBucketWebsiteAsync(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;
     }
 }
예제 #10
0
 /// <summary>
 /// This operation removes the website configuration from the bucket.
 /// </summary>
 /// <param name="bucketName">A property of DeleteBucketWebsiteRequest used to execute the DeleteBucketWebsite service method.</param>
 /// 
 /// <returns>The response from the DeleteBucketWebsite service method, as returned by S3.</returns>
 public DeleteBucketWebsiteResponse DeleteBucketWebsite(string bucketName)
 {
     var request = new DeleteBucketWebsiteRequest();
     request.BucketName = bucketName;
     return DeleteBucketWebsite(request);
 }
예제 #11
0
 /// <summary>
 /// This operation removes the website configuration from the bucket.
 /// </summary>
 /// <param name="bucketName">A property of DeleteBucketWebsiteRequest used to execute the DeleteBucketWebsite service method.</param>
 /// <param name="cancellationToken">
 ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
 /// </param>
 /// 
 /// <returns>The response from the DeleteBucketWebsite service method, as returned by S3.</returns>
 public Task<DeleteBucketWebsiteResponse> DeleteBucketWebsiteAsync(string bucketName, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
 {
     var request = new DeleteBucketWebsiteRequest();
     request.BucketName = bucketName;
     return DeleteBucketWebsiteAsync(request, cancellationToken);
 }
예제 #12
0
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteBucketWebsite operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DeleteBucketWebsite 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 EndDeleteBucketWebsite
        ///         operation.</returns>
        public IAsyncResult BeginDeleteBucketWebsite(DeleteBucketWebsiteRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new DeleteBucketWebsiteRequestMarshaller();
            var unmarshaller = DeleteBucketWebsiteResponseUnmarshaller.Instance;

            return BeginInvoke<DeleteBucketWebsiteRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
예제 #13
0
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteBucketWebsite operation.
        /// <seealso cref="Amazon.S3.IAmazonS3.DeleteBucketWebsite"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DeleteBucketWebsite 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<DeleteBucketWebsiteResponse> DeleteBucketWebsiteAsync(DeleteBucketWebsiteRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DeleteBucketWebsiteRequestMarshaller();
            var unmarshaller = DeleteBucketWebsiteResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, DeleteBucketWebsiteRequest, DeleteBucketWebsiteResponse>(request, marshaller, unmarshaller, signer, cancellationToken);
        }
예제 #14
0
        /// <summary>
        /// <para>This operation removes the website configuration from the bucket.</para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DeleteBucketWebsite service method on
        /// AmazonS3.</param>
		public DeleteBucketWebsiteResponse DeleteBucketWebsite(DeleteBucketWebsiteRequest request)
        {
            var task = DeleteBucketWebsiteAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
예제 #15
0
        /// <summary>
        /// <para>This operation removes the website configuration from the bucket.</para>
        /// </summary>
        /// 
        /// <param name="deleteBucketWebsiteRequest">Container for the necessary parameters to execute the DeleteBucketWebsite 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<DeleteBucketWebsiteResponse> DeleteBucketWebsiteAsync(DeleteBucketWebsiteRequest deleteBucketWebsiteRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DeleteBucketWebsiteRequestMarshaller();
            var unmarshaller = DeleteBucketWebsiteResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, DeleteBucketWebsiteRequest, DeleteBucketWebsiteResponse>(deleteBucketWebsiteRequest, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
예제 #16
0
        /// <summary>
        /// <para>This operation removes the website configuration from the bucket.</para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DeleteBucketWebsite service method on
        /// AmazonS3.</param>
		public DeleteBucketWebsiteResponse DeleteBucketWebsite(DeleteBucketWebsiteRequest request)
        {
            var task = DeleteBucketWebsiteAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }