public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.EC2.Model.DeleteVpcPeeringConnectionRequest(); if (cmdletContext.VpcPeeringConnectionId != null) { request.VpcPeeringConnectionId = cmdletContext.VpcPeeringConnectionId; } 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 DeleteVpcPeeringConnection operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteVpcPeeringConnection 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<DeleteVpcPeeringConnectionResponse> DeleteVpcPeeringConnectionAsync(DeleteVpcPeeringConnectionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteVpcPeeringConnectionRequestMarshaller(); var unmarshaller = DeleteVpcPeeringConnectionResponseUnmarshaller.Instance; return InvokeAsync<DeleteVpcPeeringConnectionRequest,DeleteVpcPeeringConnectionResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Deletes a VPC peering connection. Either the owner of the requester VPC or the owner /// of the peer VPC can delete the VPC peering connection if it's in the <code>active</code> /// state. The owner of the requester VPC can delete a VPC peering connection in the <code>pending-acceptance</code> /// state. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteVpcPeeringConnection service method.</param> /// /// <returns>The response from the DeleteVpcPeeringConnection service method, as returned by EC2.</returns> public DeleteVpcPeeringConnectionResponse DeleteVpcPeeringConnection(DeleteVpcPeeringConnectionRequest request) { var marshaller = new DeleteVpcPeeringConnectionRequestMarshaller(); var unmarshaller = DeleteVpcPeeringConnectionResponseUnmarshaller.Instance; return Invoke<DeleteVpcPeeringConnectionRequest,DeleteVpcPeeringConnectionResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the DeleteVpcPeeringConnection operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteVpcPeeringConnection operation on AmazonEC2Client.</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 EndDeleteVpcPeeringConnection /// operation.</returns> public IAsyncResult BeginDeleteVpcPeeringConnection(DeleteVpcPeeringConnectionRequest request, AsyncCallback callback, object state) { var marshaller = new DeleteVpcPeeringConnectionRequestMarshaller(); var unmarshaller = DeleteVpcPeeringConnectionResponseUnmarshaller.Instance; return BeginInvoke<DeleteVpcPeeringConnectionRequest>(request, marshaller, unmarshaller, callback, state); }
IAsyncResult invokeDeleteVpcPeeringConnection(DeleteVpcPeeringConnectionRequest deleteVpcPeeringConnectionRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new DeleteVpcPeeringConnectionRequestMarshaller().Marshall(deleteVpcPeeringConnectionRequest); var unmarshaller = DeleteVpcPeeringConnectionResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the DeleteVpcPeeringConnection operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.DeleteVpcPeeringConnection"/> /// </summary> /// /// <param name="deleteVpcPeeringConnectionRequest">Container for the necessary parameters to execute the DeleteVpcPeeringConnection operation /// on AmazonEC2.</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 BeginDeleteVpcPeeringConnection(DeleteVpcPeeringConnectionRequest deleteVpcPeeringConnectionRequest, AsyncCallback callback, object state) { return invokeDeleteVpcPeeringConnection(deleteVpcPeeringConnectionRequest, callback, state, false); }
/// <summary> /// <para>Deletes a VPC peering connection. Either the owner of the requester VPC or the owner of the peer VPC can delete the VPC peering /// connection if it's in the <c>active</c> state. The owner of the requester VPC can delete a VPC peering connection in the /// <c>pending-acceptance</c> state.</para> /// </summary> /// /// <param name="deleteVpcPeeringConnectionRequest">Container for the necessary parameters to execute the DeleteVpcPeeringConnection service /// method on AmazonEC2.</param> /// public DeleteVpcPeeringConnectionResponse DeleteVpcPeeringConnection(DeleteVpcPeeringConnectionRequest deleteVpcPeeringConnectionRequest) { IAsyncResult asyncResult = invokeDeleteVpcPeeringConnection(deleteVpcPeeringConnectionRequest, null, null, true); return EndDeleteVpcPeeringConnection(asyncResult); }
/// <summary> /// <para>Deletes a VPC peering connection. Either the owner of the requester VPC or the owner of the peer VPC can delete the VPC peering /// connection if it's in the <c>active</c> state. The owner of the requester VPC can delete a VPC peering connection in the /// <c>pending-acceptance</c> state.</para> /// </summary> /// /// <param name="deleteVpcPeeringConnectionRequest">Container for the necessary parameters to execute the DeleteVpcPeeringConnection service /// method on AmazonEC2.</param> /// /// <returns>The response from the DeleteVpcPeeringConnection service method, as returned by AmazonEC2.</returns> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<DeleteVpcPeeringConnectionResponse> DeleteVpcPeeringConnectionAsync(DeleteVpcPeeringConnectionRequest deleteVpcPeeringConnectionRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteVpcPeeringConnectionRequestMarshaller(); var unmarshaller = DeleteVpcPeeringConnectionResponseUnmarshaller.GetInstance(); return Invoke<IRequest, DeleteVpcPeeringConnectionRequest, DeleteVpcPeeringConnectionResponse>(deleteVpcPeeringConnectionRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal DeleteVpcPeeringConnectionResponse DeleteVpcPeeringConnection(DeleteVpcPeeringConnectionRequest request) { var task = DeleteVpcPeeringConnectionAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
private Amazon.EC2.Model.DeleteVpcPeeringConnectionResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.DeleteVpcPeeringConnectionRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "DeleteVpcPeeringConnection"); try { #if DESKTOP return(client.DeleteVpcPeeringConnection(request)); #elif CORECLR return(client.DeleteVpcPeeringConnectionAsync(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; } }