"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.VirtualNetworkGatewayConnection = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a connection in an existing Virtual Network Gateway.
 *
 * ## Example Usage
 *
 * ### Site-to-Site connection
 *
 * The following example shows a connection between an Azure virtual network
 * and an on-premises VPN device and network.
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "test",
 *     location: "West US",
 * });
 * const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
 *     name: "test",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     addressSpaces: ["10.0.0.0/16"],
 * });
 * const exampleSubnet = new azure.network.Subnet("example", {
 *     name: "GatewaySubnet",
 *     resourceGroupName: example.name,
 *     virtualNetworkName: exampleVirtualNetwork.name,
 *     addressPrefixes: ["10.0.1.0/24"],
 * });
 * const onpremise = new azure.network.LocalNetworkGateway("onpremise", {
 *     name: "onpremise",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     gatewayAddress: "168.62.225.23",
 *     addressSpaces: ["10.1.1.0/24"],
 * });
 * const examplePublicIp = new azure.network.PublicIp("example", {
 *     name: "test",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     allocationMethod: "Dynamic",
 * });
 * const exampleVirtualNetworkGateway = new azure.network.VirtualNetworkGateway("example", {
 *     name: "test",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     type: "Vpn",
 *     vpnType: "RouteBased",
 *     activeActive: false,
 *     bgpEnabled: false,
 *     sku: "Basic",
 *     ipConfigurations: [{
 *         publicIpAddressId: examplePublicIp.id,
 *         privateIpAddressAllocation: "Dynamic",
 *         subnetId: exampleSubnet.id,
 *     }],
 * });
 * const onpremiseVirtualNetworkGatewayConnection = new azure.network.VirtualNetworkGatewayConnection("onpremise", {
 *     name: "onpremise",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     type: "IPsec",
 *     virtualNetworkGatewayId: exampleVirtualNetworkGateway.id,
 *     localNetworkGatewayId: onpremise.id,
 *     sharedKey: "4-v3ry-53cr37-1p53c-5h4r3d-k3y",
 * });
 * ```
 *
 * ### VNet-to-VNet connection
 *
 * The following example shows a connection between two Azure virtual network
 * in different locations/regions.
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const us = new azure.core.ResourceGroup("us", {
 *     name: "us",
 *     location: "East US",
 * });
 * const usVirtualNetwork = new azure.network.VirtualNetwork("us", {
 *     name: "us",
 *     location: us.location,
 *     resourceGroupName: us.name,
 *     addressSpaces: ["10.0.0.0/16"],
 * });
 * const usGateway = new azure.network.Subnet("us_gateway", {
 *     name: "GatewaySubnet",
 *     resourceGroupName: us.name,
 *     virtualNetworkName: usVirtualNetwork.name,
 *     addressPrefixes: ["10.0.1.0/24"],
 * });
 * const usPublicIp = new azure.network.PublicIp("us", {
 *     name: "us",
 *     location: us.location,
 *     resourceGroupName: us.name,
 *     allocationMethod: "Dynamic",
 * });
 * const usVirtualNetworkGateway = new azure.network.VirtualNetworkGateway("us", {
 *     name: "us-gateway",
 *     location: us.location,
 *     resourceGroupName: us.name,
 *     type: "Vpn",
 *     vpnType: "RouteBased",
 *     sku: "Basic",
 *     ipConfigurations: [{
 *         publicIpAddressId: usPublicIp.id,
 *         privateIpAddressAllocation: "Dynamic",
 *         subnetId: usGateway.id,
 *     }],
 * });
 * const europe = new azure.core.ResourceGroup("europe", {
 *     name: "europe",
 *     location: "West Europe",
 * });
 * const europeVirtualNetwork = new azure.network.VirtualNetwork("europe", {
 *     name: "europe",
 *     location: europe.location,
 *     resourceGroupName: europe.name,
 *     addressSpaces: ["10.1.0.0/16"],
 * });
 * const europeGateway = new azure.network.Subnet("europe_gateway", {
 *     name: "GatewaySubnet",
 *     resourceGroupName: europe.name,
 *     virtualNetworkName: europeVirtualNetwork.name,
 *     addressPrefixes: ["10.1.1.0/24"],
 * });
 * const europePublicIp = new azure.network.PublicIp("europe", {
 *     name: "europe",
 *     location: europe.location,
 *     resourceGroupName: europe.name,
 *     allocationMethod: "Dynamic",
 * });
 * const europeVirtualNetworkGateway = new azure.network.VirtualNetworkGateway("europe", {
 *     name: "europe-gateway",
 *     location: europe.location,
 *     resourceGroupName: europe.name,
 *     type: "Vpn",
 *     vpnType: "RouteBased",
 *     sku: "Basic",
 *     ipConfigurations: [{
 *         publicIpAddressId: europePublicIp.id,
 *         privateIpAddressAllocation: "Dynamic",
 *         subnetId: europeGateway.id,
 *     }],
 * });
 * const usToEurope = new azure.network.VirtualNetworkGatewayConnection("us_to_europe", {
 *     name: "us-to-europe",
 *     location: us.location,
 *     resourceGroupName: us.name,
 *     type: "Vnet2Vnet",
 *     virtualNetworkGatewayId: usVirtualNetworkGateway.id,
 *     peerVirtualNetworkGatewayId: europeVirtualNetworkGateway.id,
 *     sharedKey: "4-v3ry-53cr37-1p53c-5h4r3d-k3y",
 * });
 * const europeToUs = new azure.network.VirtualNetworkGatewayConnection("europe_to_us", {
 *     name: "europe-to-us",
 *     location: europe.location,
 *     resourceGroupName: europe.name,
 *     type: "Vnet2Vnet",
 *     virtualNetworkGatewayId: europeVirtualNetworkGateway.id,
 *     peerVirtualNetworkGatewayId: usVirtualNetworkGateway.id,
 *     sharedKey: "4-v3ry-53cr37-1p53c-5h4r3d-k3y",
 * });
 * ```
 *
 * ## API Providers
 *
 * <!-- This section is generated, changes will be overwritten -->
 * This resource uses the following Azure API Providers:
 *
 * * `Microsoft.Network` - 2025-01-01
 *
 * ## Import
 *
 * Virtual Network Gateway Connections can be imported using their `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:network/virtualNetworkGatewayConnection:VirtualNetworkGatewayConnection exampleConnection /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup1/providers/Microsoft.Network/connections/myConnection1
 * ```
 */
class VirtualNetworkGatewayConnection extends pulumi.CustomResource {
    /**
     * Get an existing VirtualNetworkGatewayConnection resource's state with the given name, ID, and optional extra
     * properties used to qualify the lookup.
     *
     * @param name The _unique_ name of the resulting resource.
     * @param id The _unique_ provider ID of the resource to lookup.
     * @param state Any extra arguments used during the lookup.
     * @param opts Optional settings to control the behavior of the CustomResource.
     */
    static get(name, id, state, opts) {
        return new VirtualNetworkGatewayConnection(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:network/virtualNetworkGatewayConnection:VirtualNetworkGatewayConnection';
    /**
     * Returns true if the given object is an instance of VirtualNetworkGatewayConnection.  This is designed to work even
     * when multiple copies of the Pulumi SDK have been loaded into the same process.
     */
    static isInstance(obj) {
        if (obj === undefined || obj === null) {
            return false;
        }
        return obj['__pulumiType'] === VirtualNetworkGatewayConnection.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["authorizationKey"] = state?.authorizationKey;
            resourceInputs["bgpEnabled"] = state?.bgpEnabled;
            resourceInputs["connectionMode"] = state?.connectionMode;
            resourceInputs["connectionProtocol"] = state?.connectionProtocol;
            resourceInputs["customBgpAddresses"] = state?.customBgpAddresses;
            resourceInputs["dpdTimeoutSeconds"] = state?.dpdTimeoutSeconds;
            resourceInputs["egressNatRuleIds"] = state?.egressNatRuleIds;
            resourceInputs["enableBgp"] = state?.enableBgp;
            resourceInputs["expressRouteCircuitId"] = state?.expressRouteCircuitId;
            resourceInputs["expressRouteGatewayBypass"] = state?.expressRouteGatewayBypass;
            resourceInputs["ingressNatRuleIds"] = state?.ingressNatRuleIds;
            resourceInputs["ipsecPolicy"] = state?.ipsecPolicy;
            resourceInputs["localAzureIpAddressEnabled"] = state?.localAzureIpAddressEnabled;
            resourceInputs["localNetworkGatewayId"] = state?.localNetworkGatewayId;
            resourceInputs["location"] = state?.location;
            resourceInputs["name"] = state?.name;
            resourceInputs["peerVirtualNetworkGatewayId"] = state?.peerVirtualNetworkGatewayId;
            resourceInputs["privateLinkFastPathEnabled"] = state?.privateLinkFastPathEnabled;
            resourceInputs["resourceGroupName"] = state?.resourceGroupName;
            resourceInputs["routingWeight"] = state?.routingWeight;
            resourceInputs["sharedKey"] = state?.sharedKey;
            resourceInputs["tags"] = state?.tags;
            resourceInputs["trafficSelectorPolicy"] = state?.trafficSelectorPolicy;
            resourceInputs["type"] = state?.type;
            resourceInputs["usePolicyBasedTrafficSelectors"] = state?.usePolicyBasedTrafficSelectors;
            resourceInputs["virtualNetworkGatewayId"] = state?.virtualNetworkGatewayId;
        }
        else {
            const args = argsOrState;
            if (args?.resourceGroupName === undefined && !opts.urn) {
                throw new Error("Missing required property 'resourceGroupName'");
            }
            if (args?.type === undefined && !opts.urn) {
                throw new Error("Missing required property 'type'");
            }
            if (args?.virtualNetworkGatewayId === undefined && !opts.urn) {
                throw new Error("Missing required property 'virtualNetworkGatewayId'");
            }
            resourceInputs["authorizationKey"] = args?.authorizationKey ? pulumi.secret(args.authorizationKey) : undefined;
            resourceInputs["bgpEnabled"] = args?.bgpEnabled;
            resourceInputs["connectionMode"] = args?.connectionMode;
            resourceInputs["connectionProtocol"] = args?.connectionProtocol;
            resourceInputs["customBgpAddresses"] = args?.customBgpAddresses;
            resourceInputs["dpdTimeoutSeconds"] = args?.dpdTimeoutSeconds;
            resourceInputs["egressNatRuleIds"] = args?.egressNatRuleIds;
            resourceInputs["enableBgp"] = args?.enableBgp;
            resourceInputs["expressRouteCircuitId"] = args?.expressRouteCircuitId;
            resourceInputs["expressRouteGatewayBypass"] = args?.expressRouteGatewayBypass;
            resourceInputs["ingressNatRuleIds"] = args?.ingressNatRuleIds;
            resourceInputs["ipsecPolicy"] = args?.ipsecPolicy;
            resourceInputs["localAzureIpAddressEnabled"] = args?.localAzureIpAddressEnabled;
            resourceInputs["localNetworkGatewayId"] = args?.localNetworkGatewayId;
            resourceInputs["location"] = args?.location;
            resourceInputs["name"] = args?.name;
            resourceInputs["peerVirtualNetworkGatewayId"] = args?.peerVirtualNetworkGatewayId;
            resourceInputs["privateLinkFastPathEnabled"] = args?.privateLinkFastPathEnabled;
            resourceInputs["resourceGroupName"] = args?.resourceGroupName;
            resourceInputs["routingWeight"] = args?.routingWeight;
            resourceInputs["sharedKey"] = args?.sharedKey ? pulumi.secret(args.sharedKey) : undefined;
            resourceInputs["tags"] = args?.tags;
            resourceInputs["trafficSelectorPolicy"] = args?.trafficSelectorPolicy;
            resourceInputs["type"] = args?.type;
            resourceInputs["usePolicyBasedTrafficSelectors"] = args?.usePolicyBasedTrafficSelectors;
            resourceInputs["virtualNetworkGatewayId"] = args?.virtualNetworkGatewayId;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["authorizationKey", "sharedKey"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(VirtualNetworkGatewayConnection.__pulumiType, name, resourceInputs, opts);
    }
}
exports.VirtualNetworkGatewayConnection = VirtualNetworkGatewayConnection;
//# sourceMappingURL=virtualNetworkGatewayConnection.js.map