"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.RegionNetworkEndpoint = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * A Region network endpoint represents a IP address/FQDN and port combination that is
 * part of a specific network endpoint group (NEG).
 *
 * > **NOTE**: Network endpoints cannot be created outside of a network endpoint group.
 *
 * To get more information about RegionNetworkEndpoint, see:
 *
 * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/beta/regionNetworkEndpointGroups)
 * * How-to Guides
 *     * [Internet NEGs Official Documentation](https://cloud.google.com/load-balancing/docs/negs/internet-neg-concepts)
 *     * [Official Documentation](https://cloud.google.com/load-balancing/docs/negs/)
 *
 * ## Example Usage
 *
 * ### Region Network Endpoint Internet Ip Port
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.compute.Network("default", {
 *     name: "network",
 *     autoCreateSubnetworks: false,
 * });
 * const group = new gcp.compute.RegionNetworkEndpointGroup("group", {
 *     name: "ip-port-neg",
 *     network: _default.id,
 *     region: "us-central1",
 *     networkEndpointType: "INTERNET_IP_PORT",
 * });
 * const region_internet_ip_port_endpoint = new gcp.compute.RegionNetworkEndpoint("region-internet-ip-port-endpoint", {
 *     regionNetworkEndpointGroup: group.name,
 *     region: "us-central1",
 *     ipAddress: "8.8.8.8",
 *     port: 443,
 * });
 * ```
 * ### Region Network Endpoint Internet Fqdn Port
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.compute.Network("default", {
 *     name: "network",
 *     autoCreateSubnetworks: false,
 * });
 * const group = new gcp.compute.RegionNetworkEndpointGroup("group", {
 *     name: "fqdn-port-neg",
 *     network: _default.id,
 *     region: "us-central1",
 *     networkEndpointType: "INTERNET_FQDN_PORT",
 * });
 * const region_internet_fqdn_port_endpoint = new gcp.compute.RegionNetworkEndpoint("region-internet-fqdn-port-endpoint", {
 *     regionNetworkEndpointGroup: group.name,
 *     region: "us-central1",
 *     fqdn: "backend.example.com",
 *     port: 443,
 * });
 * ```
 * ### Region Network Endpoint Portmap
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.compute.Network("default", {
 *     name: "network",
 *     autoCreateSubnetworks: false,
 * });
 * const defaultSubnetwork = new gcp.compute.Subnetwork("default", {
 *     name: "subnetwork",
 *     ipCidrRange: "10.0.0.0/16",
 *     region: "us-central1",
 *     network: _default.id,
 * });
 * const defaultRegionNetworkEndpointGroup = new gcp.compute.RegionNetworkEndpointGroup("default", {
 *     name: "portmap-neg",
 *     region: "us-central1",
 *     network: _default.id,
 *     subnetwork: defaultSubnetwork.id,
 *     networkEndpointType: "GCE_VM_IP_PORTMAP",
 * });
 * const myImage = gcp.compute.getImage({
 *     family: "debian-11",
 *     project: "debian-cloud",
 * });
 * const defaultInstance = new gcp.compute.Instance("default", {
 *     networkInterfaces: [{
 *         accessConfigs: [{}],
 *         subnetwork: defaultSubnetwork.id,
 *     }],
 *     name: "instance",
 *     machineType: "e2-medium",
 *     zone: "us-central1-a",
 *     bootDisk: {
 *         initializeParams: {
 *             image: myImage.then(myImage => myImage.selfLink),
 *         },
 *     },
 * });
 * const regionNetworkEndpointPortmap = new gcp.compute.RegionNetworkEndpoint("region_network_endpoint_portmap", {
 *     regionNetworkEndpointGroup: defaultRegionNetworkEndpointGroup.name,
 *     region: "us-central1",
 *     instance: defaultInstance.selfLink,
 *     port: 80,
 *     ipAddress: defaultInstance.networkInterfaces.apply(networkInterfaces => networkInterfaces[0].networkIp),
 *     clientDestinationPort: 8080,
 * });
 * ```
 *
 * ## Import
 *
 * RegionNetworkEndpoint can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/regions/{{region}}/networkEndpointGroups/{{region_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}`
 *
 * * `{{project}}/{{region}}/{{region_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}`
 *
 * * `{{region}}/{{region_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}`
 *
 * * `{{region_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}`
 *
 * When using the `pulumi import` command, RegionNetworkEndpoint can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:compute/regionNetworkEndpoint:RegionNetworkEndpoint default projects/{{project}}/regions/{{region}}/networkEndpointGroups/{{region_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/regionNetworkEndpoint:RegionNetworkEndpoint default {{project}}/{{region}}/{{region_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/regionNetworkEndpoint:RegionNetworkEndpoint default {{region}}/{{region_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/regionNetworkEndpoint:RegionNetworkEndpoint default {{region_network_endpoint_group}}/{{ip_address}}/{{fqdn}}/{{port}}
 * ```
 */
class RegionNetworkEndpoint extends pulumi.CustomResource {
    /**
     * Get an existing RegionNetworkEndpoint 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 RegionNetworkEndpoint(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of RegionNetworkEndpoint.  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'] === RegionNetworkEndpoint.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["clientDestinationPort"] = state?.clientDestinationPort;
            resourceInputs["fqdn"] = state?.fqdn;
            resourceInputs["instance"] = state?.instance;
            resourceInputs["ipAddress"] = state?.ipAddress;
            resourceInputs["networkEndpointId"] = state?.networkEndpointId;
            resourceInputs["port"] = state?.port;
            resourceInputs["project"] = state?.project;
            resourceInputs["region"] = state?.region;
            resourceInputs["regionNetworkEndpointGroup"] = state?.regionNetworkEndpointGroup;
        }
        else {
            const args = argsOrState;
            if (args?.port === undefined && !opts.urn) {
                throw new Error("Missing required property 'port'");
            }
            if (args?.regionNetworkEndpointGroup === undefined && !opts.urn) {
                throw new Error("Missing required property 'regionNetworkEndpointGroup'");
            }
            resourceInputs["clientDestinationPort"] = args?.clientDestinationPort;
            resourceInputs["fqdn"] = args?.fqdn;
            resourceInputs["instance"] = args?.instance;
            resourceInputs["ipAddress"] = args?.ipAddress;
            resourceInputs["port"] = args?.port;
            resourceInputs["project"] = args?.project;
            resourceInputs["region"] = args?.region;
            resourceInputs["regionNetworkEndpointGroup"] = args?.regionNetworkEndpointGroup;
            resourceInputs["networkEndpointId"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(RegionNetworkEndpoint.__pulumiType, name, resourceInputs, opts);
    }
}
exports.RegionNetworkEndpoint = RegionNetworkEndpoint;
/** @internal */
RegionNetworkEndpoint.__pulumiType = 'gcp:compute/regionNetworkEndpoint:RegionNetworkEndpoint';
//# sourceMappingURL=regionNetworkEndpoint.js.map