"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.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",
 *         },
 *     },
 * });
 * ```
 * ### Reservation Basic Beta
 *
 * ```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",
 *             maintenanceInterval: "PERIODIC",
 *         },
 *     },
 *     enableEmergentMaintenance: true,
 * });
 * ```
 * ### Reservation Source Instance Template
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const myImage = gcp.compute.getImage({
 *     family: "debian-11",
 *     project: "debian-cloud",
 * });
 * const foobar = new gcp.compute.InstanceTemplate("foobar", {
 *     name: "instance-template",
 *     machineType: "n2-standard-2",
 *     canIpForward: false,
 *     tags: [
 *         "foo",
 *         "bar",
 *     ],
 *     disks: [{
 *         sourceImage: myImage.then(myImage => myImage.selfLink),
 *         autoDelete: true,
 *         boot: true,
 *     }],
 *     networkInterfaces: [{
 *         network: "default",
 *     }],
 *     scheduling: {
 *         preemptible: false,
 *         automaticRestart: true,
 *     },
 *     metadata: {
 *         foo: "bar",
 *     },
 *     serviceAccount: {
 *         scopes: [
 *             "userinfo-email",
 *             "compute-ro",
 *             "storage-ro",
 *         ],
 *     },
 *     labels: {
 *         my_label: "foobar",
 *     },
 * });
 * const gceReservationSourceInstanceTemplate = new gcp.compute.Reservation("gce_reservation_source_instance_template", {
 *     name: "gce-reservation-source-instance-template",
 *     zone: "us-central1-a",
 *     specificReservation: {
 *         count: 1,
 *         sourceInstanceTemplate: foobar.selfLink,
 *     },
 * });
 * ```
 * ### Reservation Sharing Policy
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const myImage = gcp.compute.getImage({
 *     family: "debian-11",
 *     project: "debian-cloud",
 * });
 * const foobar = new gcp.compute.InstanceTemplate("foobar", {
 *     name: "instance-template",
 *     machineType: "g2-standard-4",
 *     canIpForward: false,
 *     tags: [
 *         "foo",
 *         "bar",
 *     ],
 *     disks: [{
 *         sourceImage: myImage.then(myImage => myImage.selfLink),
 *         autoDelete: true,
 *         boot: true,
 *     }],
 *     networkInterfaces: [{
 *         network: "default",
 *     }],
 *     scheduling: {
 *         preemptible: false,
 *         automaticRestart: true,
 *     },
 *     metadata: {
 *         foo: "bar",
 *     },
 *     serviceAccount: {
 *         scopes: [
 *             "userinfo-email",
 *             "compute-ro",
 *             "storage-ro",
 *         ],
 *     },
 *     labels: {
 *         my_label: "foobar",
 *     },
 * });
 * const gceReservationSharingPolicy = new gcp.compute.Reservation("gce_reservation_sharing_policy", {
 *     name: "gce-reservation-sharing-policy",
 *     zone: "us-central1-b",
 *     specificReservation: {
 *         count: 2,
 *         sourceInstanceTemplate: foobar.selfLink,
 *     },
 *     reservationSharingPolicy: {
 *         serviceShareType: "ALLOW_ALL",
 *     },
 * });
 * ```
 *
 * ## 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, { ...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?.commitment;
            resourceInputs["creationTimestamp"] = state?.creationTimestamp;
            resourceInputs["deleteAfterDuration"] = state?.deleteAfterDuration;
            resourceInputs["deleteAtTime"] = state?.deleteAtTime;
            resourceInputs["description"] = state?.description;
            resourceInputs["enableEmergentMaintenance"] = state?.enableEmergentMaintenance;
            resourceInputs["name"] = state?.name;
            resourceInputs["project"] = state?.project;
            resourceInputs["reservationSharingPolicy"] = state?.reservationSharingPolicy;
            resourceInputs["selfLink"] = state?.selfLink;
            resourceInputs["shareSettings"] = state?.shareSettings;
            resourceInputs["specificReservation"] = state?.specificReservation;
            resourceInputs["specificReservationRequired"] = state?.specificReservationRequired;
            resourceInputs["status"] = state?.status;
            resourceInputs["zone"] = state?.zone;
        }
        else {
            const args = argsOrState;
            if (args?.specificReservation === undefined && !opts.urn) {
                throw new Error("Missing required property 'specificReservation'");
            }
            if (args?.zone === undefined && !opts.urn) {
                throw new Error("Missing required property 'zone'");
            }
            resourceInputs["deleteAfterDuration"] = args?.deleteAfterDuration;
            resourceInputs["deleteAtTime"] = args?.deleteAtTime;
            resourceInputs["description"] = args?.description;
            resourceInputs["enableEmergentMaintenance"] = args?.enableEmergentMaintenance;
            resourceInputs["name"] = args?.name;
            resourceInputs["project"] = args?.project;
            resourceInputs["reservationSharingPolicy"] = args?.reservationSharingPolicy;
            resourceInputs["shareSettings"] = args?.shareSettings;
            resourceInputs["specificReservation"] = args?.specificReservation;
            resourceInputs["specificReservationRequired"] = args?.specificReservationRequired;
            resourceInputs["zone"] = args?.zone;
            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