"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.RegionBackendService = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * A Region Backend Service defines a regionally-scoped group of virtual
 * machines that will serve traffic for load balancing.
 *
 * > **Note:** Recreating a `gcp.compute.RegionBackendService` that references other dependent resources like `gcp.compute.InstanceGroup` will give a `resourceInUseByAnotherResource` error, when decreasing the number of other dependent resources.
 * Use `lifecycle.create_before_destroy` on the dependent resources to avoid this type of error as shown in the Dynamic Backend Count example.
 *
 * To get more information about RegionBackendService, see:
 *
 * * [API documentation](https://cloud.google.com/compute/docs/reference/latest/regionBackendServices)
 * * How-to Guides
 *     * [Internal TCP/UDP Load Balancing](https://cloud.google.com/compute/docs/load-balancing/internal/)
 *
 * ## Example Usage
 *
 * ### Region Backend Service Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const defaultHealthCheck = new gcp.compute.HealthCheck("default", {
 *     name: "rbs-health-check",
 *     checkIntervalSec: 1,
 *     timeoutSec: 1,
 *     tcpHealthCheck: {
 *         port: 80,
 *     },
 * });
 * const _default = new gcp.compute.RegionBackendService("default", {
 *     name: "region-service",
 *     region: "us-central1",
 *     healthChecks: defaultHealthCheck.id,
 *     connectionDrainingTimeoutSec: 10,
 *     sessionAffinity: "CLIENT_IP",
 * });
 * ```
 * ### Region Backend Service External Iap
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.compute.RegionBackendService("default", {
 *     name: "tf-test-region-service-external",
 *     region: "us-central1",
 *     protocol: "HTTP",
 *     loadBalancingScheme: "EXTERNAL",
 *     iap: {
 *         enabled: true,
 *         oauth2ClientId: "abc",
 *         oauth2ClientSecret: "xyz",
 *     },
 * });
 * ```
 * ### Region Backend Service Cache
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const defaultRegionHealthCheck = new gcp.compute.RegionHealthCheck("default", {
 *     name: "rbs-health-check",
 *     region: "us-central1",
 *     httpHealthCheck: {
 *         port: 80,
 *     },
 * });
 * const _default = new gcp.compute.RegionBackendService("default", {
 *     name: "region-service",
 *     region: "us-central1",
 *     healthChecks: defaultRegionHealthCheck.id,
 *     enableCdn: true,
 *     cdnPolicy: {
 *         cacheMode: "CACHE_ALL_STATIC",
 *         defaultTtl: 3600,
 *         clientTtl: 7200,
 *         maxTtl: 10800,
 *         negativeCaching: true,
 *         signedUrlCacheMaxAgeSec: 7200,
 *     },
 *     loadBalancingScheme: "EXTERNAL",
 *     protocol: "HTTP",
 * });
 * ```
 * ### Region Backend Service Ilb Round Robin
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const healthCheck = new gcp.compute.HealthCheck("health_check", {
 *     name: "rbs-health-check",
 *     httpHealthCheck: {
 *         port: 80,
 *     },
 * });
 * const _default = new gcp.compute.RegionBackendService("default", {
 *     region: "us-central1",
 *     name: "region-service",
 *     healthChecks: healthCheck.id,
 *     protocol: "HTTP",
 *     loadBalancingScheme: "INTERNAL_MANAGED",
 *     localityLbPolicy: "ROUND_ROBIN",
 * });
 * ```
 * ### Region Backend Service External
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const healthCheck = new gcp.compute.RegionHealthCheck("health_check", {
 *     name: "rbs-health-check",
 *     region: "us-central1",
 *     tcpHealthCheck: {
 *         port: 80,
 *     },
 * });
 * const _default = new gcp.compute.RegionBackendService("default", {
 *     region: "us-central1",
 *     name: "region-service",
 *     healthChecks: healthCheck.id,
 *     protocol: "TCP",
 *     loadBalancingScheme: "EXTERNAL",
 * });
 * ```
 * ### Region Backend Service External Weighted
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const healthCheck = new gcp.compute.RegionHealthCheck("health_check", {
 *     name: "rbs-health-check",
 *     region: "us-central1",
 *     httpHealthCheck: {
 *         port: 80,
 *     },
 * });
 * const _default = new gcp.compute.RegionBackendService("default", {
 *     region: "us-central1",
 *     name: "region-service",
 *     healthChecks: healthCheck.id,
 *     protocol: "TCP",
 *     loadBalancingScheme: "EXTERNAL",
 *     localityLbPolicy: "WEIGHTED_MAGLEV",
 * });
 * ```
 * ### Region Backend Service Ilb Ring Hash
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const healthCheck = new gcp.compute.HealthCheck("health_check", {
 *     name: "rbs-health-check",
 *     httpHealthCheck: {
 *         port: 80,
 *     },
 * });
 * const _default = new gcp.compute.RegionBackendService("default", {
 *     region: "us-central1",
 *     name: "region-service",
 *     healthChecks: healthCheck.id,
 *     loadBalancingScheme: "INTERNAL_MANAGED",
 *     localityLbPolicy: "RING_HASH",
 *     sessionAffinity: "HTTP_COOKIE",
 *     protocol: "HTTP",
 *     circuitBreakers: {
 *         maxConnections: 10,
 *     },
 *     consistentHash: {
 *         httpCookie: {
 *             ttl: {
 *                 seconds: 11,
 *                 nanos: 1111,
 *             },
 *             name: "mycookie",
 *         },
 *     },
 *     outlierDetection: {
 *         consecutiveErrors: 2,
 *     },
 * });
 * ```
 * ### Region Backend Service Ilb Stateful Session Affinity
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const healthCheck = new gcp.compute.HealthCheck("health_check", {
 *     name: "rbs-health-check",
 *     httpHealthCheck: {
 *         port: 80,
 *     },
 * });
 * const _default = new gcp.compute.RegionBackendService("default", {
 *     region: "us-central1",
 *     name: "region-service",
 *     healthChecks: healthCheck.id,
 *     loadBalancingScheme: "INTERNAL_MANAGED",
 *     localityLbPolicy: "RING_HASH",
 *     sessionAffinity: "STRONG_COOKIE_AFFINITY",
 *     protocol: "HTTP",
 *     strongSessionAffinityCookie: {
 *         ttl: {
 *             seconds: 11,
 *             nanos: 1111,
 *         },
 *         name: "mycookie",
 *     },
 * });
 * ```
 * ### Region Backend Service Balancing Mode
 *
 * ```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 defaultNetwork = new gcp.compute.Network("default", {
 *     name: "rbs-net",
 *     autoCreateSubnetworks: false,
 *     routingMode: "REGIONAL",
 * });
 * const defaultSubnetwork = new gcp.compute.Subnetwork("default", {
 *     name: "rbs-net-default",
 *     ipCidrRange: "10.1.2.0/24",
 *     region: "us-central1",
 *     network: defaultNetwork.id,
 * });
 * const instanceTemplate = new gcp.compute.InstanceTemplate("instance_template", {
 *     name: "template-region-service",
 *     machineType: "e2-medium",
 *     networkInterfaces: [{
 *         network: defaultNetwork.id,
 *         subnetwork: defaultSubnetwork.id,
 *     }],
 *     disks: [{
 *         sourceImage: debianImage.then(debianImage => debianImage.selfLink),
 *         autoDelete: true,
 *         boot: true,
 *     }],
 *     tags: [
 *         "allow-ssh",
 *         "load-balanced-backend",
 *     ],
 * });
 * const rigm = new gcp.compute.RegionInstanceGroupManager("rigm", {
 *     region: "us-central1",
 *     name: "rbs-rigm",
 *     versions: [{
 *         instanceTemplate: instanceTemplate.id,
 *         name: "primary",
 *     }],
 *     baseInstanceName: "internal-glb",
 *     targetSize: 1,
 * });
 * const defaultRegionHealthCheck = new gcp.compute.RegionHealthCheck("default", {
 *     region: "us-central1",
 *     name: "rbs-health-check",
 *     httpHealthCheck: {
 *         portSpecification: "USE_SERVING_PORT",
 *     },
 * });
 * const _default = new gcp.compute.RegionBackendService("default", {
 *     loadBalancingScheme: "INTERNAL_MANAGED",
 *     backends: [{
 *         group: rigm.instanceGroup,
 *         balancingMode: "UTILIZATION",
 *         capacityScaler: 1,
 *     }],
 *     region: "us-central1",
 *     name: "region-service",
 *     protocol: "H2C",
 *     timeoutSec: 10,
 *     healthChecks: defaultRegionHealthCheck.id,
 * });
 * ```
 * ### Region Backend Service Connection Tracking
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const healthCheck = new gcp.compute.RegionHealthCheck("health_check", {
 *     name: "rbs-health-check",
 *     region: "us-central1",
 *     tcpHealthCheck: {
 *         port: 22,
 *     },
 * });
 * const _default = new gcp.compute.RegionBackendService("default", {
 *     name: "region-service",
 *     region: "us-central1",
 *     healthChecks: healthCheck.id,
 *     connectionDrainingTimeoutSec: 10,
 *     sessionAffinity: "CLIENT_IP",
 *     protocol: "TCP",
 *     loadBalancingScheme: "EXTERNAL",
 *     connectionTrackingPolicy: {
 *         trackingMode: "PER_SESSION",
 *         connectionPersistenceOnUnhealthyBackends: "NEVER_PERSIST",
 *         idleTimeoutSec: 60,
 *         enableStrongAffinity: true,
 *     },
 * });
 * ```
 * ### Region Backend Service Ip Address Selection Policy
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const healthCheck = new gcp.compute.RegionHealthCheck("health_check", {
 *     name: "rbs-health-check",
 *     region: "us-central1",
 *     tcpHealthCheck: {
 *         port: 80,
 *     },
 * });
 * const _default = new gcp.compute.RegionBackendService("default", {
 *     name: "region-service",
 *     region: "us-central1",
 *     healthChecks: healthCheck.id,
 *     loadBalancingScheme: "EXTERNAL_MANAGED",
 *     protocol: "HTTP",
 *     ipAddressSelectionPolicy: "IPV6_ONLY",
 * });
 * ```
 * ### Region Backend Service Ilb Custom Metrics
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.compute.Network("default", {name: "network"});
 * // Zonal NEG with GCE_VM_IP_PORT
 * const defaultNetworkEndpointGroup = new gcp.compute.NetworkEndpointGroup("default", {
 *     name: "network-endpoint",
 *     network: _default.id,
 *     defaultPort: 90,
 *     zone: "us-central1-a",
 *     networkEndpointType: "GCE_VM_IP_PORT",
 * });
 * const healthCheck = new gcp.compute.HealthCheck("health_check", {
 *     name: "rbs-health-check",
 *     httpHealthCheck: {
 *         port: 80,
 *     },
 * });
 * const defaultRegionBackendService = new gcp.compute.RegionBackendService("default", {
 *     region: "us-central1",
 *     name: "region-service",
 *     healthChecks: healthCheck.id,
 *     loadBalancingScheme: "INTERNAL_MANAGED",
 *     localityLbPolicy: "WEIGHTED_ROUND_ROBIN",
 *     customMetrics: [{
 *         name: "orca.application_utilization",
 *         dryRun: false,
 *     }],
 *     backends: [{
 *         group: defaultNetworkEndpointGroup.id,
 *         balancingMode: "CUSTOM_METRICS",
 *         customMetrics: [
 *             {
 *                 name: "orca.cpu_utilization",
 *                 maxUtilization: 0.9,
 *                 dryRun: true,
 *             },
 *             {
 *                 name: "orca.named_metrics.foo",
 *                 dryRun: false,
 *             },
 *         ],
 *     }],
 * });
 * ```
 * ### Region Backend Service Dynamic Forwarding
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.compute.RegionBackendService("default", {
 *     name: "region-service",
 *     region: "us-central1",
 *     loadBalancingScheme: "EXTERNAL_MANAGED",
 *     dynamicForwarding: {
 *         ipPortSelection: {
 *             enabled: true,
 *         },
 *     },
 * });
 * ```
 * ### Region Backend Service Ha Policy
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.compute.Network("default", {name: "rbs-net"});
 * const defaultRegionBackendService = new gcp.compute.RegionBackendService("default", {
 *     region: "us-central1",
 *     name: "region-service",
 *     protocol: "UDP",
 *     loadBalancingScheme: "EXTERNAL",
 *     network: _default.id,
 *     haPolicy: {
 *         fastIpMove: "GARP_RA",
 *     },
 *     connectionDrainingTimeoutSec: 0,
 * });
 * ```
 * ### Region Backend Service Ha Policy Manual Leader
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.compute.Network("default", {
 *     name: "rbs-net",
 *     autoCreateSubnetworks: false,
 * });
 * const defaultSubnetwork = new gcp.compute.Subnetwork("default", {
 *     name: "rbs-subnet",
 *     ipCidrRange: "10.1.2.0/24",
 *     region: "us-central1",
 *     network: _default.id,
 * });
 * const myImage = gcp.compute.getImage({
 *     family: "debian-12",
 *     project: "debian-cloud",
 * });
 * const endpoint_instance = new gcp.compute.Instance("endpoint-instance", {
 *     networkInterfaces: [{
 *         accessConfigs: [{}],
 *         subnetwork: defaultSubnetwork.id,
 *     }],
 *     name: "rbs-instance",
 *     machineType: "e2-medium",
 *     bootDisk: {
 *         initializeParams: {
 *             image: myImage.then(myImage => myImage.selfLink),
 *         },
 *     },
 * });
 * const neg = new gcp.compute.NetworkEndpointGroup("neg", {
 *     name: "rbs-neg",
 *     networkEndpointType: "GCE_VM_IP",
 *     network: _default.id,
 *     subnetwork: defaultSubnetwork.id,
 *     zone: "us-central1-a",
 * });
 * const endpoint = new gcp.compute.NetworkEndpoint("endpoint", {
 *     networkEndpointGroup: neg.name,
 *     instance: endpoint_instance.name,
 *     ipAddress: endpoint_instance.networkInterfaces.apply(networkInterfaces => networkInterfaces[0].networkIp),
 * });
 * const defaultRegionBackendService = new gcp.compute.RegionBackendService("default", {
 *     region: "us-central1",
 *     name: "region-service",
 *     protocol: "UDP",
 *     loadBalancingScheme: "EXTERNAL",
 *     network: _default.id,
 *     backends: [{
 *         group: neg.selfLink,
 *         balancingMode: "CONNECTION",
 *     }],
 *     haPolicy: {
 *         fastIpMove: "GARP_RA",
 *         leader: {
 *             backendGroup: neg.selfLink,
 *             networkEndpoint: {
 *                 instance: endpoint_instance.name,
 *             },
 *         },
 *     },
 *     connectionDrainingTimeoutSec: 0,
 * });
 * ```
 *
 * ## Import
 *
 * RegionBackendService can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/regions/{{region}}/backendServices/{{name}}`
 *
 * * `{{project}}/{{region}}/{{name}}`
 *
 * * `{{region}}/{{name}}`
 *
 * * `{{name}}`
 *
 * When using the `pulumi import` command, RegionBackendService can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:compute/regionBackendService:RegionBackendService default projects/{{project}}/regions/{{region}}/backendServices/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/regionBackendService:RegionBackendService default {{project}}/{{region}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/regionBackendService:RegionBackendService default {{region}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/regionBackendService:RegionBackendService default {{name}}
 * ```
 */
class RegionBackendService extends pulumi.CustomResource {
    /**
     * Get an existing RegionBackendService 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 RegionBackendService(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of RegionBackendService.  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'] === RegionBackendService.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["affinityCookieTtlSec"] = state?.affinityCookieTtlSec;
            resourceInputs["backends"] = state?.backends;
            resourceInputs["cdnPolicy"] = state?.cdnPolicy;
            resourceInputs["circuitBreakers"] = state?.circuitBreakers;
            resourceInputs["connectionDrainingTimeoutSec"] = state?.connectionDrainingTimeoutSec;
            resourceInputs["connectionTrackingPolicy"] = state?.connectionTrackingPolicy;
            resourceInputs["consistentHash"] = state?.consistentHash;
            resourceInputs["creationTimestamp"] = state?.creationTimestamp;
            resourceInputs["customMetrics"] = state?.customMetrics;
            resourceInputs["description"] = state?.description;
            resourceInputs["dynamicForwarding"] = state?.dynamicForwarding;
            resourceInputs["enableCdn"] = state?.enableCdn;
            resourceInputs["failoverPolicy"] = state?.failoverPolicy;
            resourceInputs["fingerprint"] = state?.fingerprint;
            resourceInputs["generatedId"] = state?.generatedId;
            resourceInputs["haPolicy"] = state?.haPolicy;
            resourceInputs["healthChecks"] = state?.healthChecks;
            resourceInputs["iap"] = state?.iap;
            resourceInputs["ipAddressSelectionPolicy"] = state?.ipAddressSelectionPolicy;
            resourceInputs["loadBalancingScheme"] = state?.loadBalancingScheme;
            resourceInputs["localityLbPolicy"] = state?.localityLbPolicy;
            resourceInputs["logConfig"] = state?.logConfig;
            resourceInputs["name"] = state?.name;
            resourceInputs["network"] = state?.network;
            resourceInputs["outlierDetection"] = state?.outlierDetection;
            resourceInputs["params"] = state?.params;
            resourceInputs["portName"] = state?.portName;
            resourceInputs["project"] = state?.project;
            resourceInputs["protocol"] = state?.protocol;
            resourceInputs["region"] = state?.region;
            resourceInputs["securityPolicy"] = state?.securityPolicy;
            resourceInputs["selfLink"] = state?.selfLink;
            resourceInputs["sessionAffinity"] = state?.sessionAffinity;
            resourceInputs["strongSessionAffinityCookie"] = state?.strongSessionAffinityCookie;
            resourceInputs["subsetting"] = state?.subsetting;
            resourceInputs["timeoutSec"] = state?.timeoutSec;
        }
        else {
            const args = argsOrState;
            resourceInputs["affinityCookieTtlSec"] = args?.affinityCookieTtlSec;
            resourceInputs["backends"] = args?.backends;
            resourceInputs["cdnPolicy"] = args?.cdnPolicy;
            resourceInputs["circuitBreakers"] = args?.circuitBreakers;
            resourceInputs["connectionDrainingTimeoutSec"] = args?.connectionDrainingTimeoutSec;
            resourceInputs["connectionTrackingPolicy"] = args?.connectionTrackingPolicy;
            resourceInputs["consistentHash"] = args?.consistentHash;
            resourceInputs["customMetrics"] = args?.customMetrics;
            resourceInputs["description"] = args?.description;
            resourceInputs["dynamicForwarding"] = args?.dynamicForwarding;
            resourceInputs["enableCdn"] = args?.enableCdn;
            resourceInputs["failoverPolicy"] = args?.failoverPolicy;
            resourceInputs["haPolicy"] = args?.haPolicy;
            resourceInputs["healthChecks"] = args?.healthChecks;
            resourceInputs["iap"] = args?.iap;
            resourceInputs["ipAddressSelectionPolicy"] = args?.ipAddressSelectionPolicy;
            resourceInputs["loadBalancingScheme"] = args?.loadBalancingScheme;
            resourceInputs["localityLbPolicy"] = args?.localityLbPolicy;
            resourceInputs["logConfig"] = args?.logConfig;
            resourceInputs["name"] = args?.name;
            resourceInputs["network"] = args?.network;
            resourceInputs["outlierDetection"] = args?.outlierDetection;
            resourceInputs["params"] = args?.params;
            resourceInputs["portName"] = args?.portName;
            resourceInputs["project"] = args?.project;
            resourceInputs["protocol"] = args?.protocol;
            resourceInputs["region"] = args?.region;
            resourceInputs["securityPolicy"] = args?.securityPolicy;
            resourceInputs["sessionAffinity"] = args?.sessionAffinity;
            resourceInputs["strongSessionAffinityCookie"] = args?.strongSessionAffinityCookie;
            resourceInputs["subsetting"] = args?.subsetting;
            resourceInputs["timeoutSec"] = args?.timeoutSec;
            resourceInputs["creationTimestamp"] = undefined /*out*/;
            resourceInputs["fingerprint"] = undefined /*out*/;
            resourceInputs["generatedId"] = undefined /*out*/;
            resourceInputs["selfLink"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(RegionBackendService.__pulumiType, name, resourceInputs, opts);
    }
}
exports.RegionBackendService = RegionBackendService;
/** @internal */
RegionBackendService.__pulumiType = 'gcp:compute/regionBackendService:RegionBackendService';
//# sourceMappingURL=regionBackendService.js.map