public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.EC2.Model.AcceptVpcPeeringConnectionRequest(); 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 AcceptVpcPeeringConnection operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the AcceptVpcPeeringConnection 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<AcceptVpcPeeringConnectionResponse> AcceptVpcPeeringConnectionAsync(AcceptVpcPeeringConnectionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new AcceptVpcPeeringConnectionRequestMarshaller(); var unmarshaller = AcceptVpcPeeringConnectionResponseUnmarshaller.Instance; return InvokeAsync<AcceptVpcPeeringConnectionRequest,AcceptVpcPeeringConnectionResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Accept a VPC peering connection request. To accept a request, the VPC peering connection /// must be in the <code>pending-acceptance</code> state, and you must be the owner of /// the peer VPC. Use the <code>DescribeVpcPeeringConnections</code> request to view your /// outstanding VPC peering connection requests. /// </summary> /// <param name="request">Container for the necessary parameters to execute the AcceptVpcPeeringConnection service method.</param> /// /// <returns>The response from the AcceptVpcPeeringConnection service method, as returned by EC2.</returns> public AcceptVpcPeeringConnectionResponse AcceptVpcPeeringConnection(AcceptVpcPeeringConnectionRequest request) { var marshaller = new AcceptVpcPeeringConnectionRequestMarshaller(); var unmarshaller = AcceptVpcPeeringConnectionResponseUnmarshaller.Instance; return Invoke<AcceptVpcPeeringConnectionRequest,AcceptVpcPeeringConnectionResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the AcceptVpcPeeringConnection operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the AcceptVpcPeeringConnection 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 EndAcceptVpcPeeringConnection /// operation.</returns> public IAsyncResult BeginAcceptVpcPeeringConnection(AcceptVpcPeeringConnectionRequest request, AsyncCallback callback, object state) { var marshaller = new AcceptVpcPeeringConnectionRequestMarshaller(); var unmarshaller = AcceptVpcPeeringConnectionResponseUnmarshaller.Instance; return BeginInvoke<AcceptVpcPeeringConnectionRequest>(request, marshaller, unmarshaller, callback, state); }
IAsyncResult invokeAcceptVpcPeeringConnection(AcceptVpcPeeringConnectionRequest acceptVpcPeeringConnectionRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new AcceptVpcPeeringConnectionRequestMarshaller().Marshall(acceptVpcPeeringConnectionRequest); var unmarshaller = AcceptVpcPeeringConnectionResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the AcceptVpcPeeringConnection operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.AcceptVpcPeeringConnection"/> /// </summary> /// /// <param name="acceptVpcPeeringConnectionRequest">Container for the necessary parameters to execute the AcceptVpcPeeringConnection 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> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking /// EndAcceptVpcPeeringConnection operation.</returns> public IAsyncResult BeginAcceptVpcPeeringConnection(AcceptVpcPeeringConnectionRequest acceptVpcPeeringConnectionRequest, AsyncCallback callback, object state) { return invokeAcceptVpcPeeringConnection(acceptVpcPeeringConnectionRequest, callback, state, false); }
/// <summary> /// <para>Accept a VPC peering connection request. To accept a request, the VPC peering connection must be in the <c>pending-acceptance</c> /// state, and you must be the owner of the peer VPC. Use the <c>DescribeVpcPeeringConnections</c> request to view your outstanding VPC peering /// connection requests.</para> /// </summary> /// /// <param name="acceptVpcPeeringConnectionRequest">Container for the necessary parameters to execute the AcceptVpcPeeringConnection service /// method on AmazonEC2.</param> /// /// <returns>The response from the AcceptVpcPeeringConnection service method, as returned by AmazonEC2.</returns> /// public AcceptVpcPeeringConnectionResponse AcceptVpcPeeringConnection(AcceptVpcPeeringConnectionRequest acceptVpcPeeringConnectionRequest) { IAsyncResult asyncResult = invokeAcceptVpcPeeringConnection(acceptVpcPeeringConnectionRequest, null, null, true); return EndAcceptVpcPeeringConnection(asyncResult); }
/// <summary> /// <para>Accept a VPC peering connection request. To accept a request, the VPC peering connection must be in the <c>pending-acceptance</c> /// state, and you must be the owner of the peer VPC. Use the <c>DescribeVpcPeeringConnections</c> request to view your outstanding VPC peering /// connection requests.</para> /// </summary> /// /// <param name="acceptVpcPeeringConnectionRequest">Container for the necessary parameters to execute the AcceptVpcPeeringConnection service /// method on AmazonEC2.</param> /// /// <returns>The response from the AcceptVpcPeeringConnection 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<AcceptVpcPeeringConnectionResponse> AcceptVpcPeeringConnectionAsync(AcceptVpcPeeringConnectionRequest acceptVpcPeeringConnectionRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new AcceptVpcPeeringConnectionRequestMarshaller(); var unmarshaller = AcceptVpcPeeringConnectionResponseUnmarshaller.GetInstance(); return Invoke<IRequest, AcceptVpcPeeringConnectionRequest, AcceptVpcPeeringConnectionResponse>(acceptVpcPeeringConnectionRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal AcceptVpcPeeringConnectionResponse AcceptVpcPeeringConnection(AcceptVpcPeeringConnectionRequest request) { var task = AcceptVpcPeeringConnectionAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
private Amazon.EC2.Model.AcceptVpcPeeringConnectionResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.AcceptVpcPeeringConnectionRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "AcceptVpcPeeringConnection"); try { #if DESKTOP return(client.AcceptVpcPeeringConnection(request)); #elif CORECLR return(client.AcceptVpcPeeringConnectionAsync(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; } }