UNPKG

@pulumi/gcp

Version:

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

251 lines • 10.4 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! *** var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Image = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * Represents an Image resource. * * Google Compute Engine uses operating system images to create the root * persistent disks for your instances. You specify an image when you create * an instance. Images contain a boot loader, an operating system, and a * root file system. Linux operating system images are also capable of * running containers on Compute Engine. * * Images can be either public or custom. * * Public images are provided and maintained by Google, open-source * communities, and third-party vendors. By default, all projects have * access to these images and can use them to create instances. Custom * images are available only to your project. You can create a custom image * from root persistent disks and other images. Then, use the custom image * to create an instance. * * To get more information about Image, see: * * * [API documentation](https://cloud.google.com/compute/docs/reference/v1/images) * * How-to Guides * * [Official Documentation](https://cloud.google.com/compute/docs/images) * * ## Example Usage * * ### Image Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const debian = gcp.compute.getImage({ * family: "debian-12", * project: "debian-cloud", * }); * const persistent = new gcp.compute.Disk("persistent", { * name: "example-disk", * image: debian.then(debian => debian.selfLink), * size: 10, * type: "pd-ssd", * zone: "us-central1-a", * }); * const example = new gcp.compute.Image("example", { * name: "example-image", * sourceDisk: persistent.id, * }); * ``` * ### Image Guest Os * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const debian = gcp.compute.getImage({ * family: "debian-12", * project: "debian-cloud", * }); * const persistent = new gcp.compute.Disk("persistent", { * name: "example-disk", * image: debian.then(debian => debian.selfLink), * size: 10, * type: "pd-ssd", * zone: "us-central1-a", * }); * const example = new gcp.compute.Image("example", { * name: "example-image", * sourceDisk: persistent.id, * guestOsFeatures: [ * { * type: "UEFI_COMPATIBLE", * }, * { * type: "VIRTIO_SCSI_MULTIQUEUE", * }, * { * type: "GVNIC", * }, * { * type: "SEV_CAPABLE", * }, * { * type: "SEV_LIVE_MIGRATABLE_V2", * }, * ], * }); * ``` * ### Image Basic Storage Location * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const debian = gcp.compute.getImage({ * family: "debian-12", * project: "debian-cloud", * }); * const persistent = new gcp.compute.Disk("persistent", { * name: "example-disk", * image: debian.then(debian => debian.selfLink), * size: 10, * type: "pd-ssd", * zone: "us-central1-a", * }); * const example = new gcp.compute.Image("example", { * name: "example-sl-image", * sourceDisk: persistent.id, * storageLocations: ["us-central1"], * }); * ``` * * ## Import * * Image can be imported using any of these accepted formats: * * * `projects/{{project}}/global/images/{{name}}` * * `{{project}}/{{name}}` * * `{{name}}` * * When using the `pulumi import` command, Image can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:compute/image:Image default projects/{{project}}/global/images/{{name}} * $ pulumi import gcp:compute/image:Image default {{project}}/{{name}} * $ pulumi import gcp:compute/image:Image default {{name}} * ``` */ class Image extends pulumi.CustomResource { /** * Get an existing Image 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 Image(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:compute/image:Image'; /** * Returns true if the given object is an instance of Image. 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'] === Image.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["archiveSizeBytes"] = state?.archiveSizeBytes; resourceInputs["creationTimestamp"] = state?.creationTimestamp; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["description"] = state?.description; resourceInputs["diskSizeGb"] = state?.diskSizeGb; resourceInputs["effectiveLabels"] = state?.effectiveLabels; resourceInputs["family"] = state?.family; resourceInputs["guestOsFeatures"] = state?.guestOsFeatures; resourceInputs["imageEncryptionKey"] = state?.imageEncryptionKey; resourceInputs["labelFingerprint"] = state?.labelFingerprint; resourceInputs["labels"] = state?.labels; resourceInputs["licenses"] = state?.licenses; resourceInputs["name"] = state?.name; resourceInputs["params"] = state?.params; resourceInputs["project"] = state?.project; resourceInputs["pulumiLabels"] = state?.pulumiLabels; resourceInputs["rawDisk"] = state?.rawDisk; resourceInputs["selfLink"] = state?.selfLink; resourceInputs["shieldedInstanceInitialState"] = state?.shieldedInstanceInitialState; resourceInputs["sourceDisk"] = state?.sourceDisk; resourceInputs["sourceDiskEncryptionKey"] = state?.sourceDiskEncryptionKey; resourceInputs["sourceImage"] = state?.sourceImage; resourceInputs["sourceImageEncryptionKey"] = state?.sourceImageEncryptionKey; resourceInputs["sourceSnapshot"] = state?.sourceSnapshot; resourceInputs["sourceSnapshotEncryptionKey"] = state?.sourceSnapshotEncryptionKey; resourceInputs["storageLocations"] = state?.storageLocations; } else { const args = argsOrState; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["description"] = args?.description; resourceInputs["diskSizeGb"] = args?.diskSizeGb; resourceInputs["family"] = args?.family; resourceInputs["guestOsFeatures"] = args?.guestOsFeatures; resourceInputs["imageEncryptionKey"] = args?.imageEncryptionKey; resourceInputs["labels"] = args?.labels; resourceInputs["licenses"] = args?.licenses; resourceInputs["name"] = args?.name; resourceInputs["params"] = args?.params; resourceInputs["project"] = args?.project; resourceInputs["rawDisk"] = args?.rawDisk; resourceInputs["shieldedInstanceInitialState"] = args?.shieldedInstanceInitialState; resourceInputs["sourceDisk"] = args?.sourceDisk; resourceInputs["sourceDiskEncryptionKey"] = args?.sourceDiskEncryptionKey; resourceInputs["sourceImage"] = args?.sourceImage; resourceInputs["sourceImageEncryptionKey"] = args?.sourceImageEncryptionKey; resourceInputs["sourceSnapshot"] = args?.sourceSnapshot; resourceInputs["sourceSnapshotEncryptionKey"] = args?.sourceSnapshotEncryptionKey; resourceInputs["storageLocations"] = args?.storageLocations; resourceInputs["archiveSizeBytes"] = undefined /*out*/; resourceInputs["creationTimestamp"] = undefined /*out*/; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["labelFingerprint"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; resourceInputs["selfLink"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(Image.__pulumiType, name, resourceInputs, opts); } } exports.Image = Image; //# sourceMappingURL=image.js.map