"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.InternalRange = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * The internal range resource for IPAM operations within a VPC network. Used to represent a private address range along with behavioral characterstics of that range (its usage and peering behavior). Networking resources can link to this range if they are created as belonging to it.
 *
 * To get more information about InternalRange, see:
 *
 * * [API documentation](https://cloud.google.com/network-connectivity/docs/reference/networkconnectivity/rest/v1/projects.locations.internalRanges)
 * * How-to Guides
 *     * [Use internal ranges](https://cloud.google.com/vpc/docs/create-use-internal-ranges)
 *
 * ## Example Usage
 *
 * ### Network Connectivity Internal Ranges Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const defaultNetwork = new gcp.compute.Network("default", {
 *     name: "internal-ranges",
 *     autoCreateSubnetworks: false,
 * });
 * const _default = new gcp.networkconnectivity.InternalRange("default", {
 *     name: "basic",
 *     description: "Test internal range",
 *     network: defaultNetwork.selfLink,
 *     usage: "FOR_VPC",
 *     peering: "FOR_SELF",
 *     ipCidrRange: "10.0.0.0/24",
 *     labels: {
 *         "label-a": "b",
 *     },
 * });
 * ```
 * ### Network Connectivity Internal Ranges Automatic Reservation
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const defaultNetwork = new gcp.compute.Network("default", {
 *     name: "internal-ranges",
 *     autoCreateSubnetworks: false,
 * });
 * const _default = new gcp.networkconnectivity.InternalRange("default", {
 *     name: "automatic-reservation",
 *     network: defaultNetwork.id,
 *     usage: "FOR_VPC",
 *     peering: "FOR_SELF",
 *     prefixLength: 24,
 *     targetCidrRanges: ["192.16.0.0/16"],
 * });
 * ```
 * ### Network Connectivity Internal Ranges External Ranges
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const defaultNetwork = new gcp.compute.Network("default", {
 *     name: "internal-ranges",
 *     autoCreateSubnetworks: false,
 * });
 * const _default = new gcp.networkconnectivity.InternalRange("default", {
 *     name: "external-ranges",
 *     network: defaultNetwork.id,
 *     usage: "EXTERNAL_TO_VPC",
 *     peering: "FOR_SELF",
 *     ipCidrRange: "172.16.0.0/24",
 *     labels: {
 *         "external-reserved-range": "on-premises",
 *     },
 * });
 * ```
 * ### Network Connectivity Internal Ranges Reserve With Overlap
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const defaultNetwork = new gcp.compute.Network("default", {
 *     name: "internal-ranges",
 *     autoCreateSubnetworks: false,
 * });
 * const defaultSubnetwork = new gcp.compute.Subnetwork("default", {
 *     name: "overlapping-subnet",
 *     ipCidrRange: "10.0.0.0/24",
 *     region: "us-central1",
 *     network: defaultNetwork.id,
 * });
 * const _default = new gcp.networkconnectivity.InternalRange("default", {
 *     name: "overlap-range",
 *     description: "Test internal range",
 *     network: defaultNetwork.id,
 *     usage: "FOR_VPC",
 *     peering: "FOR_SELF",
 *     ipCidrRange: "10.0.0.0/30",
 *     overlaps: ["OVERLAP_EXISTING_SUBNET_RANGE"],
 * }, {
 *     dependsOn: [defaultSubnetwork],
 * });
 * ```
 * ### Network Connectivity Internal Ranges Migration
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const defaultNetwork = new gcp.compute.Network("default", {
 *     name: "internal-ranges",
 *     autoCreateSubnetworks: false,
 * });
 * const source = new gcp.compute.Subnetwork("source", {
 *     name: "source-subnet",
 *     ipCidrRange: "10.1.0.0/16",
 *     region: "us-central1",
 *     network: defaultNetwork.name,
 * });
 * const targetProject = gcp.organizations.getProject({});
 * const _default = new gcp.networkconnectivity.InternalRange("default", {
 *     name: "migration",
 *     description: "Test internal range",
 *     network: defaultNetwork.selfLink,
 *     usage: "FOR_MIGRATION",
 *     peering: "FOR_SELF",
 *     ipCidrRange: "10.1.0.0/16",
 *     migration: {
 *         source: source.selfLink,
 *         target: targetProject.then(targetProject => `projects/${targetProject.projectId}/regions/us-central1/subnetworks/target-subnet`),
 *     },
 * });
 * ```
 * ### Network Connectivity Internal Ranges Allocation Algoritms
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const defaultNetwork = new gcp.compute.Network("default", {
 *     name: "internal-ranges",
 *     autoCreateSubnetworks: false,
 * });
 * const _default = new gcp.networkconnectivity.InternalRange("default", {
 *     name: "allocation-algorithms",
 *     network: defaultNetwork.id,
 *     usage: "FOR_VPC",
 *     peering: "FOR_SELF",
 *     prefixLength: 24,
 *     targetCidrRanges: ["192.16.0.0/16"],
 *     allocationOptions: {
 *         allocationStrategy: "FIRST_SMALLEST_FITTING",
 *     },
 * });
 * ```
 * ### Network Connectivity Internal Ranges Allocation Algoritms Random First N
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const defaultNetwork = new gcp.compute.Network("default", {
 *     name: "internal-ranges",
 *     autoCreateSubnetworks: false,
 * });
 * const _default = new gcp.networkconnectivity.InternalRange("default", {
 *     name: "allocation-algorithms-random-first-n",
 *     network: defaultNetwork.id,
 *     usage: "FOR_VPC",
 *     peering: "FOR_SELF",
 *     prefixLength: 24,
 *     targetCidrRanges: ["192.16.0.0/16"],
 *     allocationOptions: {
 *         allocationStrategy: "RANDOM_FIRST_N_AVAILABLE",
 *         firstAvailableRangesLookupSize: 20,
 *     },
 * });
 * ```
 *
 * ## Import
 *
 * InternalRange can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/global/internalRanges/{{name}}`
 *
 * * `{{project}}/{{name}}`
 *
 * * `{{name}}`
 *
 * When using the `pulumi import` command, InternalRange can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:networkconnectivity/internalRange:InternalRange default projects/{{project}}/locations/global/internalRanges/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:networkconnectivity/internalRange:InternalRange default {{project}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:networkconnectivity/internalRange:InternalRange default {{name}}
 * ```
 */
class InternalRange extends pulumi.CustomResource {
    /**
     * Get an existing InternalRange 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 InternalRange(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of InternalRange.  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'] === InternalRange.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["allocationOptions"] = state?.allocationOptions;
            resourceInputs["description"] = state?.description;
            resourceInputs["effectiveLabels"] = state?.effectiveLabels;
            resourceInputs["excludeCidrRanges"] = state?.excludeCidrRanges;
            resourceInputs["immutable"] = state?.immutable;
            resourceInputs["ipCidrRange"] = state?.ipCidrRange;
            resourceInputs["labels"] = state?.labels;
            resourceInputs["migration"] = state?.migration;
            resourceInputs["name"] = state?.name;
            resourceInputs["network"] = state?.network;
            resourceInputs["overlaps"] = state?.overlaps;
            resourceInputs["peering"] = state?.peering;
            resourceInputs["prefixLength"] = state?.prefixLength;
            resourceInputs["project"] = state?.project;
            resourceInputs["pulumiLabels"] = state?.pulumiLabels;
            resourceInputs["targetCidrRanges"] = state?.targetCidrRanges;
            resourceInputs["usage"] = state?.usage;
            resourceInputs["users"] = state?.users;
        }
        else {
            const args = argsOrState;
            if (args?.network === undefined && !opts.urn) {
                throw new Error("Missing required property 'network'");
            }
            if (args?.peering === undefined && !opts.urn) {
                throw new Error("Missing required property 'peering'");
            }
            if (args?.usage === undefined && !opts.urn) {
                throw new Error("Missing required property 'usage'");
            }
            resourceInputs["allocationOptions"] = args?.allocationOptions;
            resourceInputs["description"] = args?.description;
            resourceInputs["excludeCidrRanges"] = args?.excludeCidrRanges;
            resourceInputs["immutable"] = args?.immutable;
            resourceInputs["ipCidrRange"] = args?.ipCidrRange;
            resourceInputs["labels"] = args?.labels;
            resourceInputs["migration"] = args?.migration;
            resourceInputs["name"] = args?.name;
            resourceInputs["network"] = args?.network;
            resourceInputs["overlaps"] = args?.overlaps;
            resourceInputs["peering"] = args?.peering;
            resourceInputs["prefixLength"] = args?.prefixLength;
            resourceInputs["project"] = args?.project;
            resourceInputs["targetCidrRanges"] = args?.targetCidrRanges;
            resourceInputs["usage"] = args?.usage;
            resourceInputs["effectiveLabels"] = undefined /*out*/;
            resourceInputs["pulumiLabels"] = undefined /*out*/;
            resourceInputs["users"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(InternalRange.__pulumiType, name, resourceInputs, opts);
    }
}
exports.InternalRange = InternalRange;
/** @internal */
InternalRange.__pulumiType = 'gcp:networkconnectivity/internalRange:InternalRange';
//# sourceMappingURL=internalRange.js.map