"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.Endpoint = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a Private Endpoint.
 *
 * Azure Private Endpoint is a network interface that connects you privately and securely to a service powered by Azure Private Link. Private Endpoint uses a private IP address from your VNet, effectively bringing the service into your VNet. The service could be an Azure service such as Azure Storage, SQL, etc. or your own Private Link Service.
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
 *     name: "example-network",
 *     addressSpaces: ["10.0.0.0/16"],
 *     location: example.location,
 *     resourceGroupName: example.name,
 * });
 * const service = new azure.network.Subnet("service", {
 *     name: "service",
 *     resourceGroupName: example.name,
 *     virtualNetworkName: exampleVirtualNetwork.name,
 *     addressPrefixes: ["10.0.1.0/24"],
 *     enforcePrivateLinkServiceNetworkPolicies: true,
 * });
 * const endpoint = new azure.network.Subnet("endpoint", {
 *     name: "endpoint",
 *     resourceGroupName: example.name,
 *     virtualNetworkName: exampleVirtualNetwork.name,
 *     addressPrefixes: ["10.0.2.0/24"],
 *     enforcePrivateLinkEndpointNetworkPolicies: true,
 * });
 * const examplePublicIp = new azure.network.PublicIp("example", {
 *     name: "example-pip",
 *     sku: "Standard",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     allocationMethod: "Static",
 * });
 * const exampleLoadBalancer = new azure.lb.LoadBalancer("example", {
 *     name: "example-lb",
 *     sku: "Standard",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     frontendIpConfigurations: [{
 *         name: examplePublicIp.name,
 *         publicIpAddressId: examplePublicIp.id,
 *     }],
 * });
 * const exampleLinkService = new azure.privatedns.LinkService("example", {
 *     name: "example-privatelink",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     natIpConfigurations: [{
 *         name: examplePublicIp.name,
 *         primary: true,
 *         subnetId: service.id,
 *     }],
 *     loadBalancerFrontendIpConfigurationIds: [exampleLoadBalancer.frontendIpConfigurations.apply(frontendIpConfigurations => frontendIpConfigurations?.[0]?.id)],
 * });
 * const exampleEndpoint = new azure.privatelink.Endpoint("example", {
 *     name: "example-endpoint",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     subnetId: endpoint.id,
 *     privateServiceConnection: {
 *         name: "example-privateserviceconnection",
 *         privateConnectionResourceId: exampleLinkService.id,
 *         isManualConnection: false,
 *     },
 * });
 * ```
 *
 * Using a Private Link Service Alias with existing resources:
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const example = azure.core.getResourceGroup({
 *     name: "example-resources",
 * });
 * const vnet = example.then(example => azure.network.getVirtualNetwork({
 *     name: "example-network",
 *     resourceGroupName: example.name,
 * }));
 * const subnet = Promise.all([vnet, example]).then(([vnet, example]) => azure.network.getSubnet({
 *     name: "default",
 *     virtualNetworkName: vnet.name,
 *     resourceGroupName: example.name,
 * }));
 * const exampleEndpoint = new azure.privatelink.Endpoint("example", {
 *     name: "example-endpoint",
 *     location: example.then(example => example.location),
 *     resourceGroupName: example.then(example => example.name),
 *     subnetId: subnet.then(subnet => subnet.id),
 *     privateServiceConnection: {
 *         name: "example-privateserviceconnection",
 *         privateConnectionResourceAlias: "example-privatelinkservice.d20286c8-4ea5-11eb-9584-8f53157226c6.centralus.azure.privatelinkservice",
 *         isManualConnection: true,
 *         requestMessage: "PL",
 *     },
 * });
 * ```
 *
 * Using a Private Endpoint pointing to an *owned* Azure service, with proper DNS configuration:
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-rg",
 *     location: "West Europe",
 * });
 * const exampleAccount = new azure.storage.Account("example", {
 *     name: "exampleaccount",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 * });
 * const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
 *     name: "virtnetname",
 *     addressSpaces: ["10.0.0.0/16"],
 *     location: example.location,
 *     resourceGroupName: example.name,
 * });
 * const exampleSubnet = new azure.network.Subnet("example", {
 *     name: "subnetname",
 *     resourceGroupName: example.name,
 *     virtualNetworkName: exampleVirtualNetwork.name,
 *     addressPrefixes: ["10.0.2.0/24"],
 * });
 * const exampleZone = new azure.privatedns.Zone("example", {
 *     name: "privatelink.blob.core.windows.net",
 *     resourceGroupName: example.name,
 * });
 * const exampleEndpoint = new azure.privatelink.Endpoint("example", {
 *     name: "example-endpoint",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     subnetId: exampleSubnet.id,
 *     privateServiceConnection: {
 *         name: "example-privateserviceconnection",
 *         privateConnectionResourceId: exampleAccount.id,
 *         subresourceNames: ["blob"],
 *         isManualConnection: false,
 *     },
 *     privateDnsZoneGroup: {
 *         name: "example-dns-zone-group",
 *         privateDnsZoneIds: [exampleZone.id],
 *     },
 * });
 * const exampleZoneVirtualNetworkLink = new azure.privatedns.ZoneVirtualNetworkLink("example", {
 *     name: "example-link",
 *     resourceGroupName: example.name,
 *     privateDnsZoneName: exampleZone.name,
 *     virtualNetworkId: exampleVirtualNetwork.id,
 * });
 * ```
 *
 * ## Example HCL Configurations
 *
 * * How to conneca `Private Endpoint` to a Application Gateway
 * * How to connect a `Private Endpoint` to a Cosmos MongoDB
 * * How to connect a `Private Endpoint` to a Cosmos PostgreSQL
 * * How to connect a `Private Endpoint` to a PostgreSQL Server
 * * How to connect a `Private Endpoint` to a Private Link Service
 * * How to connect a `Private Endpoint` to a Private DNS Group
 * * How to connect a `Private Endpoint` to a Databricks Workspace
 * * How to connect a `Private Endpoint` to a Managed Redis
 *
 * ## API Providers
 *
 * <!-- This section is generated, changes will be overwritten -->
 * This resource uses the following Azure API Providers:
 *
 * * `Microsoft.Network` - 2025-01-01
 *
 * ## Import
 *
 * Private Endpoints can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:privatelink/endpoint:Endpoint example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/privateEndpoints/endpoint1
 * ```
 */
class Endpoint extends pulumi.CustomResource {
    /**
     * Get an existing Endpoint 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 Endpoint(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:privatelink/endpoint:Endpoint';
    /**
     * Returns true if the given object is an instance of Endpoint.  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'] === Endpoint.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["customDnsConfigs"] = state?.customDnsConfigs;
            resourceInputs["customNetworkInterfaceName"] = state?.customNetworkInterfaceName;
            resourceInputs["ipConfigurations"] = state?.ipConfigurations;
            resourceInputs["location"] = state?.location;
            resourceInputs["name"] = state?.name;
            resourceInputs["networkInterfaces"] = state?.networkInterfaces;
            resourceInputs["privateDnsZoneConfigs"] = state?.privateDnsZoneConfigs;
            resourceInputs["privateDnsZoneGroup"] = state?.privateDnsZoneGroup;
            resourceInputs["privateServiceConnection"] = state?.privateServiceConnection;
            resourceInputs["resourceGroupName"] = state?.resourceGroupName;
            resourceInputs["subnetId"] = state?.subnetId;
            resourceInputs["tags"] = state?.tags;
        }
        else {
            const args = argsOrState;
            if (args?.privateServiceConnection === undefined && !opts.urn) {
                throw new Error("Missing required property 'privateServiceConnection'");
            }
            if (args?.resourceGroupName === undefined && !opts.urn) {
                throw new Error("Missing required property 'resourceGroupName'");
            }
            if (args?.subnetId === undefined && !opts.urn) {
                throw new Error("Missing required property 'subnetId'");
            }
            resourceInputs["customNetworkInterfaceName"] = args?.customNetworkInterfaceName;
            resourceInputs["ipConfigurations"] = args?.ipConfigurations;
            resourceInputs["location"] = args?.location;
            resourceInputs["name"] = args?.name;
            resourceInputs["privateDnsZoneGroup"] = args?.privateDnsZoneGroup;
            resourceInputs["privateServiceConnection"] = args?.privateServiceConnection;
            resourceInputs["resourceGroupName"] = args?.resourceGroupName;
            resourceInputs["subnetId"] = args?.subnetId;
            resourceInputs["tags"] = args?.tags;
            resourceInputs["customDnsConfigs"] = undefined /*out*/;
            resourceInputs["networkInterfaces"] = undefined /*out*/;
            resourceInputs["privateDnsZoneConfigs"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(Endpoint.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Endpoint = Endpoint;
//# sourceMappingURL=endpoint.js.map