"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.ConsumerQuotaOverride = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * A consumer override is applied to the consumer on its own authority to limit its own quota usage.
 * Consumer overrides cannot be used to grant more quota than would be allowed by admin overrides,
 * producer overrides, or the default limit of the service.
 *
 * To get more information about ConsumerQuotaOverride, see:
 * * How-to Guides
 *     * [Managing Service Quota](https://cloud.google.com/service-usage/docs/manage-quota)
 *     * [REST API documentation](https://cloud.google.com/service-usage/docs/reference/rest/v1beta1/services.consumerQuotaMetrics.limits.consumerOverrides)
 *
 * ## Example Usage
 *
 * ### Consumer Quota Override
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * import * as std from "@pulumi/std";
 *
 * const myProject = new gcp.organizations.Project("my_project", {
 *     name: "tf-test-project",
 *     projectId: "quota",
 *     orgId: "123456789",
 *     deletionPolicy: "DELETE",
 * });
 * const override = new gcp.serviceusage.ConsumerQuotaOverride("override", {
 *     project: myProject.projectId,
 *     service: "servicemanagement.googleapis.com",
 *     metric: std.urlencode({
 *         input: "servicemanagement.googleapis.com/default_requests",
 *     }).then(invoke => invoke.result),
 *     limit: std.urlencode({
 *         input: "/min/project",
 *     }).then(invoke => invoke.result),
 *     overrideValue: "95",
 *     force: true,
 * });
 * ```
 * ### Region Consumer Quota Override
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * import * as std from "@pulumi/std";
 *
 * const myProject = new gcp.organizations.Project("my_project", {
 *     name: "tf-test-project",
 *     projectId: "quota",
 *     orgId: "123456789",
 *     deletionPolicy: "DELETE",
 * });
 * const override = new gcp.serviceusage.ConsumerQuotaOverride("override", {
 *     dimensions: {
 *         region: "us-central1",
 *     },
 *     project: myProject.projectId,
 *     service: "compute.googleapis.com",
 *     metric: std.urlencode({
 *         input: "compute.googleapis.com/n2_cpus",
 *     }).then(invoke => invoke.result),
 *     limit: std.urlencode({
 *         input: "/project/region",
 *     }).then(invoke => invoke.result),
 *     overrideValue: "8",
 *     force: true,
 * });
 * ```
 * ### Consumer Quota Override Custom Dimension
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * import * as std from "@pulumi/std";
 *
 * const myProject = new gcp.organizations.Project("my_project", {
 *     name: "tf-test-project",
 *     projectId: "quota",
 *     orgId: "123456789",
 *     deletionPolicy: "DELETE",
 * });
 * const override = new gcp.serviceusage.ConsumerQuotaOverride("override", {
 *     project: myProject.projectId,
 *     service: "libraryagent.googleapis.com",
 *     metric: std.urlencode({
 *         input: "libraryagent.googleapis.com/borrows",
 *     }).then(invoke => invoke.result),
 *     limit: std.urlencode({
 *         input: "/author/project",
 *     }).then(invoke => invoke.result),
 *     overrideValue: "1",
 *     force: true,
 *     dimensions: {
 *         author: "larry",
 *     },
 * });
 * ```
 *
 * ## Import
 *
 * ConsumerQuotaOverride can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/services/{{service}}/consumerQuotaMetrics/{{metric}}/limits/{{limit}}/consumerOverrides/{{name}}`
 *
 * * `services/{{service}}/consumerQuotaMetrics/{{metric}}/limits/{{limit}}/consumerOverrides/{{name}}`
 *
 * * `{{service}}/{{metric}}/{{limit}}/{{name}}`
 *
 * When using the `pulumi import` command, ConsumerQuotaOverride can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:serviceusage/consumerQuotaOverride:ConsumerQuotaOverride default projects/{{project}}/services/{{service}}/consumerQuotaMetrics/{{metric}}/limits/{{limit}}/consumerOverrides/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:serviceusage/consumerQuotaOverride:ConsumerQuotaOverride default services/{{service}}/consumerQuotaMetrics/{{metric}}/limits/{{limit}}/consumerOverrides/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:serviceusage/consumerQuotaOverride:ConsumerQuotaOverride default {{service}}/{{metric}}/{{limit}}/{{name}}
 * ```
 */
class ConsumerQuotaOverride extends pulumi.CustomResource {
    /**
     * Get an existing ConsumerQuotaOverride 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 ConsumerQuotaOverride(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of ConsumerQuotaOverride.  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'] === ConsumerQuotaOverride.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["dimensions"] = state?.dimensions;
            resourceInputs["force"] = state?.force;
            resourceInputs["limit"] = state?.limit;
            resourceInputs["metric"] = state?.metric;
            resourceInputs["name"] = state?.name;
            resourceInputs["overrideValue"] = state?.overrideValue;
            resourceInputs["project"] = state?.project;
            resourceInputs["service"] = state?.service;
        }
        else {
            const args = argsOrState;
            if (args?.limit === undefined && !opts.urn) {
                throw new Error("Missing required property 'limit'");
            }
            if (args?.metric === undefined && !opts.urn) {
                throw new Error("Missing required property 'metric'");
            }
            if (args?.overrideValue === undefined && !opts.urn) {
                throw new Error("Missing required property 'overrideValue'");
            }
            if (args?.service === undefined && !opts.urn) {
                throw new Error("Missing required property 'service'");
            }
            resourceInputs["dimensions"] = args?.dimensions;
            resourceInputs["force"] = args?.force;
            resourceInputs["limit"] = args?.limit;
            resourceInputs["metric"] = args?.metric;
            resourceInputs["overrideValue"] = args?.overrideValue;
            resourceInputs["project"] = args?.project;
            resourceInputs["service"] = args?.service;
            resourceInputs["name"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(ConsumerQuotaOverride.__pulumiType, name, resourceInputs, opts);
    }
}
exports.ConsumerQuotaOverride = ConsumerQuotaOverride;
/** @internal */
ConsumerQuotaOverride.__pulumiType = 'gcp:serviceusage/consumerQuotaOverride:ConsumerQuotaOverride';
//# sourceMappingURL=consumerQuotaOverride.js.map