@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
142 lines • 6.06 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.Reservation = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Represents a reservation resource. A reservation ensures that capacity is
* held in a specific zone even if the reserved VMs are not running.
*
* Reservations apply only to Compute Engine, Cloud Dataproc, and Google
* Kubernetes Engine VM usage.Reservations do not apply to `f1-micro` or
* `g1-small` machine types, preemptible VMs, sole tenant nodes, or other
* services not listed above
* like Cloud SQL and Dataflow.
*
* To get more information about Reservation, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/reservations)
* * How-to Guides
* * [Reserving zonal resources](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources)
*
* ## Example Usage
*
* ### Reservation Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const gceReservation = new gcp.compute.Reservation("gce_reservation", {
* name: "gce-reservation",
* zone: "us-central1-a",
* specificReservation: {
* count: 1,
* instanceProperties: {
* minCpuPlatform: "Intel Cascade Lake",
* machineType: "n2-standard-2",
* },
* },
* });
* ```
*
* ## Import
*
* Reservation can be imported using any of these accepted formats:
*
* * `projects/{{project}}/zones/{{zone}}/reservations/{{name}}`
*
* * `{{project}}/{{zone}}/{{name}}`
*
* * `{{zone}}/{{name}}`
*
* * `{{name}}`
*
* When using the `pulumi import` command, Reservation can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/reservation:Reservation default projects/{{project}}/zones/{{zone}}/reservations/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/reservation:Reservation default {{project}}/{{zone}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/reservation:Reservation default {{zone}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/reservation:Reservation default {{name}}
* ```
*/
class Reservation extends pulumi.CustomResource {
/**
* Get an existing Reservation 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 Reservation(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Reservation. 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'] === Reservation.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["commitment"] = state ? state.commitment : undefined;
resourceInputs["creationTimestamp"] = state ? state.creationTimestamp : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["selfLink"] = state ? state.selfLink : undefined;
resourceInputs["shareSettings"] = state ? state.shareSettings : undefined;
resourceInputs["specificReservation"] = state ? state.specificReservation : undefined;
resourceInputs["specificReservationRequired"] = state ? state.specificReservationRequired : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["zone"] = state ? state.zone : undefined;
}
else {
const args = argsOrState;
if ((!args || args.specificReservation === undefined) && !opts.urn) {
throw new Error("Missing required property 'specificReservation'");
}
if ((!args || args.zone === undefined) && !opts.urn) {
throw new Error("Missing required property 'zone'");
}
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["shareSettings"] = args ? args.shareSettings : undefined;
resourceInputs["specificReservation"] = args ? args.specificReservation : undefined;
resourceInputs["specificReservationRequired"] = args ? args.specificReservationRequired : undefined;
resourceInputs["zone"] = args ? args.zone : undefined;
resourceInputs["commitment"] = undefined /*out*/;
resourceInputs["creationTimestamp"] = undefined /*out*/;
resourceInputs["selfLink"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Reservation.__pulumiType, name, resourceInputs, opts);
}
}
exports.Reservation = Reservation;
/** @internal */
Reservation.__pulumiType = 'gcp:compute/reservation:Reservation';
//# sourceMappingURL=reservation.js.map