@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
129 lines • 5.84 kB
JavaScript
// *** 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.CapacityCommitment = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Capacity commitment is a way to purchase compute capacity for BigQuery jobs (in the form of slots) with some committed period of usage. Annual commitments renew by default. Commitments can be removed after their commitment end time passes.
*
* In order to remove annual commitment, its plan needs to be changed to monthly or flex first.
*
* To get more information about CapacityCommitment, see:
*
* * [API documentation](https://cloud.google.com/bigquery/docs/reference/reservations/rest/v1/projects.locations.capacityCommitments)
* * How-to Guides
* * [Introduction to Reservations](https://cloud.google.com/bigquery/docs/reservations-intro)
*
* ## Example Usage
*
* ### Bigquery Reservation Capacity Commitment Docs
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.bigquery.CapacityCommitment("example", {
* capacityCommitmentId: "example-commitment",
* location: "us-west2",
* slotCount: 100,
* plan: "FLEX_FLAT_RATE",
* edition: "ENTERPRISE",
* });
* ```
*
* ## Import
*
* CapacityCommitment can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/capacityCommitments/{{capacity_commitment_id}}`
*
* * `{{project}}/{{location}}/{{capacity_commitment_id}}`
*
* * `{{location}}/{{capacity_commitment_id}}`
*
* When using the `pulumi import` command, CapacityCommitment can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:bigquery/capacityCommitment:CapacityCommitment default projects/{{project}}/locations/{{location}}/capacityCommitments/{{capacity_commitment_id}}
* ```
*
* ```sh
* $ pulumi import gcp:bigquery/capacityCommitment:CapacityCommitment default {{project}}/{{location}}/{{capacity_commitment_id}}
* ```
*
* ```sh
* $ pulumi import gcp:bigquery/capacityCommitment:CapacityCommitment default {{location}}/{{capacity_commitment_id}}
* ```
*/
class CapacityCommitment extends pulumi.CustomResource {
/**
* Get an existing CapacityCommitment 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 CapacityCommitment(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of CapacityCommitment. 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'] === CapacityCommitment.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["capacityCommitmentId"] = state?.capacityCommitmentId;
resourceInputs["commitmentEndTime"] = state?.commitmentEndTime;
resourceInputs["commitmentStartTime"] = state?.commitmentStartTime;
resourceInputs["edition"] = state?.edition;
resourceInputs["enforceSingleAdminProjectPerOrg"] = state?.enforceSingleAdminProjectPerOrg;
resourceInputs["location"] = state?.location;
resourceInputs["name"] = state?.name;
resourceInputs["plan"] = state?.plan;
resourceInputs["project"] = state?.project;
resourceInputs["renewalPlan"] = state?.renewalPlan;
resourceInputs["slotCount"] = state?.slotCount;
resourceInputs["state"] = state?.state;
}
else {
const args = argsOrState;
if (args?.plan === undefined && !opts.urn) {
throw new Error("Missing required property 'plan'");
}
if (args?.slotCount === undefined && !opts.urn) {
throw new Error("Missing required property 'slotCount'");
}
resourceInputs["capacityCommitmentId"] = args?.capacityCommitmentId;
resourceInputs["edition"] = args?.edition;
resourceInputs["enforceSingleAdminProjectPerOrg"] = args?.enforceSingleAdminProjectPerOrg;
resourceInputs["location"] = args?.location;
resourceInputs["plan"] = args?.plan;
resourceInputs["project"] = args?.project;
resourceInputs["renewalPlan"] = args?.renewalPlan;
resourceInputs["slotCount"] = args?.slotCount;
resourceInputs["commitmentEndTime"] = undefined /*out*/;
resourceInputs["commitmentStartTime"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(CapacityCommitment.__pulumiType, name, resourceInputs, opts);
}
}
exports.CapacityCommitment = CapacityCommitment;
/** @internal */
CapacityCommitment.__pulumiType = 'gcp:bigquery/capacityCommitment:CapacityCommitment';
//# sourceMappingURL=capacityCommitment.js.map
;