// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;

namespace Pulumi.AliCloud.Vpn
{
    /// <summary>
    /// Provides a VPN Ipsec Server resource.
    /// 
    /// For information about VPN Ipsec Server and how to use it, see [What is Ipsec Server](https://www.alibabacloud.com/help/en/doc-detail/205454.html).
    /// 
    /// &gt; **NOTE:** Available in v1.161.0+.
    /// 
    /// ## Example Usage
    /// 
    /// Basic Usage
    /// 
    /// ```csharp
    /// using System.Collections.Generic;
    /// using Pulumi;
    /// using AliCloud = Pulumi.AliCloud;
    /// 
    /// return await Deployment.RunAsync(() =&gt; 
    /// {
    ///     var defaultZones = AliCloud.GetZones.Invoke(new()
    ///     {
    ///         AvailableResourceCreation = "VSwitch",
    ///     });
    /// 
    ///     var defaultNetworks = AliCloud.Vpc.GetNetworks.Invoke(new()
    ///     {
    ///         NameRegex = "default-NODELETING",
    ///     });
    /// 
    ///     var defaultSwitches = AliCloud.Vpc.GetSwitches.Invoke(new()
    ///     {
    ///         VpcId = defaultNetworks.Apply(getNetworksResult =&gt; getNetworksResult.Ids[0]),
    ///         ZoneId = defaultZones.Apply(getZonesResult =&gt; getZonesResult.Zones[0]?.Id),
    ///     });
    /// 
    ///     var vswitchId = defaultSwitches.Apply(getSwitchesResult =&gt; getSwitchesResult.Ids[0]);
    /// 
    ///     var defaultGateway = new AliCloud.Vpn.Gateway("defaultGateway", new()
    ///     {
    ///         VpcId = defaultNetworks.Apply(getNetworksResult =&gt; getNetworksResult.Ids[0]),
    ///         Bandwidth = 10,
    ///         EnableSsl = true,
    ///         EnableIpsec = true,
    ///         SslConnections = 5,
    ///         InstanceChargeType = "PrePaid",
    ///         VswitchId = vswitchId,
    ///     });
    /// 
    ///     var example = new AliCloud.Vpn.IpsecServer("example", new()
    ///     {
    ///         ClientIpPool = "example_value",
    ///         IpsecServerName = "example_value",
    ///         LocalSubnet = "example_value",
    ///         VpnGatewayId = defaultGateway.Id,
    ///     });
    /// 
    /// });
    /// ```
    /// 
    /// ## Import
    /// 
    /// VPN Ipsec Server can be imported using the id, e.g.
    /// 
    /// ```sh
    ///  $ pulumi import alicloud:vpn/ipsecServer:IpsecServer example &lt;id&gt;
    /// ```
    /// </summary>
    [AliCloudResourceType("alicloud:vpn/ipsecServer:IpsecServer")]
    public partial class IpsecServer : global::Pulumi.CustomResource
    {
        /// <summary>
        /// The client CIDR block. It refers to the CIDR block that is allocated to the virtual interface of the client.
        /// </summary>
        [Output("clientIpPool")]
        public Output<string> ClientIpPool { get; private set; } = null!;

        /// <summary>
        /// The dry run.
        /// </summary>
        [Output("dryRun")]
        public Output<bool?> DryRun { get; private set; } = null!;

        /// <summary>
        /// Specifies whether you want the configuration to immediately take effect.
        /// </summary>
        [Output("effectImmediately")]
        public Output<bool?> EffectImmediately { get; private set; } = null!;

        /// <summary>
        /// The configuration of Phase 1 negotiations. See the following `Block ike_config`.
        /// </summary>
        [Output("ikeConfigs")]
        public Output<ImmutableArray<Outputs.IpsecServerIkeConfig>> IkeConfigs { get; private set; } = null!;

        /// <summary>
        /// The configuration of Phase 2 negotiations. See the following `Block ipsec_config`.
        /// </summary>
        [Output("ipsecConfigs")]
        public Output<ImmutableArray<Outputs.IpsecServerIpsecConfig>> IpsecConfigs { get; private set; } = null!;

        /// <summary>
        /// The name of the IPsec server. The name must be `2` to `128` characters in length, and can contain digits, hyphens (-), and underscores (_). It must start with a letter.
        /// </summary>
        [Output("ipsecServerName")]
        public Output<string?> IpsecServerName { get; private set; } = null!;

        /// <summary>
        /// The local CIDR block. It refers to the CIDR block of the virtual private cloud (VPC) that is used to connect with the client. Separate multiple CIDR blocks with commas (,). Example: `192.168.1.0/24,192.168.2.0/24`.
        /// </summary>
        [Output("localSubnet")]
        public Output<string> LocalSubnet { get; private set; } = null!;

        /// <summary>
        /// The pre-shared key. The pre-shared key is used to authenticate the VPN gateway and the client. By default, the system generates a random string that is 16 bits in length. You can also specify the pre-shared key. It can contain at most 100 characters.
        /// </summary>
        [Output("psk")]
        public Output<string> Psk { get; private set; } = null!;

        /// <summary>
        /// Whether to enable the pre-shared key authentication method. The value is only `true`, which indicates that the pre-shared key authentication method is enabled.
        /// </summary>
        [Output("pskEnabled")]
        public Output<bool?> PskEnabled { get; private set; } = null!;

        /// <summary>
        /// The ID of the VPN gateway.
        /// </summary>
        [Output("vpnGatewayId")]
        public Output<string> VpnGatewayId { get; private set; } = null!;


        /// <summary>
        /// Create a IpsecServer resource with the given unique name, arguments, and options.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resource</param>
        /// <param name="args">The arguments used to populate this resource's properties</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public IpsecServer(string name, IpsecServerArgs args, CustomResourceOptions? options = null)
            : base("alicloud:vpn/ipsecServer:IpsecServer", name, args ?? new IpsecServerArgs(), MakeResourceOptions(options, ""))
        {
        }

        private IpsecServer(string name, Input<string> id, IpsecServerState? state = null, CustomResourceOptions? options = null)
            : base("alicloud:vpn/ipsecServer:IpsecServer", name, state, MakeResourceOptions(options, id))
        {
        }

        private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
        {
            var defaultOptions = new CustomResourceOptions
            {
                Version = Utilities.Version,
                PluginDownloadURL = "github://api.github.com/rhysmdnz/pulumi-alicloud",
            };
            var merged = CustomResourceOptions.Merge(defaultOptions, options);
            // Override the ID if one was specified for consistency with other language SDKs.
            merged.Id = id ?? merged.Id;
            return merged;
        }
        /// <summary>
        /// Get an existing IpsecServer resource's state with the given name, ID, and optional extra
        /// properties used to qualify the lookup.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resulting resource.</param>
        /// <param name="id">The unique provider ID of the resource to lookup.</param>
        /// <param name="state">Any extra arguments used during the lookup.</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public static IpsecServer Get(string name, Input<string> id, IpsecServerState? state = null, CustomResourceOptions? options = null)
        {
            return new IpsecServer(name, id, state, options);
        }
    }

    public sealed class IpsecServerArgs : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// The client CIDR block. It refers to the CIDR block that is allocated to the virtual interface of the client.
        /// </summary>
        [Input("clientIpPool", required: true)]
        public Input<string> ClientIpPool { get; set; } = null!;

        /// <summary>
        /// The dry run.
        /// </summary>
        [Input("dryRun")]
        public Input<bool>? DryRun { get; set; }

        /// <summary>
        /// Specifies whether you want the configuration to immediately take effect.
        /// </summary>
        [Input("effectImmediately")]
        public Input<bool>? EffectImmediately { get; set; }

        [Input("ikeConfigs")]
        private InputList<Inputs.IpsecServerIkeConfigArgs>? _ikeConfigs;

        /// <summary>
        /// The configuration of Phase 1 negotiations. See the following `Block ike_config`.
        /// </summary>
        public InputList<Inputs.IpsecServerIkeConfigArgs> IkeConfigs
        {
            get => _ikeConfigs ?? (_ikeConfigs = new InputList<Inputs.IpsecServerIkeConfigArgs>());
            set => _ikeConfigs = value;
        }

        [Input("ipsecConfigs")]
        private InputList<Inputs.IpsecServerIpsecConfigArgs>? _ipsecConfigs;

        /// <summary>
        /// The configuration of Phase 2 negotiations. See the following `Block ipsec_config`.
        /// </summary>
        public InputList<Inputs.IpsecServerIpsecConfigArgs> IpsecConfigs
        {
            get => _ipsecConfigs ?? (_ipsecConfigs = new InputList<Inputs.IpsecServerIpsecConfigArgs>());
            set => _ipsecConfigs = value;
        }

        /// <summary>
        /// The name of the IPsec server. The name must be `2` to `128` characters in length, and can contain digits, hyphens (-), and underscores (_). It must start with a letter.
        /// </summary>
        [Input("ipsecServerName")]
        public Input<string>? IpsecServerName { get; set; }

        /// <summary>
        /// The local CIDR block. It refers to the CIDR block of the virtual private cloud (VPC) that is used to connect with the client. Separate multiple CIDR blocks with commas (,). Example: `192.168.1.0/24,192.168.2.0/24`.
        /// </summary>
        [Input("localSubnet", required: true)]
        public Input<string> LocalSubnet { get; set; } = null!;

        /// <summary>
        /// The pre-shared key. The pre-shared key is used to authenticate the VPN gateway and the client. By default, the system generates a random string that is 16 bits in length. You can also specify the pre-shared key. It can contain at most 100 characters.
        /// </summary>
        [Input("psk")]
        public Input<string>? Psk { get; set; }

        /// <summary>
        /// Whether to enable the pre-shared key authentication method. The value is only `true`, which indicates that the pre-shared key authentication method is enabled.
        /// </summary>
        [Input("pskEnabled")]
        public Input<bool>? PskEnabled { get; set; }

        /// <summary>
        /// The ID of the VPN gateway.
        /// </summary>
        [Input("vpnGatewayId", required: true)]
        public Input<string> VpnGatewayId { get; set; } = null!;

        public IpsecServerArgs()
        {
        }
        public static new IpsecServerArgs Empty => new IpsecServerArgs();
    }

    public sealed class IpsecServerState : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// The client CIDR block. It refers to the CIDR block that is allocated to the virtual interface of the client.
        /// </summary>
        [Input("clientIpPool")]
        public Input<string>? ClientIpPool { get; set; }

        /// <summary>
        /// The dry run.
        /// </summary>
        [Input("dryRun")]
        public Input<bool>? DryRun { get; set; }

        /// <summary>
        /// Specifies whether you want the configuration to immediately take effect.
        /// </summary>
        [Input("effectImmediately")]
        public Input<bool>? EffectImmediately { get; set; }

        [Input("ikeConfigs")]
        private InputList<Inputs.IpsecServerIkeConfigGetArgs>? _ikeConfigs;

        /// <summary>
        /// The configuration of Phase 1 negotiations. See the following `Block ike_config`.
        /// </summary>
        public InputList<Inputs.IpsecServerIkeConfigGetArgs> IkeConfigs
        {
            get => _ikeConfigs ?? (_ikeConfigs = new InputList<Inputs.IpsecServerIkeConfigGetArgs>());
            set => _ikeConfigs = value;
        }

        [Input("ipsecConfigs")]
        private InputList<Inputs.IpsecServerIpsecConfigGetArgs>? _ipsecConfigs;

        /// <summary>
        /// The configuration of Phase 2 negotiations. See the following `Block ipsec_config`.
        /// </summary>
        public InputList<Inputs.IpsecServerIpsecConfigGetArgs> IpsecConfigs
        {
            get => _ipsecConfigs ?? (_ipsecConfigs = new InputList<Inputs.IpsecServerIpsecConfigGetArgs>());
            set => _ipsecConfigs = value;
        }

        /// <summary>
        /// The name of the IPsec server. The name must be `2` to `128` characters in length, and can contain digits, hyphens (-), and underscores (_). It must start with a letter.
        /// </summary>
        [Input("ipsecServerName")]
        public Input<string>? IpsecServerName { get; set; }

        /// <summary>
        /// The local CIDR block. It refers to the CIDR block of the virtual private cloud (VPC) that is used to connect with the client. Separate multiple CIDR blocks with commas (,). Example: `192.168.1.0/24,192.168.2.0/24`.
        /// </summary>
        [Input("localSubnet")]
        public Input<string>? LocalSubnet { get; set; }

        /// <summary>
        /// The pre-shared key. The pre-shared key is used to authenticate the VPN gateway and the client. By default, the system generates a random string that is 16 bits in length. You can also specify the pre-shared key. It can contain at most 100 characters.
        /// </summary>
        [Input("psk")]
        public Input<string>? Psk { get; set; }

        /// <summary>
        /// Whether to enable the pre-shared key authentication method. The value is only `true`, which indicates that the pre-shared key authentication method is enabled.
        /// </summary>
        [Input("pskEnabled")]
        public Input<bool>? PskEnabled { get; set; }

        /// <summary>
        /// The ID of the VPN gateway.
        /// </summary>
        [Input("vpnGatewayId")]
        public Input<string>? VpnGatewayId { get; set; }

        public IpsecServerState()
        {
        }
        public static new IpsecServerState Empty => new IpsecServerState();
    }
}
