Container for the parameters to the CreateVpnConnection operation. Creates a VPN connection between an existing virtual private gateway and a VPN customer gateway. The only supported connection type is ipsec.1.

The response includes information that you need to give to your network administrator to configure your customer gateway.

We strongly recommend that you use HTTPS when calling this operation because the response contains sensitive cryptographic information for configuring your customer gateway.

If you decide to shut down your VPN connection for any reason and later create a new VPN connection, you must reconfigure your customer gateway with the new information returned from this call.

This is an idempotent operation. If you perform the operation more than once, Amazon EC2 doesn't return an error.

For more information about VPN connections, see Adding a Hardware Virtual Private Gateway to Your VPC in the Amazon Virtual Private Cloud User Guide.

Inheritance: AmazonEC2Request
 protected override void ProcessRecord()
 {
     AmazonEC2 client = base.GetClient();
     Amazon.EC2.Model.CreateVpnConnectionRequest request = new Amazon.EC2.Model.CreateVpnConnectionRequest();
     request.Type = this._Type;
     request.CustomerGatewayId = this._CustomerGatewayId;
     request.VpnGatewayId = this._VpnGatewayId;
     Amazon.EC2.Model.CreateVpnConnectionResponse response = client.CreateVpnConnection(request);
     base.WriteObject(response.CreateVpnConnectionResult.VpnConnection, true);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the CreateVpnConnection operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateVpnConnection 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<CreateVpnConnectionResponse> CreateVpnConnectionAsync(CreateVpnConnectionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateVpnConnectionRequestMarshaller();
            var unmarshaller = CreateVpnConnectionResponseUnmarshaller.Instance;

            return InvokeAsync<CreateVpnConnectionRequest,CreateVpnConnectionResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
        /// <summary>
        /// Creates a VPN connection between an existing virtual private gateway and a VPN customer
        /// gateway. The only supported connection type is <code>ipsec.1</code>.
        /// 
        ///  
        /// <para>
        /// The response includes information that you need to give to your network administrator
        /// to configure your customer gateway.
        /// </para>
        ///  <important> 
        /// <para>
        /// We strongly recommend that you use HTTPS when calling this operation because the response
        /// contains sensitive cryptographic information for configuring your customer gateway.
        /// </para>
        ///  </important> 
        /// <para>
        /// If you decide to shut down your VPN connection for any reason and later create a new
        /// VPN connection, you must reconfigure your customer gateway with the new information
        /// returned from this call.
        /// </para>
        ///  
        /// <para>
        /// For more information about VPN connections, 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="request">Container for the necessary parameters to execute the CreateVpnConnection service method.</param>
        /// 
        /// <returns>The response from the CreateVpnConnection service method, as returned by EC2.</returns>
        public CreateVpnConnectionResponse CreateVpnConnection(CreateVpnConnectionRequest request)
        {
            var marshaller = new CreateVpnConnectionRequestMarshaller();
            var unmarshaller = CreateVpnConnectionResponseUnmarshaller.Instance;

            return Invoke<CreateVpnConnectionRequest,CreateVpnConnectionResponse>(request, marshaller, unmarshaller);
        }
Esempio n. 4
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateVpnConnection operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateVpnConnection 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 EndCreateVpnConnection
        ///         operation.</returns>
        public IAsyncResult BeginCreateVpnConnection(CreateVpnConnectionRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new CreateVpnConnectionRequestMarshaller();
            var unmarshaller = CreateVpnConnectionResponseUnmarshaller.Instance;

            return BeginInvoke<CreateVpnConnectionRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
Esempio n. 5
0
 private Amazon.EC2.Model.CreateVpnConnectionResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.CreateVpnConnectionRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "CreateVpnConnection");
     try
     {
         #if DESKTOP
         return(client.CreateVpnConnection(request));
         #elif CORECLR
         return(client.CreateVpnConnectionAsync(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;
     }
 }
Esempio n. 6
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.EC2.Model.CreateVpnConnectionRequest();

            if (cmdletContext.CustomerGatewayId != null)
            {
                request.CustomerGatewayId = cmdletContext.CustomerGatewayId;
            }

            // populate Options
            var requestOptionsIsNull = true;

            request.Options = new Amazon.EC2.Model.VpnConnectionOptionsSpecification();
            System.Boolean?requestOptions_options_EnableAcceleration = null;
            if (cmdletContext.Options_EnableAcceleration != null)
            {
                requestOptions_options_EnableAcceleration = cmdletContext.Options_EnableAcceleration.Value;
            }
            if (requestOptions_options_EnableAcceleration != null)
            {
                request.Options.EnableAcceleration = requestOptions_options_EnableAcceleration.Value;
                requestOptionsIsNull = false;
            }
            System.String requestOptions_options_LocalIpv4NetworkCidr = null;
            if (cmdletContext.Options_LocalIpv4NetworkCidr != null)
            {
                requestOptions_options_LocalIpv4NetworkCidr = cmdletContext.Options_LocalIpv4NetworkCidr;
            }
            if (requestOptions_options_LocalIpv4NetworkCidr != null)
            {
                request.Options.LocalIpv4NetworkCidr = requestOptions_options_LocalIpv4NetworkCidr;
                requestOptionsIsNull = false;
            }
            System.String requestOptions_options_LocalIpv6NetworkCidr = null;
            if (cmdletContext.Options_LocalIpv6NetworkCidr != null)
            {
                requestOptions_options_LocalIpv6NetworkCidr = cmdletContext.Options_LocalIpv6NetworkCidr;
            }
            if (requestOptions_options_LocalIpv6NetworkCidr != null)
            {
                request.Options.LocalIpv6NetworkCidr = requestOptions_options_LocalIpv6NetworkCidr;
                requestOptionsIsNull = false;
            }
            System.String requestOptions_options_RemoteIpv4NetworkCidr = null;
            if (cmdletContext.Options_RemoteIpv4NetworkCidr != null)
            {
                requestOptions_options_RemoteIpv4NetworkCidr = cmdletContext.Options_RemoteIpv4NetworkCidr;
            }
            if (requestOptions_options_RemoteIpv4NetworkCidr != null)
            {
                request.Options.RemoteIpv4NetworkCidr = requestOptions_options_RemoteIpv4NetworkCidr;
                requestOptionsIsNull = false;
            }
            System.String requestOptions_options_RemoteIpv6NetworkCidr = null;
            if (cmdletContext.Options_RemoteIpv6NetworkCidr != null)
            {
                requestOptions_options_RemoteIpv6NetworkCidr = cmdletContext.Options_RemoteIpv6NetworkCidr;
            }
            if (requestOptions_options_RemoteIpv6NetworkCidr != null)
            {
                request.Options.RemoteIpv6NetworkCidr = requestOptions_options_RemoteIpv6NetworkCidr;
                requestOptionsIsNull = false;
            }
            System.Boolean?requestOptions_options_StaticRoutesOnly = null;
            if (cmdletContext.Options_StaticRoutesOnly != null)
            {
                requestOptions_options_StaticRoutesOnly = cmdletContext.Options_StaticRoutesOnly.Value;
            }
            if (requestOptions_options_StaticRoutesOnly != null)
            {
                request.Options.StaticRoutesOnly = requestOptions_options_StaticRoutesOnly.Value;
                requestOptionsIsNull             = false;
            }
            Amazon.EC2.TunnelInsideIpVersion requestOptions_options_TunnelInsideIpVersion = null;
            if (cmdletContext.Options_TunnelInsideIpVersion != null)
            {
                requestOptions_options_TunnelInsideIpVersion = cmdletContext.Options_TunnelInsideIpVersion;
            }
            if (requestOptions_options_TunnelInsideIpVersion != null)
            {
                request.Options.TunnelInsideIpVersion = requestOptions_options_TunnelInsideIpVersion;
                requestOptionsIsNull = false;
            }
            List <Amazon.EC2.Model.VpnTunnelOptionsSpecification> requestOptions_options_TunnelOption = null;

            if (cmdletContext.Options_TunnelOption != null)
            {
                requestOptions_options_TunnelOption = cmdletContext.Options_TunnelOption;
            }
            if (requestOptions_options_TunnelOption != null)
            {
                request.Options.TunnelOptions = requestOptions_options_TunnelOption;
                requestOptionsIsNull          = false;
            }
            // determine if request.Options should be set to null
            if (requestOptionsIsNull)
            {
                request.Options = null;
            }
            if (cmdletContext.TagSpecification != null)
            {
                request.TagSpecifications = cmdletContext.TagSpecification;
            }
            if (cmdletContext.TransitGatewayId != null)
            {
                request.TransitGatewayId = cmdletContext.TransitGatewayId;
            }
            if (cmdletContext.Type != null)
            {
                request.Type = cmdletContext.Type;
            }
            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);
        }
Esempio n. 7
0
 IAsyncResult invokeCreateVpnConnection(CreateVpnConnectionRequest createVpnConnectionRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new CreateVpnConnectionRequestMarshaller().Marshall(createVpnConnectionRequest);
     var unmarshaller = CreateVpnConnectionResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
Esempio n. 8
0
 /// <summary>
 /// Initiates the asynchronous execution of the CreateVpnConnection operation.
 /// <seealso cref="Amazon.EC2.IAmazonEC2.CreateVpnConnection"/>
 /// </summary>
 /// 
 /// <param name="createVpnConnectionRequest">Container for the necessary parameters to execute the CreateVpnConnection 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
 ///         EndCreateVpnConnection operation.</returns>
 public IAsyncResult BeginCreateVpnConnection(CreateVpnConnectionRequest createVpnConnectionRequest, AsyncCallback callback, object state)
 {
     return invokeCreateVpnConnection(createVpnConnectionRequest, callback, state, false);
 }
Esempio n. 9
0
 /// <summary>
 /// <para>Creates a VPN connection between an existing virtual private gateway and a VPN customer gateway. The only supported connection type is
 /// <c>ipsec.1</c> .</para> <para>The response includes information that you need to give to your network administrator to configure your
 /// customer gateway.</para> <para><b>IMPORTANT:</b> We strongly recommend that you use HTTPS when calling this operation because the response
 /// contains sensitive cryptographic information for configuring your customer gateway. </para> <para>If you decide to shut down your VPN
 /// connection for any reason and later create a new VPN connection, you must reconfigure your customer gateway with the new information
 /// returned from this call.</para> <para>For more information about VPN connections, 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="createVpnConnectionRequest">Container for the necessary parameters to execute the CreateVpnConnection service method on
 ///          AmazonEC2.</param>
 /// 
 /// <returns>The response from the CreateVpnConnection service method, as returned by AmazonEC2.</returns>
 /// 
 public CreateVpnConnectionResponse CreateVpnConnection(CreateVpnConnectionRequest createVpnConnectionRequest)
 {
     IAsyncResult asyncResult = invokeCreateVpnConnection(createVpnConnectionRequest, null, null, true);
     return EndCreateVpnConnection(asyncResult);
 }
Esempio n. 10
0
        /// <summary>
        /// <para>Creates a VPN connection between an existing virtual private gateway and a VPN customer gateway. The only supported connection type is
        /// <c>ipsec.1</c> .</para> <para>The response includes information that you need to give to your network administrator to configure your
        /// customer gateway.</para> <para><b>IMPORTANT:</b> We strongly recommend that you use HTTPS when calling this operation because the response
        /// contains sensitive cryptographic information for configuring your customer gateway. </para> <para>If you decide to shut down your VPN
        /// connection for any reason and later create a new VPN connection, you must reconfigure your customer gateway with the new information
        /// returned from this call.</para> <para>For more information about VPN connections, 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="createVpnConnectionRequest">Container for the necessary parameters to execute the CreateVpnConnection service method on
        /// AmazonEC2.</param>
        /// 
        /// <returns>The response from the CreateVpnConnection 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<CreateVpnConnectionResponse> CreateVpnConnectionAsync(CreateVpnConnectionRequest createVpnConnectionRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateVpnConnectionRequestMarshaller();
            var unmarshaller = CreateVpnConnectionResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, CreateVpnConnectionRequest, CreateVpnConnectionResponse>(createVpnConnectionRequest, marshaller, unmarshaller, signer, cancellationToken);
        }
Esempio n. 11
0
		internal CreateVpnConnectionResponse CreateVpnConnection(CreateVpnConnectionRequest request)
        {
            var task = CreateVpnConnectionAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateVpnConnection operation.
        /// <seealso cref="Amazon.EC2.IAmazonEC2.CreateVpnConnection"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateVpnConnection 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<CreateVpnConnectionResponse> CreateVpnConnectionAsync(CreateVpnConnectionRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateVpnConnectionRequestMarshaller();
            var unmarshaller = CreateVpnConnectionResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, CreateVpnConnectionRequest, CreateVpnConnectionResponse>(request, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
Esempio n. 13
0
        /// <summary>
        /// <para> Creates a new VPN connection between an existing VPN gateway and customer gateway. The only supported connection type is ipsec.1.
        /// </para> <para> The response includes information that you need to configure your customer gateway, in XML format. We recommend you use the
        /// command line version of this operation ( <c>ec2-create-vpn-connection</c> ), which takes an <c>-f</c> option (for format) and returns
        /// configuration information formatted as expected by the vendor you specified, or in a generic, human readable format. For information about
        /// the command, go to <c>ec2-create-vpn-connection</c> in the Amazon Virtual Private Cloud Command Line Reference. </para>
        /// <para><b>IMPORTANT:</b> We strongly recommend you use HTTPS when calling this operation because the response contains sensitive
        /// cryptographic information for configuring your customer gateway. If you decide to shut down your VPN connection for any reason and then
        /// create a new one, you must re-configure your customer gateway with the new information returned from this call. </para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateVpnConnection service method on
        /// AmazonEC2.</param>
        /// 
        /// <returns>The response from the CreateVpnConnection service method, as returned by AmazonEC2.</returns>
		public CreateVpnConnectionResponse CreateVpnConnection(CreateVpnConnectionRequest request)
        {
            var task = CreateVpnConnectionAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }