"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.GlobalForwardingRule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Represents a GlobalForwardingRule resource. Global forwarding rules are
 * used to forward traffic to the correct load balancer for HTTP load
 * balancing. Global forwarding rules can only be used for HTTP load
 * balancing.
 *
 * For more information, see https://cloud.google.com/compute/docs/load-balancing/http/
 *
 * ## Example Usage
 *
 * ### Global Forwarding Rule Http
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const defaultHttpHealthCheck = new gcp.compute.HttpHealthCheck("default", {
 *     name: "check-backend",
 *     requestPath: "/",
 *     checkIntervalSec: 1,
 *     timeoutSec: 1,
 * });
 * const defaultBackendService = new gcp.compute.BackendService("default", {
 *     name: "backend",
 *     portName: "http",
 *     protocol: "HTTP",
 *     timeoutSec: 10,
 *     healthChecks: defaultHttpHealthCheck.id,
 * });
 * const defaultURLMap = new gcp.compute.URLMap("default", {
 *     name: "url-map-target-proxy",
 *     description: "a description",
 *     defaultService: defaultBackendService.id,
 *     hostRules: [{
 *         hosts: ["mysite.com"],
 *         pathMatcher: "allpaths",
 *     }],
 *     pathMatchers: [{
 *         name: "allpaths",
 *         defaultService: defaultBackendService.id,
 *         pathRules: [{
 *             paths: ["/*"],
 *             service: defaultBackendService.id,
 *         }],
 *     }],
 * });
 * const defaultTargetHttpProxy = new gcp.compute.TargetHttpProxy("default", {
 *     name: "target-proxy",
 *     description: "a description",
 *     urlMap: defaultURLMap.id,
 * });
 * const _default = new gcp.compute.GlobalForwardingRule("default", {
 *     name: "global-rule",
 *     target: defaultTargetHttpProxy.id,
 *     portRange: "80",
 * });
 * ```
 * ### Global Forwarding Rule Internal
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const debianImage = gcp.compute.getImage({
 *     family: "debian-11",
 *     project: "debian-cloud",
 * });
 * const instanceTemplate = new gcp.compute.InstanceTemplate("instance_template", {
 *     name: "template-backend",
 *     machineType: "e2-medium",
 *     networkInterfaces: [{
 *         network: "default",
 *     }],
 *     disks: [{
 *         sourceImage: debianImage.then(debianImage => debianImage.selfLink),
 *         autoDelete: true,
 *         boot: true,
 *     }],
 * });
 * const igm = new gcp.compute.InstanceGroupManager("igm", {
 *     name: "igm-internal",
 *     versions: [{
 *         instanceTemplate: instanceTemplate.id,
 *         name: "primary",
 *     }],
 *     baseInstanceName: "internal-glb",
 *     zone: "us-central1-f",
 *     targetSize: 1,
 * });
 * const defaultHealthCheck = new gcp.compute.HealthCheck("default", {
 *     name: "check-backend",
 *     checkIntervalSec: 1,
 *     timeoutSec: 1,
 *     tcpHealthCheck: {
 *         port: 80,
 *     },
 * });
 * const defaultBackendService = new gcp.compute.BackendService("default", {
 *     name: "backend",
 *     portName: "http",
 *     protocol: "HTTP",
 *     timeoutSec: 10,
 *     loadBalancingScheme: "INTERNAL_SELF_MANAGED",
 *     backends: [{
 *         group: igm.instanceGroup,
 *         balancingMode: "RATE",
 *         capacityScaler: 0.4,
 *         maxRatePerInstance: 50,
 *     }],
 *     healthChecks: defaultHealthCheck.id,
 * });
 * const defaultURLMap = new gcp.compute.URLMap("default", {
 *     name: "url-map-target-proxy",
 *     description: "a description",
 *     defaultService: defaultBackendService.id,
 *     hostRules: [{
 *         hosts: ["mysite.com"],
 *         pathMatcher: "allpaths",
 *     }],
 *     pathMatchers: [{
 *         name: "allpaths",
 *         defaultService: defaultBackendService.id,
 *         pathRules: [{
 *             paths: ["/*"],
 *             service: defaultBackendService.id,
 *         }],
 *     }],
 * });
 * const defaultTargetHttpProxy = new gcp.compute.TargetHttpProxy("default", {
 *     name: "target-proxy",
 *     description: "a description",
 *     urlMap: defaultURLMap.id,
 * });
 * const _default = new gcp.compute.GlobalForwardingRule("default", {
 *     name: "global-rule",
 *     target: defaultTargetHttpProxy.id,
 *     portRange: "80",
 *     loadBalancingScheme: "INTERNAL_SELF_MANAGED",
 *     ipAddress: "0.0.0.0",
 *     metadataFilters: [{
 *         filterMatchCriteria: "MATCH_ANY",
 *         filterLabels: [{
 *             name: "PLANET",
 *             value: "MARS",
 *         }],
 *     }],
 * });
 * ```
 * ### Global Forwarding Rule External Managed
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const defaultBackendService = new gcp.compute.BackendService("default", {
 *     name: "backend",
 *     portName: "http",
 *     protocol: "HTTP",
 *     timeoutSec: 10,
 *     loadBalancingScheme: "EXTERNAL_MANAGED",
 * });
 * const defaultURLMap = new gcp.compute.URLMap("default", {
 *     name: "url-map-target-proxy",
 *     description: "a description",
 *     defaultService: defaultBackendService.id,
 *     hostRules: [{
 *         hosts: ["mysite.com"],
 *         pathMatcher: "allpaths",
 *     }],
 *     pathMatchers: [{
 *         name: "allpaths",
 *         defaultService: defaultBackendService.id,
 *         pathRules: [{
 *             paths: ["/*"],
 *             service: defaultBackendService.id,
 *         }],
 *     }],
 * });
 * const defaultTargetHttpProxy = new gcp.compute.TargetHttpProxy("default", {
 *     name: "target-proxy",
 *     description: "a description",
 *     urlMap: defaultURLMap.id,
 * });
 * const _default = new gcp.compute.GlobalForwardingRule("default", {
 *     name: "global-rule",
 *     target: defaultTargetHttpProxy.id,
 *     portRange: "80",
 *     loadBalancingScheme: "EXTERNAL_MANAGED",
 *     networkTier: "PREMIUM",
 * });
 * ```
 * ### Global Forwarding Rule Hybrid
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const config = new pulumi.Config();
 * const subnetworkCidr = config.get("subnetworkCidr") || "10.0.0.0/24";
 * const _default = new gcp.compute.Network("default", {name: "my-network"});
 * const internal = new gcp.compute.Network("internal", {
 *     name: "my-internal-network",
 *     autoCreateSubnetworks: false,
 * });
 * const internalSubnetwork = new gcp.compute.Subnetwork("internal", {
 *     name: "my-subnetwork",
 *     network: internal.id,
 *     ipCidrRange: subnetworkCidr,
 *     region: "us-central1",
 *     privateIpGoogleAccess: true,
 * });
 * // Zonal NEG with GCE_VM_IP_PORT
 * const defaultNetworkEndpointGroup = new gcp.compute.NetworkEndpointGroup("default", {
 *     name: "default-neg",
 *     network: _default.id,
 *     defaultPort: 90,
 *     zone: "us-central1-a",
 *     networkEndpointType: "GCE_VM_IP_PORT",
 * });
 * // Zonal NEG with GCE_VM_IP
 * const internalNetworkEndpointGroup = new gcp.compute.NetworkEndpointGroup("internal", {
 *     name: "internal-neg",
 *     network: internal.id,
 *     subnetwork: internalSubnetwork.id,
 *     zone: "us-central1-a",
 *     networkEndpointType: "GCE_VM_IP",
 * });
 * // Hybrid connectivity NEG
 * const hybrid = new gcp.compute.NetworkEndpointGroup("hybrid", {
 *     name: "hybrid-neg",
 *     network: _default.id,
 *     defaultPort: 90,
 *     zone: "us-central1-a",
 *     networkEndpointType: "NON_GCP_PRIVATE_IP_PORT",
 * });
 * const hybrid_endpoint = new gcp.compute.NetworkEndpoint("hybrid-endpoint", {
 *     networkEndpointGroup: hybrid.name,
 *     port: hybrid.defaultPort,
 *     ipAddress: "127.0.0.1",
 * });
 * const defaultHealthCheck = new gcp.compute.HealthCheck("default", {
 *     name: "health-check",
 *     timeoutSec: 1,
 *     checkIntervalSec: 1,
 *     tcpHealthCheck: {
 *         port: 80,
 *     },
 * });
 * // Backend service for Zonal NEG
 * const defaultBackendService = new gcp.compute.BackendService("default", {
 *     name: "backend-default",
 *     portName: "http",
 *     protocol: "HTTP",
 *     timeoutSec: 10,
 *     backends: [{
 *         group: defaultNetworkEndpointGroup.id,
 *         balancingMode: "RATE",
 *         maxRatePerEndpoint: 10,
 *     }],
 *     healthChecks: defaultHealthCheck.id,
 * });
 * // Backgend service for Hybrid NEG
 * const hybridBackendService = new gcp.compute.BackendService("hybrid", {
 *     name: "backend-hybrid",
 *     portName: "http",
 *     protocol: "HTTP",
 *     timeoutSec: 10,
 *     backends: [{
 *         group: hybrid.id,
 *         balancingMode: "RATE",
 *         maxRatePerEndpoint: 10,
 *     }],
 *     healthChecks: defaultHealthCheck.id,
 * });
 * const defaultURLMap = new gcp.compute.URLMap("default", {
 *     name: "url-map-target-proxy",
 *     description: "a description",
 *     defaultService: defaultBackendService.id,
 *     hostRules: [{
 *         hosts: ["mysite.com"],
 *         pathMatcher: "allpaths",
 *     }],
 *     pathMatchers: [{
 *         name: "allpaths",
 *         defaultService: defaultBackendService.id,
 *         pathRules: [
 *             {
 *                 paths: ["/*"],
 *                 service: defaultBackendService.id,
 *             },
 *             {
 *                 paths: ["/hybrid"],
 *                 service: hybridBackendService.id,
 *             },
 *         ],
 *     }],
 * });
 * const defaultTargetHttpProxy = new gcp.compute.TargetHttpProxy("default", {
 *     name: "target-proxy",
 *     description: "a description",
 *     urlMap: defaultURLMap.id,
 * });
 * const defaultGlobalForwardingRule = new gcp.compute.GlobalForwardingRule("default", {
 *     name: "global-rule",
 *     target: defaultTargetHttpProxy.id,
 *     portRange: "80",
 * });
 * ```
 * ### Private Service Connect Google Apis
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const network = new gcp.compute.Network("network", {
 *     project: "my-project-name",
 *     name: "my-network",
 *     autoCreateSubnetworks: false,
 * });
 * const vpcSubnetwork = new gcp.compute.Subnetwork("vpc_subnetwork", {
 *     project: network.project,
 *     name: "my-subnetwork",
 *     ipCidrRange: "10.2.0.0/16",
 *     region: "us-central1",
 *     network: network.id,
 *     privateIpGoogleAccess: true,
 * });
 * const _default = new gcp.compute.GlobalAddress("default", {
 *     project: network.project,
 *     name: "global-psconnect-ip",
 *     addressType: "INTERNAL",
 *     purpose: "PRIVATE_SERVICE_CONNECT",
 *     network: network.id,
 *     address: "100.100.100.106",
 * });
 * const defaultGlobalForwardingRule = new gcp.compute.GlobalForwardingRule("default", {
 *     project: network.project,
 *     name: "globalrule",
 *     target: "all-apis",
 *     network: network.id,
 *     ipAddress: _default.id,
 *     loadBalancingScheme: "",
 *     serviceDirectoryRegistrations: {
 *         namespace: "sd-namespace",
 *         serviceDirectoryRegion: "europe-west3",
 *     },
 * });
 * ```
 * ### Private Service Connect Google Apis No Automate Dns
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const network = new gcp.compute.Network("network", {
 *     project: "my-project-name",
 *     name: "my-network",
 *     autoCreateSubnetworks: false,
 * });
 * const vpcSubnetwork = new gcp.compute.Subnetwork("vpc_subnetwork", {
 *     project: network.project,
 *     name: "my-subnetwork",
 *     ipCidrRange: "10.2.0.0/16",
 *     region: "us-central1",
 *     network: network.id,
 *     privateIpGoogleAccess: true,
 * });
 * const _default = new gcp.compute.GlobalAddress("default", {
 *     project: network.project,
 *     name: "global-psconnect-ip",
 *     addressType: "INTERNAL",
 *     purpose: "PRIVATE_SERVICE_CONNECT",
 *     network: network.id,
 *     address: "100.100.100.106",
 * });
 * const defaultGlobalForwardingRule = new gcp.compute.GlobalForwardingRule("default", {
 *     project: network.project,
 *     name: "globalrule",
 *     target: "all-apis",
 *     network: network.id,
 *     ipAddress: _default.id,
 *     loadBalancingScheme: "",
 *     noAutomateDnsZone: false,
 * });
 * ```
 *
 * ## Import
 *
 * GlobalForwardingRule can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/global/forwardingRules/{{name}}`
 *
 * * `{{project}}/{{name}}`
 *
 * * `{{name}}`
 *
 * When using the `pulumi import` command, GlobalForwardingRule can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:compute/globalForwardingRule:GlobalForwardingRule default projects/{{project}}/global/forwardingRules/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/globalForwardingRule:GlobalForwardingRule default {{project}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/globalForwardingRule:GlobalForwardingRule default {{name}}
 * ```
 */
class GlobalForwardingRule extends pulumi.CustomResource {
    /**
     * Get an existing GlobalForwardingRule 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 GlobalForwardingRule(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of GlobalForwardingRule.  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'] === GlobalForwardingRule.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["allowPscGlobalAccess"] = state?.allowPscGlobalAccess;
            resourceInputs["baseForwardingRule"] = state?.baseForwardingRule;
            resourceInputs["description"] = state?.description;
            resourceInputs["effectiveLabels"] = state?.effectiveLabels;
            resourceInputs["externalManagedBackendBucketMigrationState"] = state?.externalManagedBackendBucketMigrationState;
            resourceInputs["externalManagedBackendBucketMigrationTestingPercentage"] = state?.externalManagedBackendBucketMigrationTestingPercentage;
            resourceInputs["forwardingRuleId"] = state?.forwardingRuleId;
            resourceInputs["ipAddress"] = state?.ipAddress;
            resourceInputs["ipProtocol"] = state?.ipProtocol;
            resourceInputs["ipVersion"] = state?.ipVersion;
            resourceInputs["labelFingerprint"] = state?.labelFingerprint;
            resourceInputs["labels"] = state?.labels;
            resourceInputs["loadBalancingScheme"] = state?.loadBalancingScheme;
            resourceInputs["metadataFilters"] = state?.metadataFilters;
            resourceInputs["name"] = state?.name;
            resourceInputs["network"] = state?.network;
            resourceInputs["networkTier"] = state?.networkTier;
            resourceInputs["noAutomateDnsZone"] = state?.noAutomateDnsZone;
            resourceInputs["portRange"] = state?.portRange;
            resourceInputs["project"] = state?.project;
            resourceInputs["pscConnectionId"] = state?.pscConnectionId;
            resourceInputs["pscConnectionStatus"] = state?.pscConnectionStatus;
            resourceInputs["pulumiLabels"] = state?.pulumiLabels;
            resourceInputs["selfLink"] = state?.selfLink;
            resourceInputs["serviceDirectoryRegistrations"] = state?.serviceDirectoryRegistrations;
            resourceInputs["sourceIpRanges"] = state?.sourceIpRanges;
            resourceInputs["subnetwork"] = state?.subnetwork;
            resourceInputs["target"] = state?.target;
        }
        else {
            const args = argsOrState;
            if (args?.target === undefined && !opts.urn) {
                throw new Error("Missing required property 'target'");
            }
            resourceInputs["allowPscGlobalAccess"] = args?.allowPscGlobalAccess;
            resourceInputs["description"] = args?.description;
            resourceInputs["externalManagedBackendBucketMigrationState"] = args?.externalManagedBackendBucketMigrationState;
            resourceInputs["externalManagedBackendBucketMigrationTestingPercentage"] = args?.externalManagedBackendBucketMigrationTestingPercentage;
            resourceInputs["ipAddress"] = args?.ipAddress;
            resourceInputs["ipProtocol"] = args?.ipProtocol;
            resourceInputs["ipVersion"] = args?.ipVersion;
            resourceInputs["labels"] = args?.labels;
            resourceInputs["loadBalancingScheme"] = args?.loadBalancingScheme;
            resourceInputs["metadataFilters"] = args?.metadataFilters;
            resourceInputs["name"] = args?.name;
            resourceInputs["network"] = args?.network;
            resourceInputs["networkTier"] = args?.networkTier;
            resourceInputs["noAutomateDnsZone"] = args?.noAutomateDnsZone;
            resourceInputs["portRange"] = args?.portRange;
            resourceInputs["project"] = args?.project;
            resourceInputs["serviceDirectoryRegistrations"] = args?.serviceDirectoryRegistrations;
            resourceInputs["sourceIpRanges"] = args?.sourceIpRanges;
            resourceInputs["subnetwork"] = args?.subnetwork;
            resourceInputs["target"] = args?.target;
            resourceInputs["baseForwardingRule"] = undefined /*out*/;
            resourceInputs["effectiveLabels"] = undefined /*out*/;
            resourceInputs["forwardingRuleId"] = undefined /*out*/;
            resourceInputs["labelFingerprint"] = undefined /*out*/;
            resourceInputs["pscConnectionId"] = undefined /*out*/;
            resourceInputs["pscConnectionStatus"] = undefined /*out*/;
            resourceInputs["pulumiLabels"] = undefined /*out*/;
            resourceInputs["selfLink"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(GlobalForwardingRule.__pulumiType, name, resourceInputs, opts);
    }
}
exports.GlobalForwardingRule = GlobalForwardingRule;
/** @internal */
GlobalForwardingRule.__pulumiType = 'gcp:compute/globalForwardingRule:GlobalForwardingRule';
//# sourceMappingURL=globalForwardingRule.js.map