UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

178 lines 6.9 kB
"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.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, { ...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?.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["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["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; /** @internal */ RegionCommitment.__pulumiType = 'gcp:compute/regionCommitment:RegionCommitment'; //# sourceMappingURL=regionCommitment.js.map