"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! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.NetworkEndpointList = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * A set of network endpoints belonging to a network endpoint group (NEG). A
 * single network endpoint represents a IP address and port combination that is
 * part of a specific network endpoint group  (NEG). NEGs are zonal collections
 * of these endpoints for GCP resources within a single subnet. **NOTE**:
 * Network endpoints cannot be created outside of a network endpoint group.
 *
 * This resource is authoritative for a single NEG. Any endpoints not specified
 * by this resource will be deleted when the resource configuration is applied.
 *
 * > **NOTE** In case the Endpoint's Instance is recreated, it's needed to
 * perform `apply` twice. To avoid situations like this, please use this resource
 * with the lifecycle `replaceTriggeredBy` method, with the passed Instance's ID.
 *
 * To get more information about NetworkEndpoints, see:
 *
 * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/beta/networkEndpointGroups)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/load-balancing/docs/negs/)
 *
 * ## Example Usage
 *
 * ### Network Endpoints
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const myImage = gcp.compute.getImage({
 *     family: "debian-11",
 *     project: "debian-cloud",
 * });
 * const _default = new gcp.compute.Network("default", {
 *     name: "neg-network",
 *     autoCreateSubnetworks: false,
 * });
 * const defaultSubnetwork = new gcp.compute.Subnetwork("default", {
 *     name: "neg-subnetwork",
 *     ipCidrRange: "10.0.0.1/16",
 *     region: "us-central1",
 *     network: _default.id,
 * });
 * const endpoint_instance1 = new gcp.compute.Instance("endpoint-instance1", {
 *     networkInterfaces: [{
 *         accessConfigs: [{}],
 *         subnetwork: defaultSubnetwork.id,
 *     }],
 *     name: "endpoint-instance1",
 *     machineType: "e2-medium",
 *     bootDisk: {
 *         initializeParams: {
 *             image: myImage.then(myImage => myImage.selfLink),
 *         },
 *     },
 * });
 * const endpoint_instance2 = new gcp.compute.Instance("endpoint-instance2", {
 *     networkInterfaces: [{
 *         accessConfigs: [{}],
 *         subnetwork: defaultSubnetwork.id,
 *     }],
 *     name: "endpoint-instance2",
 *     machineType: "e2-medium",
 *     bootDisk: {
 *         initializeParams: {
 *             image: myImage.then(myImage => myImage.selfLink),
 *         },
 *     },
 * });
 * const default_endpoints = new gcp.compute.NetworkEndpointList("default-endpoints", {
 *     networkEndpointGroup: neg.name,
 *     networkEndpoints: [
 *         {
 *             instance: endpoint_instance1.name,
 *             port: neg.defaultPort,
 *             ipAddress: endpoint_instance1.networkInterfaces.apply(networkInterfaces => networkInterfaces[0].networkIp),
 *         },
 *         {
 *             instance: endpoint_instance2.name,
 *             port: neg.defaultPort,
 *             ipAddress: endpoint_instance2.networkInterfaces.apply(networkInterfaces => networkInterfaces[0].networkIp),
 *         },
 *     ],
 * });
 * const group = new gcp.compute.NetworkEndpointGroup("group", {
 *     name: "my-lb-neg",
 *     network: _default.id,
 *     subnetwork: defaultSubnetwork.id,
 *     defaultPort: 90,
 *     zone: "us-central1-a",
 * });
 * ```
 *
 * ## Import
 *
 * NetworkEndpoints can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/zones/{{zone}}/networkEndpointGroups/{{network_endpoint_group}}`
 *
 * * `{{project}}/{{zone}}/{{network_endpoint_group}}`
 *
 * * `{{zone}}/{{network_endpoint_group}}`
 *
 * * `{{network_endpoint_group}}`
 *
 * When using the `pulumi import` command, NetworkEndpoints can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:compute/networkEndpointList:NetworkEndpointList default projects/{{project}}/zones/{{zone}}/networkEndpointGroups/{{network_endpoint_group}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/networkEndpointList:NetworkEndpointList default {{project}}/{{zone}}/{{network_endpoint_group}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/networkEndpointList:NetworkEndpointList default {{zone}}/{{network_endpoint_group}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/networkEndpointList:NetworkEndpointList default {{network_endpoint_group}}
 * ```
 */
class NetworkEndpointList extends pulumi.CustomResource {
    /**
     * Get an existing NetworkEndpointList 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 NetworkEndpointList(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of NetworkEndpointList.  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'] === NetworkEndpointList.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["networkEndpointGroup"] = state?.networkEndpointGroup;
            resourceInputs["networkEndpoints"] = state?.networkEndpoints;
            resourceInputs["project"] = state?.project;
            resourceInputs["zone"] = state?.zone;
        }
        else {
            const args = argsOrState;
            if (args?.networkEndpointGroup === undefined && !opts.urn) {
                throw new Error("Missing required property 'networkEndpointGroup'");
            }
            resourceInputs["networkEndpointGroup"] = args?.networkEndpointGroup;
            resourceInputs["networkEndpoints"] = args?.networkEndpoints;
            resourceInputs["project"] = args?.project;
            resourceInputs["zone"] = args?.zone;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(NetworkEndpointList.__pulumiType, name, resourceInputs, opts);
    }
}
exports.NetworkEndpointList = NetworkEndpointList;
/** @internal */
NetworkEndpointList.__pulumiType = 'gcp:compute/networkEndpointList:NetworkEndpointList';
//# sourceMappingURL=networkEndpointList.js.map