"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.RegionAutoscaler = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Represents an Autoscaler resource.
 *
 * Autoscalers allow you to automatically scale virtual machine instances in
 * managed instance groups according to an autoscaling policy that you
 * define.
 *
 * To get more information about RegionAutoscaler, see:
 *
 * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/regionAutoscalers)
 * * How-to Guides
 *     * [Autoscaling Groups of Instances](https://cloud.google.com/compute/docs/autoscaler/)
 *
 * ## Example Usage
 *
 * ### Region Autoscaler Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const foobarInstanceTemplate = new gcp.compute.InstanceTemplate("foobar", {
 *     name: "my-instance-template",
 *     machineType: "e2-standard-4",
 *     disks: [{
 *         sourceImage: "debian-cloud/debian-11",
 *         diskSizeGb: 250,
 *     }],
 *     networkInterfaces: [{
 *         network: "default",
 *         accessConfigs: [{
 *             networkTier: "PREMIUM",
 *         }],
 *     }],
 *     serviceAccount: {
 *         scopes: [
 *             "https://www.googleapis.com/auth/devstorage.read_only",
 *             "https://www.googleapis.com/auth/logging.write",
 *             "https://www.googleapis.com/auth/monitoring.write",
 *             "https://www.googleapis.com/auth/pubsub",
 *             "https://www.googleapis.com/auth/service.management.readonly",
 *             "https://www.googleapis.com/auth/servicecontrol",
 *             "https://www.googleapis.com/auth/trace.append",
 *         ],
 *     },
 * });
 * const foobarTargetPool = new gcp.compute.TargetPool("foobar", {name: "my-target-pool"});
 * const foobarRegionInstanceGroupManager = new gcp.compute.RegionInstanceGroupManager("foobar", {
 *     name: "my-region-igm",
 *     region: "us-central1",
 *     versions: [{
 *         instanceTemplate: foobarInstanceTemplate.id,
 *         name: "primary",
 *     }],
 *     targetPools: [foobarTargetPool.id],
 *     baseInstanceName: "foobar",
 * });
 * const foobar = new gcp.compute.RegionAutoscaler("foobar", {
 *     name: "my-region-autoscaler",
 *     region: "us-central1",
 *     target: foobarRegionInstanceGroupManager.id,
 *     autoscalingPolicy: {
 *         maxReplicas: 5,
 *         minReplicas: 1,
 *         cooldownPeriod: 60,
 *         cpuUtilization: {
 *             target: 0.5,
 *         },
 *     },
 * });
 * const debian9 = gcp.compute.getImage({
 *     family: "debian-11",
 *     project: "debian-cloud",
 * });
 * ```
 *
 * ## Import
 *
 * RegionAutoscaler can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/regions/{{region}}/autoscalers/{{name}}`
 *
 * * `{{project}}/{{region}}/{{name}}`
 *
 * * `{{region}}/{{name}}`
 *
 * * `{{name}}`
 *
 * When using the `pulumi import` command, RegionAutoscaler can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:compute/regionAutoscaler:RegionAutoscaler default projects/{{project}}/regions/{{region}}/autoscalers/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/regionAutoscaler:RegionAutoscaler default {{project}}/{{region}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/regionAutoscaler:RegionAutoscaler default {{region}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/regionAutoscaler:RegionAutoscaler default {{name}}
 * ```
 */
class RegionAutoscaler extends pulumi.CustomResource {
    /**
     * Get an existing RegionAutoscaler 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 RegionAutoscaler(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of RegionAutoscaler.  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'] === RegionAutoscaler.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["autoscalingPolicy"] = state?.autoscalingPolicy;
            resourceInputs["creationTimestamp"] = state?.creationTimestamp;
            resourceInputs["description"] = state?.description;
            resourceInputs["name"] = state?.name;
            resourceInputs["project"] = state?.project;
            resourceInputs["region"] = state?.region;
            resourceInputs["selfLink"] = state?.selfLink;
            resourceInputs["target"] = state?.target;
        }
        else {
            const args = argsOrState;
            if (args?.autoscalingPolicy === undefined && !opts.urn) {
                throw new Error("Missing required property 'autoscalingPolicy'");
            }
            if (args?.target === undefined && !opts.urn) {
                throw new Error("Missing required property 'target'");
            }
            resourceInputs["autoscalingPolicy"] = args?.autoscalingPolicy;
            resourceInputs["description"] = args?.description;
            resourceInputs["name"] = args?.name;
            resourceInputs["project"] = args?.project;
            resourceInputs["region"] = args?.region;
            resourceInputs["target"] = args?.target;
            resourceInputs["creationTimestamp"] = undefined /*out*/;
            resourceInputs["selfLink"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(RegionAutoscaler.__pulumiType, name, resourceInputs, opts);
    }
}
exports.RegionAutoscaler = RegionAutoscaler;
/** @internal */
RegionAutoscaler.__pulumiType = 'gcp:compute/regionAutoscaler:RegionAutoscaler';
//# sourceMappingURL=regionAutoscaler.js.map