protected override void ProcessRecord() { AmazonEC2 client = base.GetClient(); Amazon.EC2.Model.DeleteVpnGatewayRequest request = new Amazon.EC2.Model.DeleteVpnGatewayRequest(); request.VpnGatewayId = this._VpnGatewayId; Amazon.EC2.Model.DeleteVpnGatewayResponse response = client.DeleteVpnGateway(request); }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.EC2.Model.DeleteVpnGatewayRequest(); if (cmdletContext.VpnGatewayId != null) { request.VpnGatewayId = cmdletContext.VpnGatewayId; } 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 DeleteVpnGateway operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteVpnGateway 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<DeleteVpnGatewayResponse> DeleteVpnGatewayAsync(DeleteVpnGatewayRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteVpnGatewayRequestMarshaller(); var unmarshaller = DeleteVpnGatewayResponseUnmarshaller.Instance; return InvokeAsync<DeleteVpnGatewayRequest,DeleteVpnGatewayResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Deletes the specified virtual private gateway. We recommend that before you delete /// a virtual private gateway, you detach it from the VPC and delete the VPN connection. /// Note that you don't need to delete the virtual private gateway if you plan to delete /// and recreate the VPN connection between your VPC and your network. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeleteVpnGateway service method.</param> /// /// <returns>The response from the DeleteVpnGateway service method, as returned by EC2.</returns> public DeleteVpnGatewayResponse DeleteVpnGateway(DeleteVpnGatewayRequest request) { var marshaller = new DeleteVpnGatewayRequestMarshaller(); var unmarshaller = DeleteVpnGatewayResponseUnmarshaller.Instance; return Invoke<DeleteVpnGatewayRequest,DeleteVpnGatewayResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the DeleteVpnGateway operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteVpnGateway 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 EndDeleteVpnGateway /// operation.</returns> public IAsyncResult BeginDeleteVpnGateway(DeleteVpnGatewayRequest request, AsyncCallback callback, object state) { var marshaller = new DeleteVpnGatewayRequestMarshaller(); var unmarshaller = DeleteVpnGatewayResponseUnmarshaller.Instance; return BeginInvoke<DeleteVpnGatewayRequest>(request, marshaller, unmarshaller, callback, state); }
IAsyncResult invokeDeleteVpnGateway(DeleteVpnGatewayRequest deleteVpnGatewayRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new DeleteVpnGatewayRequestMarshaller().Marshall(deleteVpnGatewayRequest); var unmarshaller = DeleteVpnGatewayResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the DeleteVpnGateway operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.DeleteVpnGateway"/> /// </summary> /// /// <param name="deleteVpnGatewayRequest">Container for the necessary parameters to execute the DeleteVpnGateway 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 BeginDeleteVpnGateway(DeleteVpnGatewayRequest deleteVpnGatewayRequest, AsyncCallback callback, object state) { return invokeDeleteVpnGateway(deleteVpnGatewayRequest, callback, state, false); }
/// <summary> /// <para>Deletes the specified virtual private gateway. We recommend that before you delete a virtual private gateway, you detach it from the /// VPC and delete the VPN connection. Note that you don't need to delete the virtual private gateway if you plan to delete and recreate the VPN /// connection between your VPC and your network.</para> /// </summary> /// /// <param name="deleteVpnGatewayRequest">Container for the necessary parameters to execute the DeleteVpnGateway service method on /// AmazonEC2.</param> /// public DeleteVpnGatewayResponse DeleteVpnGateway(DeleteVpnGatewayRequest deleteVpnGatewayRequest) { IAsyncResult asyncResult = invokeDeleteVpnGateway(deleteVpnGatewayRequest, null, null, true); return EndDeleteVpnGateway(asyncResult); }
/// <summary> /// <para>Deletes the specified virtual private gateway. We recommend that before you delete a virtual private gateway, you detach it from the /// VPC and delete the VPN connection. Note that you don't need to delete the virtual private gateway if you plan to delete and recreate the VPN /// connection between your VPC and your network.</para> /// </summary> /// /// <param name="deleteVpnGatewayRequest">Container for the necessary parameters to execute the DeleteVpnGateway service method on /// AmazonEC2.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<DeleteVpnGatewayResponse> DeleteVpnGatewayAsync(DeleteVpnGatewayRequest deleteVpnGatewayRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteVpnGatewayRequestMarshaller(); var unmarshaller = DeleteVpnGatewayResponseUnmarshaller.GetInstance(); return Invoke<IRequest, DeleteVpnGatewayRequest, DeleteVpnGatewayResponse>(deleteVpnGatewayRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal DeleteVpnGatewayResponse DeleteVpnGateway(DeleteVpnGatewayRequest request) { var task = DeleteVpnGatewayAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
private Amazon.EC2.Model.DeleteVpnGatewayResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.DeleteVpnGatewayRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "DeleteVpnGateway"); try { #if DESKTOP return(client.DeleteVpnGateway(request)); #elif CORECLR return(client.DeleteVpnGatewayAsync(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 DeleteVpnGateway operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.DeleteVpnGateway"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteVpnGateway 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<DeleteVpnGatewayResponse> DeleteVpnGatewayAsync(DeleteVpnGatewayRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteVpnGatewayRequestMarshaller(); var unmarshaller = DeleteVpnGatewayResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, DeleteVpnGatewayRequest, DeleteVpnGatewayResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// <para> Deletes a VPN gateway. Use this when you want to delete a VPC and all its associated components because you no longer need them. We /// recommend that before you delete a VPN gateway, you detach it from the VPC and delete the VPN connection. Note that you don't need to delete /// the VPN gateway if you just want to delete and re-create the VPN connection between your VPC and data center. </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteVpnGateway service method on /// AmazonEC2.</param> public DeleteVpnGatewayResponse DeleteVpnGateway(DeleteVpnGatewayRequest request) { var task = DeleteVpnGatewayAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }