protected override void ProcessRecord() { AmazonCloudFront client = base.GetClient(); Amazon.CloudFront.Model.DeleteDistributionRequest request = new Amazon.CloudFront.Model.DeleteDistributionRequest(); request.Id = this._Id; request.ETag = this._ETag; request.Marker = this._Marker; request.MaxItems = this._MaxItems; Amazon.CloudFront.Model.DeleteDistributionResponse response = client.DeleteDistribution(request); }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.CloudFront.Model.DeleteDistributionRequest(); if (cmdletContext.Id != null) { request.Id = cmdletContext.Id; } if (cmdletContext.IfMatch != null) { request.IfMatch = cmdletContext.IfMatch; } 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); }
/// <summary> /// Initiates the asynchronous execution of the DeleteDistribution operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteDistribution operation on AmazonCloudFrontClient.</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 EndDeleteDistribution /// operation.</returns> public IAsyncResult BeginDeleteDistribution(DeleteDistributionRequest request, AsyncCallback callback, object state) { var marshaller = new DeleteDistributionRequestMarshaller(); var unmarshaller = DeleteDistributionResponseUnmarshaller.Instance; return BeginInvoke<DeleteDistributionRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Delete a distribution. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteDistribution service method.</param> /// /// <returns>The response from the DeleteDistribution service method, as returned by CloudFront.</returns> /// <exception cref="Amazon.CloudFront.Model.AccessDeniedException"> /// Access denied. /// </exception> /// <exception cref="Amazon.CloudFront.Model.DistributionNotDisabledException"> /// /// </exception> /// <exception cref="Amazon.CloudFront.Model.InvalidIfMatchVersionException"> /// The If-Match version is missing or not valid for the distribution. /// </exception> /// <exception cref="Amazon.CloudFront.Model.NoSuchDistributionException"> /// The specified distribution does not exist. /// </exception> /// <exception cref="Amazon.CloudFront.Model.PreconditionFailedException"> /// The precondition given in one or more of the request-header fields evaluated to false. /// </exception> public DeleteDistributionResponse DeleteDistribution(DeleteDistributionRequest request) { var marshaller = new DeleteDistributionRequestMarshaller(); var unmarshaller = DeleteDistributionResponseUnmarshaller.Instance; return Invoke<DeleteDistributionRequest,DeleteDistributionResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the DeleteDistribution operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteDistribution 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<DeleteDistributionResponse> DeleteDistributionAsync(DeleteDistributionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteDistributionRequestMarshaller(); var unmarshaller = DeleteDistributionResponseUnmarshaller.Instance; return InvokeAsync<DeleteDistributionRequest,DeleteDistributionResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Delete a distribution. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteDistribution service method.</param> /// /// <returns>The response from the DeleteDistribution service method, as returned by CloudFront.</returns> /// <exception cref="AccessDeniedException"> /// Access denied. /// </exception> /// <exception cref="DistributionNotDisabledException"> /// /// </exception> /// <exception cref="InvalidIfMatchVersionException"> /// The If-Match version is missing or not valid for the distribution. /// </exception> /// <exception cref="NoSuchDistributionException"> /// The specified distribution does not exist. /// </exception> /// <exception cref="PreconditionFailedException"> /// The precondition given in one or more of the request-header fields evaluated to false. /// </exception> public DeleteDistributionResponse DeleteDistribution(DeleteDistributionRequest request) { var task = DeleteDistributionAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// <para> Delete a distribution. </para> /// </summary> /// /// <param name="deleteDistributionRequest">Container for the necessary parameters to execute the DeleteDistribution service method on /// AmazonCloudFront.</param> /// /// <exception cref="InvalidIfMatchVersionException"/> /// <exception cref="NoSuchDistributionException"/> /// <exception cref="DistributionNotDisabledException"/> /// <exception cref="PreconditionFailedException"/> /// <exception cref="AccessDeniedException"/> public DeleteDistributionResponse DeleteDistribution(DeleteDistributionRequest deleteDistributionRequest) { IAsyncResult asyncResult = invokeDeleteDistribution(deleteDistributionRequest, null, null, true); return EndDeleteDistribution(asyncResult); }
/// <summary> /// Initiates the asynchronous execution of the DeleteDistribution operation. /// <seealso cref="Amazon.CloudFront.AmazonCloudFront.DeleteDistribution"/> /// </summary> /// /// <param name="deleteDistributionRequest">Container for the necessary parameters to execute the DeleteDistribution operation on /// AmazonCloudFront.</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 BeginDeleteDistribution(DeleteDistributionRequest deleteDistributionRequest, AsyncCallback callback, object state) { return invokeDeleteDistribution(deleteDistributionRequest, callback, state, false); }
IAsyncResult invokeDeleteDistribution(DeleteDistributionRequest deleteDistributionRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new DeleteDistributionRequestMarshaller().Marshall(deleteDistributionRequest); var unmarshaller = DeleteDistributionResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// <para> Delete a distribution. </para> /// </summary> /// /// <param name="deleteDistributionRequest">Container for the necessary parameters to execute the DeleteDistribution service method on /// AmazonCloudFront.</param> /// /// <exception cref="T:Amazon.CloudFront.Model.InvalidIfMatchVersionException" /> /// <exception cref="T:Amazon.CloudFront.Model.NoSuchDistributionException" /> /// <exception cref="T:Amazon.CloudFront.Model.DistributionNotDisabledException" /> /// <exception cref="T:Amazon.CloudFront.Model.PreconditionFailedException" /> /// <exception cref="T:Amazon.CloudFront.Model.AccessDeniedException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<DeleteDistributionResponse> DeleteDistributionAsync(DeleteDistributionRequest deleteDistributionRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteDistributionRequestMarshaller(); var unmarshaller = DeleteDistributionResponseUnmarshaller.GetInstance(); return Invoke<IRequest, DeleteDistributionRequest, DeleteDistributionResponse>(deleteDistributionRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal DeleteDistributionResponse DeleteDistribution(DeleteDistributionRequest request) { var task = DeleteDistributionAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
private Amazon.CloudFront.Model.DeleteDistributionResponse CallAWSServiceOperation(IAmazonCloudFront client, Amazon.CloudFront.Model.DeleteDistributionRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon CloudFront", "DeleteDistribution"); try { #if DESKTOP return(client.DeleteDistribution(request)); #elif CORECLR return(client.DeleteDistributionAsync(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; } }
IAsyncResult invokeDeleteDistribution(DeleteDistributionRequest request, AsyncCallback callback, object state, bool synchronized) { var marshaller = new DeleteDistributionRequestMarshaller(); var unmarshaller = DeleteDistributionResponseUnmarshaller.Instance; return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer); }
/// <summary> /// Initiates the asynchronous execution of the DeleteDistribution operation. /// <seealso cref="Amazon.CloudFront.IAmazonCloudFront.DeleteDistribution"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteDistribution 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 async Task<DeleteDistributionResponse> DeleteDistributionAsync(DeleteDistributionRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteDistributionRequestMarshaller(); var unmarshaller = DeleteDistributionResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, DeleteDistributionRequest, DeleteDistributionResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }