@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
178 lines • 7.5 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.RegionCommitment = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = 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 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",
* },
* ],
* });
* ```
*
* ## 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}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/regionCommitment:RegionCommitment default {{project}}/{{region}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/regionCommitment:RegionCommitment default {{region}}/{{name}}
* ```
*
* ```sh
* $ 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, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* 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 ? state.autoRenew : undefined;
resourceInputs["category"] = state ? state.category : undefined;
resourceInputs["commitmentId"] = state ? state.commitmentId : undefined;
resourceInputs["creationTimestamp"] = state ? state.creationTimestamp : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["endTimestamp"] = state ? state.endTimestamp : undefined;
resourceInputs["existingReservations"] = state ? state.existingReservations : undefined;
resourceInputs["licenseResource"] = state ? state.licenseResource : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["plan"] = state ? state.plan : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["resources"] = state ? state.resources : undefined;
resourceInputs["selfLink"] = state ? state.selfLink : undefined;
resourceInputs["startTimestamp"] = state ? state.startTimestamp : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["statusMessage"] = state ? state.statusMessage : undefined;
resourceInputs["type"] = state ? state.type : undefined;
}
else {
const args = argsOrState;
if ((!args || args.plan === undefined) && !opts.urn) {
throw new Error("Missing required property 'plan'");
}
resourceInputs["autoRenew"] = args ? args.autoRenew : undefined;
resourceInputs["category"] = args ? args.category : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["existingReservations"] = args ? args.existingReservations : undefined;
resourceInputs["licenseResource"] = args ? args.licenseResource : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["plan"] = args ? args.plan : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["resources"] = args ? args.resources : undefined;
resourceInputs["type"] = args ? args.type : undefined;
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;
/** @internal */
RegionCommitment.__pulumiType = 'gcp:compute/regionCommitment:RegionCommitment';
//# sourceMappingURL=regionCommitment.js.map