@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
204 lines • 8.42 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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RegionCommitment = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Represents a regional Commitment resource.
*
* Creating a commitment resource means that you are purchasing a committed
* use contract with an explicit start and end time. You can create commitments
* based on vCPUs and memory usage and receive discounted rates.
*
* To get more information about RegionCommitment, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/regionCommitments)
* * How-to Guides
* * [Committed use discounts for Compute Engine](https://cloud.google.com/compute/docs/instances/committed-use-discounts-overview)
*
* ## Example Usage
*
* ### Compute Region Commitment Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const foobar = new gcp.compute.RegionCommitment("foobar", {
* name: "my-region-commitment",
* plan: "THIRTY_SIX_MONTH",
* resources: [
* {
* type: "VCPU",
* amount: "4",
* },
* {
* type: "MEMORY",
* amount: "9",
* },
* ],
* });
* ```
* ### Compute Region Commitment Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const tagKey = new gcp.tags.TagKey("tag_key", {
* parent: "organizations/ORG_ID",
* shortName: "tagkey",
* });
* const tagValue = new gcp.tags.TagValue("tag_value", {
* parent: tagKey.id,
* shortName: "tagvalue",
* });
* const foobar = new gcp.compute.RegionCommitment("foobar", {
* name: "my-full-commitment",
* description: "some description",
* plan: "THIRTY_SIX_MONTH",
* type: "MEMORY_OPTIMIZED",
* category: "MACHINE",
* autoRenew: true,
* resources: [
* {
* type: "VCPU",
* amount: "4",
* },
* {
* type: "MEMORY",
* amount: "9",
* },
* ],
* params: {
* resourceManagerTags: pulumi.all([tagKey.id, tagValue.id]).apply(([tagKeyId, tagValueId]) => {
* [tagKeyId]: tagValueId,
* }),
* },
* });
* ```
*
* ## Import
*
* RegionCommitment can be imported using any of these accepted formats:
*
* * `projects/{{project}}/regions/{{region}}/commitments/{{name}}`
* * `{{project}}/{{region}}/{{name}}`
* * `{{region}}/{{name}}`
* * `{{name}}`
*
* When using the `pulumi import` command, RegionCommitment can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/regionCommitment:RegionCommitment default projects/{{project}}/regions/{{region}}/commitments/{{name}}
* $ pulumi import gcp:compute/regionCommitment:RegionCommitment default {{project}}/{{region}}/{{name}}
* $ pulumi import gcp:compute/regionCommitment:RegionCommitment default {{region}}/{{name}}
* $ pulumi import gcp:compute/regionCommitment:RegionCommitment default {{name}}
* ```
*/
class RegionCommitment extends pulumi.CustomResource {
/**
* Get an existing RegionCommitment 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 RegionCommitment(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:compute/regionCommitment:RegionCommitment';
/**
* Returns true if the given object is an instance of RegionCommitment. 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'] === RegionCommitment.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["autoRenew"] = state?.autoRenew;
resourceInputs["category"] = state?.category;
resourceInputs["commitmentId"] = state?.commitmentId;
resourceInputs["creationTimestamp"] = state?.creationTimestamp;
resourceInputs["description"] = state?.description;
resourceInputs["endTimestamp"] = state?.endTimestamp;
resourceInputs["existingReservations"] = state?.existingReservations;
resourceInputs["licenseResource"] = state?.licenseResource;
resourceInputs["name"] = state?.name;
resourceInputs["params"] = state?.params;
resourceInputs["plan"] = state?.plan;
resourceInputs["project"] = state?.project;
resourceInputs["region"] = state?.region;
resourceInputs["resources"] = state?.resources;
resourceInputs["selfLink"] = state?.selfLink;
resourceInputs["startTimestamp"] = state?.startTimestamp;
resourceInputs["status"] = state?.status;
resourceInputs["statusMessage"] = state?.statusMessage;
resourceInputs["type"] = state?.type;
}
else {
const args = argsOrState;
if (args?.plan === undefined && !opts.urn) {
throw new Error("Missing required property 'plan'");
}
resourceInputs["autoRenew"] = args?.autoRenew;
resourceInputs["category"] = args?.category;
resourceInputs["description"] = args?.description;
resourceInputs["existingReservations"] = args?.existingReservations;
resourceInputs["licenseResource"] = args?.licenseResource;
resourceInputs["name"] = args?.name;
resourceInputs["params"] = args?.params;
resourceInputs["plan"] = args?.plan;
resourceInputs["project"] = args?.project;
resourceInputs["region"] = args?.region;
resourceInputs["resources"] = args?.resources;
resourceInputs["type"] = args?.type;
resourceInputs["commitmentId"] = undefined /*out*/;
resourceInputs["creationTimestamp"] = undefined /*out*/;
resourceInputs["endTimestamp"] = undefined /*out*/;
resourceInputs["selfLink"] = undefined /*out*/;
resourceInputs["startTimestamp"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
resourceInputs["statusMessage"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(RegionCommitment.__pulumiType, name, resourceInputs, opts);
}
}
exports.RegionCommitment = RegionCommitment;
//# sourceMappingURL=regionCommitment.js.map