public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.EC2.Model.CreateCustomerGatewayRequest(); if (cmdletContext.BgpAsn != null) { request.BgpAsn = cmdletContext.BgpAsn.Value; } if (cmdletContext.CertificateArn != null) { request.CertificateArn = cmdletContext.CertificateArn; } if (cmdletContext.DeviceName != null) { request.DeviceName = cmdletContext.DeviceName; } if (cmdletContext.PublicIp != null) { request.PublicIp = cmdletContext.PublicIp; } if (cmdletContext.TagSpecification != null) { request.TagSpecifications = cmdletContext.TagSpecification; } if (cmdletContext.Type != null) { request.Type = cmdletContext.Type; } 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); }
protected override void ProcessRecord() { AmazonEC2 client = base.GetClient(); Amazon.EC2.Model.CreateCustomerGatewayRequest request = new Amazon.EC2.Model.CreateCustomerGatewayRequest(); request.Type = this._Type; request.IpAddress = this._IpAddress; request.BgpAsn = this._BgpAsn; Amazon.EC2.Model.CreateCustomerGatewayResponse response = client.CreateCustomerGateway(request); base.WriteObject(response.CreateCustomerGatewayResult.CustomerGateway, true); }
/// <summary> /// Initiates the asynchronous execution of the CreateCustomerGateway operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateCustomerGateway 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<CreateCustomerGatewayResponse> CreateCustomerGatewayAsync(CreateCustomerGatewayRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateCustomerGatewayRequestMarshaller(); var unmarshaller = CreateCustomerGatewayResponseUnmarshaller.Instance; return InvokeAsync<CreateCustomerGatewayRequest,CreateCustomerGatewayResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Provides information to AWS about your VPN customer gateway device. The customer gateway /// is the appliance at your end of the VPN connection. (The device on the AWS side of /// the VPN connection is the virtual private gateway.) You must provide the Internet-routable /// IP address of the customer gateway's external interface. The IP address must be static /// and can't be behind a device performing network address translation (NAT). /// /// /// <para> /// For devices that use Border Gateway Protocol (BGP), you can also provide the device's /// BGP Autonomous System Number (ASN). You can use an existing ASN assigned to your network. /// If you don't have an ASN already, you can use a private ASN (in the 64512 - 65534 /// range). /// </para> /// <note> /// <para> /// Amazon EC2 supports all 2-byte ASN numbers in the range of 1 - 65534, with the exception /// of 7224, which is reserved in the <code>us-east-1</code> region, and 9059, which is /// reserved in the <code>eu-west-1</code> region. /// </para> /// </note> /// <para> /// For more information about VPN customer gateways, see <a href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html">Adding /// a Hardware Virtual Private Gateway to Your VPC</a> in the <i>Amazon Virtual Private /// Cloud User Guide</i>. /// </para> /// <important> /// <para> /// You cannot create more than one customer gateway with the same VPN type, IP address, /// and BGP ASN parameter values. If you run an identical request more than one time, /// the first request creates the customer gateway, and subsequent requests return information /// about the existing customer gateway. The subsequent requests do not create new customer /// gateway resources. /// </para> /// </important> /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateCustomerGateway service method.</param> /// /// <returns>The response from the CreateCustomerGateway service method, as returned by EC2.</returns> public CreateCustomerGatewayResponse CreateCustomerGateway(CreateCustomerGatewayRequest request) { var marshaller = new CreateCustomerGatewayRequestMarshaller(); var unmarshaller = CreateCustomerGatewayResponseUnmarshaller.Instance; return Invoke<CreateCustomerGatewayRequest,CreateCustomerGatewayResponse>(request, marshaller, unmarshaller); }
private Amazon.EC2.Model.CreateCustomerGatewayResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.CreateCustomerGatewayRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "CreateCustomerGateway"); try { #if DESKTOP return(client.CreateCustomerGateway(request)); #elif CORECLR return(client.CreateCustomerGatewayAsync(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 CreateCustomerGateway operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateCustomerGateway 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 EndCreateCustomerGateway /// operation.</returns> public IAsyncResult BeginCreateCustomerGateway(CreateCustomerGatewayRequest request, AsyncCallback callback, object state) { var marshaller = new CreateCustomerGatewayRequestMarshaller(); var unmarshaller = CreateCustomerGatewayResponseUnmarshaller.Instance; return BeginInvoke<CreateCustomerGatewayRequest>(request, marshaller, unmarshaller, callback, state); }
IAsyncResult invokeCreateCustomerGateway(CreateCustomerGatewayRequest createCustomerGatewayRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new CreateCustomerGatewayRequestMarshaller().Marshall(createCustomerGatewayRequest); var unmarshaller = CreateCustomerGatewayResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the CreateCustomerGateway operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.CreateCustomerGateway"/> /// </summary> /// /// <param name="createCustomerGatewayRequest">Container for the necessary parameters to execute the CreateCustomerGateway 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 /// EndCreateCustomerGateway operation.</returns> public IAsyncResult BeginCreateCustomerGateway(CreateCustomerGatewayRequest createCustomerGatewayRequest, AsyncCallback callback, object state) { return invokeCreateCustomerGateway(createCustomerGatewayRequest, callback, state, false); }
/// <summary> /// <para>Provides information to AWS about your VPN customer gateway device. The customer gateway is the appliance at your end of the VPN /// connection. (The device on the AWS side of the VPN connection is the virtual private gateway.) You must provide the Internet-routable IP /// address of the customer gateway's external interface. The IP address must be static and can't be behind a device performing network address /// translation (NAT).</para> <para>For devices that use Border Gateway Protocol (BGP), you can also provide the device's BGP Autonomous System /// Number (ASN). You can use an existing ASN assigned to your network. If you don't have an ASN already, you can use a private ASN (in the /// 64512 - 65534 range).</para> <para><b>NOTE:</b> Amazon EC2 supports all 2-byte ASN numbers in the range of 1 - 65534, with the exception of /// 7224, which is reserved in the us-east-1 region, and 9059, which is reserved in the eu-west-1 region. </para> <para>For more information /// about VPN customer gateways, see <a href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html" >Adding a Hardware Virtual /// Private Gateway to Your VPC</a> in the <i>Amazon Virtual Private Cloud User Guide</i> .</para> /// </summary> /// /// <param name="createCustomerGatewayRequest">Container for the necessary parameters to execute the CreateCustomerGateway service method on /// AmazonEC2.</param> /// /// <returns>The response from the CreateCustomerGateway service method, as returned by AmazonEC2.</returns> /// public CreateCustomerGatewayResponse CreateCustomerGateway(CreateCustomerGatewayRequest createCustomerGatewayRequest) { IAsyncResult asyncResult = invokeCreateCustomerGateway(createCustomerGatewayRequest, null, null, true); return EndCreateCustomerGateway(asyncResult); }
/// <summary> /// <para>Provides information to AWS about your VPN customer gateway device. The customer gateway is the appliance at your end of the VPN /// connection. (The device on the AWS side of the VPN connection is the virtual private gateway.) You must provide the Internet-routable IP /// address of the customer gateway's external interface. The IP address must be static and can't be behind a device performing network address /// translation (NAT).</para> <para>For devices that use Border Gateway Protocol (BGP), you can also provide the device's BGP Autonomous System /// Number (ASN). You can use an existing ASN assigned to your network. If you don't have an ASN already, you can use a private ASN (in the /// 64512 - 65534 range).</para> <para><b>NOTE:</b> Amazon EC2 supports all 2-byte ASN numbers in the range of 1 - 65534, with the exception of /// 7224, which is reserved in the us-east-1 region, and 9059, which is reserved in the eu-west-1 region. </para> <para>For more information /// about VPN customer gateways, see <a href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_VPN.html">Adding a Hardware Virtual /// Private Gateway to Your VPC</a> in the <i>Amazon Virtual Private Cloud User Guide</i> .</para> /// </summary> /// /// <param name="createCustomerGatewayRequest">Container for the necessary parameters to execute the CreateCustomerGateway service method on /// AmazonEC2.</param> /// /// <returns>The response from the CreateCustomerGateway 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<CreateCustomerGatewayResponse> CreateCustomerGatewayAsync(CreateCustomerGatewayRequest createCustomerGatewayRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateCustomerGatewayRequestMarshaller(); var unmarshaller = CreateCustomerGatewayResponseUnmarshaller.GetInstance(); return Invoke<IRequest, CreateCustomerGatewayRequest, CreateCustomerGatewayResponse>(createCustomerGatewayRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal CreateCustomerGatewayResponse CreateCustomerGateway(CreateCustomerGatewayRequest request) { var task = CreateCustomerGatewayAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// Initiates the asynchronous execution of the CreateCustomerGateway operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.CreateCustomerGateway"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateCustomerGateway 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<CreateCustomerGatewayResponse> CreateCustomerGatewayAsync(CreateCustomerGatewayRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateCustomerGatewayRequestMarshaller(); var unmarshaller = CreateCustomerGatewayResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, CreateCustomerGatewayRequest, CreateCustomerGatewayResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// <para> Provides information to AWS about your customer gateway device. The customer gateway is the appliance at your end of the VPN /// connection (compared to the VPN gateway, which is the device at the AWS side of the VPN connection). You can have a single active customer /// gateway per AWS account (active means that you've created a VPN connection to use with the customer gateway). AWS might delete any customer /// gateway that you create with this operation if you leave it inactive for an extended period of time. </para> <para> You must provide the /// Internet-routable IP address of the customer gateway's external interface. The IP address must be static. </para> <para> You must also /// provide the device's Border Gateway Protocol (BGP) Autonomous System Number (ASN). You can use an existing ASN assigned to your network. If /// you don't have an ASN already, you can use a private ASN (in the 64512 - 65534 range). For more information about ASNs, go to <a href="http://en.wikipedia.org/wiki/Autonomous_system_%28Internet%29"> http://en.wikipedia.org/wiki/Autonomous_system_%28Internet%29</a> . /// </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateCustomerGateway service method on /// AmazonEC2.</param> /// /// <returns>The response from the CreateCustomerGateway service method, as returned by AmazonEC2.</returns> public CreateCustomerGatewayResponse CreateCustomerGateway(CreateCustomerGatewayRequest request) { var task = CreateCustomerGatewayAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }