public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.EC2.Model.UnassignPrivateIpAddressesRequest(); if (cmdletContext.Ipv4Prefix != null) { request.Ipv4Prefixes = cmdletContext.Ipv4Prefix; } if (cmdletContext.NetworkInterfaceId != null) { request.NetworkInterfaceId = cmdletContext.NetworkInterfaceId; } if (cmdletContext.PrivateIpAddress != null) { request.PrivateIpAddresses = cmdletContext.PrivateIpAddress; } 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 UnassignPrivateIpAddresses operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UnassignPrivateIpAddresses 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<UnassignPrivateIpAddressesResponse> UnassignPrivateIpAddressesAsync(UnassignPrivateIpAddressesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new UnassignPrivateIpAddressesRequestMarshaller(); var unmarshaller = UnassignPrivateIpAddressesResponseUnmarshaller.Instance; return InvokeAsync<UnassignPrivateIpAddressesRequest,UnassignPrivateIpAddressesResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Unassigns one or more secondary private IP addresses from a network interface. /// </summary> /// <param name="request">Container for the necessary parameters to execute the UnassignPrivateIpAddresses service method.</param> /// /// <returns>The response from the UnassignPrivateIpAddresses service method, as returned by EC2.</returns> public UnassignPrivateIpAddressesResponse UnassignPrivateIpAddresses(UnassignPrivateIpAddressesRequest request) { var marshaller = new UnassignPrivateIpAddressesRequestMarshaller(); var unmarshaller = UnassignPrivateIpAddressesResponseUnmarshaller.Instance; return Invoke<UnassignPrivateIpAddressesRequest,UnassignPrivateIpAddressesResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the UnassignPrivateIpAddresses operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UnassignPrivateIpAddresses 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 EndUnassignPrivateIpAddresses /// operation.</returns> public IAsyncResult BeginUnassignPrivateIpAddresses(UnassignPrivateIpAddressesRequest request, AsyncCallback callback, object state) { var marshaller = new UnassignPrivateIpAddressesRequestMarshaller(); var unmarshaller = UnassignPrivateIpAddressesResponseUnmarshaller.Instance; return BeginInvoke<UnassignPrivateIpAddressesRequest>(request, marshaller, unmarshaller, callback, state); }
IAsyncResult invokeUnassignPrivateIpAddresses(UnassignPrivateIpAddressesRequest unassignPrivateIpAddressesRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new UnassignPrivateIpAddressesRequestMarshaller().Marshall(unassignPrivateIpAddressesRequest); var unmarshaller = UnassignPrivateIpAddressesResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the UnassignPrivateIpAddresses operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.UnassignPrivateIpAddresses"/> /// </summary> /// /// <param name="unassignPrivateIpAddressesRequest">Container for the necessary parameters to execute the UnassignPrivateIpAddresses 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 BeginUnassignPrivateIpAddresses(UnassignPrivateIpAddressesRequest unassignPrivateIpAddressesRequest, AsyncCallback callback, object state) { return invokeUnassignPrivateIpAddresses(unassignPrivateIpAddressesRequest, callback, state, false); }
/// <summary> /// <para>Unassigns one or more secondary private IP addresses from a network interface.</para> /// </summary> /// /// <param name="unassignPrivateIpAddressesRequest">Container for the necessary parameters to execute the UnassignPrivateIpAddresses service /// method on AmazonEC2.</param> /// public UnassignPrivateIpAddressesResponse UnassignPrivateIpAddresses(UnassignPrivateIpAddressesRequest unassignPrivateIpAddressesRequest) { IAsyncResult asyncResult = invokeUnassignPrivateIpAddresses(unassignPrivateIpAddressesRequest, null, null, true); return EndUnassignPrivateIpAddresses(asyncResult); }
/// <summary> /// <para>Unassigns one or more secondary private IP addresses from a network interface.</para> /// </summary> /// /// <param name="unassignPrivateIpAddressesRequest">Container for the necessary parameters to execute the UnassignPrivateIpAddresses 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<UnassignPrivateIpAddressesResponse> UnassignPrivateIpAddressesAsync(UnassignPrivateIpAddressesRequest unassignPrivateIpAddressesRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new UnassignPrivateIpAddressesRequestMarshaller(); var unmarshaller = UnassignPrivateIpAddressesResponseUnmarshaller.GetInstance(); return Invoke<IRequest, UnassignPrivateIpAddressesRequest, UnassignPrivateIpAddressesResponse>(unassignPrivateIpAddressesRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal UnassignPrivateIpAddressesResponse UnassignPrivateIpAddresses(UnassignPrivateIpAddressesRequest request) { var task = UnassignPrivateIpAddressesAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// Initiates the asynchronous execution of the UnassignPrivateIpAddresses operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.UnassignPrivateIpAddresses"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UnassignPrivateIpAddresses 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<UnassignPrivateIpAddressesResponse> UnassignPrivateIpAddressesAsync(UnassignPrivateIpAddressesRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new UnassignPrivateIpAddressesRequestMarshaller(); var unmarshaller = UnassignPrivateIpAddressesResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, UnassignPrivateIpAddressesRequest, UnassignPrivateIpAddressesResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UnassignPrivateIpAddresses service /// method on AmazonEC2.</param> public UnassignPrivateIpAddressesResponse UnassignPrivateIpAddresses(UnassignPrivateIpAddressesRequest request) { var task = UnassignPrivateIpAddressesAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
private Amazon.EC2.Model.UnassignPrivateIpAddressesResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.UnassignPrivateIpAddressesRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "UnassignPrivateIpAddresses"); try { #if DESKTOP return(client.UnassignPrivateIpAddresses(request)); #elif CORECLR return(client.UnassignPrivateIpAddressesAsync(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; } }