/// <summary> /// Initiates the asynchronous execution of the PutBucketWebsite operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PutBucketWebsite 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<PutBucketWebsiteResponse> PutBucketWebsiteAsync(PutBucketWebsiteRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new PutBucketWebsiteRequestMarshaller(); var unmarshaller = PutBucketWebsiteResponseUnmarshaller.Instance; return InvokeAsync<PutBucketWebsiteRequest,PutBucketWebsiteResponse>(request, marshaller, unmarshaller, cancellationToken); }
IAsyncResult invokePutBucketWebsite(PutBucketWebsiteRequest putBucketWebsiteRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new PutBucketWebsiteRequestMarshaller().Marshall(putBucketWebsiteRequest); var unmarshaller = PutBucketWebsiteResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
internal PutBucketWebsiteResponse PutBucketWebsite(PutBucketWebsiteRequest request) { var marshaller = new PutBucketWebsiteRequestMarshaller(); var unmarshaller = PutBucketWebsiteResponseUnmarshaller.Instance; return Invoke<PutBucketWebsiteRequest,PutBucketWebsiteResponse>(request, marshaller, unmarshaller); }
/// <summary> /// <para>Set the website configuration for a bucket.</para> /// </summary> /// /// <param name="putBucketWebsiteRequest">Container for the necessary parameters to execute the PutBucketWebsite service method on /// AmazonS3.</param> /// public PutBucketWebsiteResponse PutBucketWebsite(PutBucketWebsiteRequest putBucketWebsiteRequest) { IAsyncResult asyncResult = invokePutBucketWebsite(putBucketWebsiteRequest, null, null, true); return EndPutBucketWebsite(asyncResult); }
/// <summary> /// Initiates the asynchronous execution of the PutBucketWebsite operation. /// <seealso cref="Amazon.S3.IAmazonS3.PutBucketWebsite"/> /// </summary> /// /// <param name="putBucketWebsiteRequest">Container for the necessary parameters to execute the PutBucketWebsite 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 BeginPutBucketWebsite(PutBucketWebsiteRequest putBucketWebsiteRequest, AsyncCallback callback, object state) { return invokePutBucketWebsite(putBucketWebsiteRequest, callback, state, false); }
/// <summary> /// Set the website configuration for a 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 PutBucketWebsiteRequest used to execute the PutBucketWebsite service method.</param> /// <param name="websiteConfiguration">A property of PutBucketWebsiteRequest used to execute the PutBucketWebsite 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 PutBucketWebsite service method, as returned by S3.</returns> public void PutBucketWebsiteAsync(string bucketName, WebsiteConfiguration websiteConfiguration, AmazonServiceCallback<PutBucketWebsiteRequest, PutBucketWebsiteResponse> callback, AsyncOptions options = null) { var request = new PutBucketWebsiteRequest(); request.BucketName = bucketName; request.WebsiteConfiguration = websiteConfiguration; PutBucketWebsiteAsync(request, callback, options); }
/// <summary> /// Initiates the asynchronous execution of the PutBucketWebsite 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 PutBucketWebsite 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 PutBucketWebsiteAsync(PutBucketWebsiteRequest request, AmazonServiceCallback<PutBucketWebsiteRequest, PutBucketWebsiteResponse> callback, AsyncOptions options = null) { if (AWSConfigs.HttpClient == AWSConfigs.HttpClientOption.UnityWWW) { throw new InvalidOperationException("PutBucketWebsite is only allowed with AWSConfigs.HttpClientOption.UnityWebRequest API option"); } options = options == null?new AsyncOptions():options; var marshaller = new PutBucketWebsiteRequestMarshaller(); var unmarshaller = PutBucketWebsiteResponseUnmarshaller.Instance; Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult<PutBucketWebsiteRequest,PutBucketWebsiteResponse> responseObject = new AmazonServiceResult<PutBucketWebsiteRequest,PutBucketWebsiteResponse>((PutBucketWebsiteRequest)req, (PutBucketWebsiteResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke<PutBucketWebsiteRequest>(request, marshaller, unmarshaller, options, callbackHelper); }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.S3.Model.PutBucketWebsiteRequest(); if (cmdletContext.BucketName != null) { request.BucketName = cmdletContext.BucketName; } // populate WebsiteConfiguration var requestWebsiteConfigurationIsNull = true; request.WebsiteConfiguration = new Amazon.S3.Model.WebsiteConfiguration(); System.String requestWebsiteConfiguration_websiteConfiguration_ErrorDocument = null; if (cmdletContext.WebsiteConfiguration_ErrorDocument != null) { requestWebsiteConfiguration_websiteConfiguration_ErrorDocument = cmdletContext.WebsiteConfiguration_ErrorDocument; } if (requestWebsiteConfiguration_websiteConfiguration_ErrorDocument != null) { request.WebsiteConfiguration.ErrorDocument = requestWebsiteConfiguration_websiteConfiguration_ErrorDocument; requestWebsiteConfigurationIsNull = false; } System.String requestWebsiteConfiguration_websiteConfiguration_IndexDocumentSuffix = null; if (cmdletContext.WebsiteConfiguration_IndexDocumentSuffix != null) { requestWebsiteConfiguration_websiteConfiguration_IndexDocumentSuffix = cmdletContext.WebsiteConfiguration_IndexDocumentSuffix; } if (requestWebsiteConfiguration_websiteConfiguration_IndexDocumentSuffix != null) { request.WebsiteConfiguration.IndexDocumentSuffix = requestWebsiteConfiguration_websiteConfiguration_IndexDocumentSuffix; requestWebsiteConfigurationIsNull = false; } List <Amazon.S3.Model.RoutingRule> requestWebsiteConfiguration_websiteConfiguration_RoutingRule = null; if (cmdletContext.WebsiteConfiguration_RoutingRule != null) { requestWebsiteConfiguration_websiteConfiguration_RoutingRule = cmdletContext.WebsiteConfiguration_RoutingRule; } if (requestWebsiteConfiguration_websiteConfiguration_RoutingRule != null) { request.WebsiteConfiguration.RoutingRules = requestWebsiteConfiguration_websiteConfiguration_RoutingRule; requestWebsiteConfigurationIsNull = false; } Amazon.S3.Model.RoutingRuleRedirect requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo = null; // populate RedirectAllRequestsTo var requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsToIsNull = true; requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo = new Amazon.S3.Model.RoutingRuleRedirect(); System.String requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_HostName = null; if (cmdletContext.RedirectAllRequestsTo_HostName != null) { requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_HostName = cmdletContext.RedirectAllRequestsTo_HostName; } if (requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_HostName != null) { requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo.HostName = requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_HostName; requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsToIsNull = false; } System.String requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_HttpRedirectCode = null; if (cmdletContext.RedirectAllRequestsTo_HttpRedirectCode != null) { requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_HttpRedirectCode = cmdletContext.RedirectAllRequestsTo_HttpRedirectCode; } if (requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_HttpRedirectCode != null) { requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo.HttpRedirectCode = requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_HttpRedirectCode; requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsToIsNull = false; } System.String requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_Protocol = null; if (cmdletContext.RedirectAllRequestsTo_Protocol != null) { requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_Protocol = cmdletContext.RedirectAllRequestsTo_Protocol; } if (requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_Protocol != null) { requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo.Protocol = requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_Protocol; requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsToIsNull = false; } System.String requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_ReplaceKeyPrefixWith = null; if (cmdletContext.RedirectAllRequestsTo_ReplaceKeyPrefixWith != null) { requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_ReplaceKeyPrefixWith = cmdletContext.RedirectAllRequestsTo_ReplaceKeyPrefixWith; } if (requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_ReplaceKeyPrefixWith != null) { requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo.ReplaceKeyPrefixWith = requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_ReplaceKeyPrefixWith; requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsToIsNull = false; } System.String requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_ReplaceKeyWith = null; if (cmdletContext.RedirectAllRequestsTo_ReplaceKeyWith != null) { requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_ReplaceKeyWith = cmdletContext.RedirectAllRequestsTo_ReplaceKeyWith; } if (requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_ReplaceKeyWith != null) { requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo.ReplaceKeyWith = requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo_redirectAllRequestsTo_ReplaceKeyWith; requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsToIsNull = false; } // determine if requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo should be set to null if (requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsToIsNull) { requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo = null; } if (requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo != null) { request.WebsiteConfiguration.RedirectAllRequestsTo = requestWebsiteConfiguration_websiteConfiguration_RedirectAllRequestsTo; requestWebsiteConfigurationIsNull = false; } // determine if request.WebsiteConfiguration should be set to null if (requestWebsiteConfigurationIsNull) { request.WebsiteConfiguration = null; } 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.PutBucketWebsiteResponse CallAWSServiceOperation(IAmazonS3 client, Amazon.S3.Model.PutBucketWebsiteRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Storage Service (S3)", "PutBucketWebsite"); try { #if DESKTOP return(client.PutBucketWebsite(request)); #elif CORECLR return(client.PutBucketWebsiteAsync(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> /// Set the website configuration for a bucket. /// </summary> /// <param name="bucketName">A property of PutBucketWebsiteRequest used to execute the PutBucketWebsite service method.</param> /// <param name="websiteConfiguration">A property of PutBucketWebsiteRequest used to execute the PutBucketWebsite service method.</param> /// /// <returns>The response from the PutBucketWebsite service method, as returned by S3.</returns> public PutBucketWebsiteResponse PutBucketWebsite(string bucketName, WebsiteConfiguration websiteConfiguration) { var request = new PutBucketWebsiteRequest(); request.BucketName = bucketName; request.WebsiteConfiguration = websiteConfiguration; return PutBucketWebsite(request); }
/// <summary> /// Set the website configuration for a bucket. /// </summary> /// <param name="bucketName">A property of PutBucketWebsiteRequest used to execute the PutBucketWebsite service method.</param> /// <param name="websiteConfiguration">A property of PutBucketWebsiteRequest used to execute the PutBucketWebsite 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 PutBucketWebsite service method, as returned by S3.</returns> public Task<PutBucketWebsiteResponse> PutBucketWebsiteAsync(string bucketName, WebsiteConfiguration websiteConfiguration, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var request = new PutBucketWebsiteRequest(); request.BucketName = bucketName; request.WebsiteConfiguration = websiteConfiguration; return PutBucketWebsiteAsync(request, cancellationToken); }
/// <summary> /// Initiates the asynchronous execution of the PutBucketWebsite operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PutBucketWebsite 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 EndPutBucketWebsite /// operation.</returns> public IAsyncResult BeginPutBucketWebsite(PutBucketWebsiteRequest request, AsyncCallback callback, object state) { var marshaller = new PutBucketWebsiteRequestMarshaller(); var unmarshaller = PutBucketWebsiteResponseUnmarshaller.Instance; return BeginInvoke<PutBucketWebsiteRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Initiates the asynchronous execution of the PutBucketWebsite operation. /// <seealso cref="Amazon.S3.IAmazonS3.PutBucketWebsite"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PutBucketWebsite 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<PutBucketWebsiteResponse> PutBucketWebsiteAsync(PutBucketWebsiteRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new PutBucketWebsiteRequestMarshaller(); var unmarshaller = PutBucketWebsiteResponseUnmarshaller.GetInstance(); return Invoke<IRequest, PutBucketWebsiteRequest, PutBucketWebsiteResponse>(request, marshaller, unmarshaller, signer, cancellationToken); }
/// <summary> /// <para>Set the website configuration for a bucket.</para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PutBucketWebsite service method on /// AmazonS3.</param> public PutBucketWebsiteResponse PutBucketWebsite(PutBucketWebsiteRequest request) { var task = PutBucketWebsiteAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
/// <summary> /// <para>Set the website configuration for a bucket.</para> /// </summary> /// /// <param name="putBucketWebsiteRequest">Container for the necessary parameters to execute the PutBucketWebsite 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<PutBucketWebsiteResponse> PutBucketWebsiteAsync(PutBucketWebsiteRequest putBucketWebsiteRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new PutBucketWebsiteRequestMarshaller(); var unmarshaller = PutBucketWebsiteResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, PutBucketWebsiteRequest, PutBucketWebsiteResponse>(putBucketWebsiteRequest, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// <para>Set the website configuration for a bucket.</para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PutBucketWebsite service method on /// AmazonS3.</param> public PutBucketWebsiteResponse PutBucketWebsite(PutBucketWebsiteRequest request) { var task = PutBucketWebsiteAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }