"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.MachineImage = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Represents a Machine Image resource. Machine images store all the configuration,
 * metadata, permissions, and data from one or more disks required to create a
 * Virtual machine (VM) instance.
 *
 * To get more information about MachineImage, see:
 *
 * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/beta/machineImages)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/compute/docs/machine-images)
 *
 * ## Example Usage
 *
 * ### Machine Image Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const vm = new gcp.compute.Instance("vm", {
 *     name: "my-vm",
 *     machineType: "e2-medium",
 *     bootDisk: {
 *         initializeParams: {
 *             image: "debian-cloud/debian-11",
 *         },
 *     },
 *     networkInterfaces: [{
 *         network: "default",
 *     }],
 * });
 * const image = new gcp.compute.MachineImage("image", {
 *     name: "my-image",
 *     sourceInstance: vm.selfLink,
 * });
 * ```
 * ### Compute Machine Image Kms
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const vm = new gcp.compute.Instance("vm", {
 *     name: "my-vm",
 *     machineType: "e2-medium",
 *     bootDisk: {
 *         initializeParams: {
 *             image: "debian-cloud/debian-11",
 *         },
 *     },
 *     networkInterfaces: [{
 *         network: "default",
 *     }],
 * });
 * const keyRing = new gcp.kms.KeyRing("key_ring", {
 *     name: "keyring",
 *     location: "us",
 * });
 * const cryptoKey = new gcp.kms.CryptoKey("crypto_key", {
 *     name: "key",
 *     keyRing: keyRing.id,
 * });
 * const image = new gcp.compute.MachineImage("image", {
 *     name: "my-image",
 *     sourceInstance: vm.selfLink,
 *     machineImageEncryptionKey: {
 *         kmsKeyName: cryptoKey.id,
 *     },
 * });
 * ```
 *
 * ## Import
 *
 * MachineImage can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/global/machineImages/{{name}}`
 *
 * * `{{project}}/{{name}}`
 *
 * * `{{name}}`
 *
 * When using the `pulumi import` command, MachineImage can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:compute/machineImage:MachineImage default projects/{{project}}/global/machineImages/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/machineImage:MachineImage default {{project}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/machineImage:MachineImage default {{name}}
 * ```
 */
class MachineImage extends pulumi.CustomResource {
    /**
     * Get an existing MachineImage 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 MachineImage(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of MachineImage.  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'] === MachineImage.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["description"] = state?.description;
            resourceInputs["guestFlush"] = state?.guestFlush;
            resourceInputs["machineImageEncryptionKey"] = state?.machineImageEncryptionKey;
            resourceInputs["name"] = state?.name;
            resourceInputs["project"] = state?.project;
            resourceInputs["selfLink"] = state?.selfLink;
            resourceInputs["sourceInstance"] = state?.sourceInstance;
            resourceInputs["storageLocations"] = state?.storageLocations;
        }
        else {
            const args = argsOrState;
            if (args?.sourceInstance === undefined && !opts.urn) {
                throw new Error("Missing required property 'sourceInstance'");
            }
            resourceInputs["description"] = args?.description;
            resourceInputs["guestFlush"] = args?.guestFlush;
            resourceInputs["machineImageEncryptionKey"] = args?.machineImageEncryptionKey;
            resourceInputs["name"] = args?.name;
            resourceInputs["project"] = args?.project;
            resourceInputs["sourceInstance"] = args?.sourceInstance;
            resourceInputs["selfLink"] = undefined /*out*/;
            resourceInputs["storageLocations"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(MachineImage.__pulumiType, name, resourceInputs, opts);
    }
}
exports.MachineImage = MachineImage;
/** @internal */
MachineImage.__pulumiType = 'gcp:compute/machineImage:MachineImage';
//# sourceMappingURL=machineImage.js.map