@pulumi/linode
Version:
A Pulumi package for creating and managing linode cloud resources.
191 lines • 7.59 kB
JavaScript
// *** 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.Image = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides a Linode Image resource. This can be used to create, modify, and delete Linodes Images. Linode Images are snapshots of a Linode Instance Disk which can then be used to provision more Linode Instances. Images can be used across regions.
*
* For more information, see [Linode's documentation on Images](https://www.linode.com/docs/platform/disk-images/linode-images/) and the [Linode APIv4 docs](https://techdocs.akamai.com/linode-api/reference/post-image).
*
* ## Example Usage
*
* Creating an image from an existing Linode Instance and deploying another instance with that image:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const foo = new linode.Instance("foo", {
* type: "g6-nanode-1",
* region: "us-central",
* image: "linode/ubuntu22.04",
* rootPass: "insecure-p4ssw0rd!!",
* });
* const bar = new linode.Image("bar", {
* label: "foo-sda-image",
* description: "Image taken from foo",
* diskId: foo.disks.apply(disks => disks[0].id),
* linodeId: foo.id,
* tags: [
* "image-tag",
* "test",
* ],
* });
* const barBased = new linode.Instance("bar_based", {
* type: foo.type,
* region: "eu-west",
* image: bar.id,
* });
* ```
*
* Creating and uploading an image from a local file:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
* import * as std from "@pulumi/std";
*
* const foobar = new linode.Image("foobar", {
* label: "foobar-image",
* description: "An image uploaded from Terraform!",
* region: "us-southeast",
* tags: [
* "image-tag",
* "test",
* ],
* filePath: "path/to/image.img.gz",
* fileHash: std.filemd5({
* input: "path/to/image.img.gz",
* }).then(invoke => invoke.result),
* });
* ```
*
* Upload and replicate an image from a local file:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
* import * as std from "@pulumi/std";
*
* const foobar = new linode.Image("foobar", {
* label: "foobar-image",
* description: "An image uploaded from Terraform!",
* region: "us-southeast",
* tags: [
* "image-tag",
* "test",
* ],
* filePath: "path/to/image.img.gz",
* fileHash: std.filemd5({
* input: "path/to/image.img.gz",
* }).then(invoke => invoke.result),
* replicaRegions: [
* "us-southeast",
* "us-east",
* "eu-west",
* ],
* });
* ```
*
* ## Import
*
* Linodes Images can be imported using the Linode Image `id`, e.g.
*
* ```sh
* $ pulumi import linode:index/image:Image myimage 1234567
* ```
*/
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 });
}
/**
* 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["capabilities"] = state?.capabilities;
resourceInputs["cloudInit"] = state?.cloudInit;
resourceInputs["created"] = state?.created;
resourceInputs["createdBy"] = state?.createdBy;
resourceInputs["deprecated"] = state?.deprecated;
resourceInputs["description"] = state?.description;
resourceInputs["diskId"] = state?.diskId;
resourceInputs["expiry"] = state?.expiry;
resourceInputs["fileHash"] = state?.fileHash;
resourceInputs["filePath"] = state?.filePath;
resourceInputs["isPublic"] = state?.isPublic;
resourceInputs["label"] = state?.label;
resourceInputs["linodeId"] = state?.linodeId;
resourceInputs["region"] = state?.region;
resourceInputs["replicaRegions"] = state?.replicaRegions;
resourceInputs["replications"] = state?.replications;
resourceInputs["size"] = state?.size;
resourceInputs["status"] = state?.status;
resourceInputs["tags"] = state?.tags;
resourceInputs["timeouts"] = state?.timeouts;
resourceInputs["totalSize"] = state?.totalSize;
resourceInputs["type"] = state?.type;
resourceInputs["vendor"] = state?.vendor;
resourceInputs["waitForReplications"] = state?.waitForReplications;
}
else {
const args = argsOrState;
if (args?.label === undefined && !opts.urn) {
throw new Error("Missing required property 'label'");
}
resourceInputs["cloudInit"] = args?.cloudInit;
resourceInputs["description"] = args?.description;
resourceInputs["diskId"] = args?.diskId;
resourceInputs["fileHash"] = args?.fileHash;
resourceInputs["filePath"] = args?.filePath;
resourceInputs["label"] = args?.label;
resourceInputs["linodeId"] = args?.linodeId;
resourceInputs["region"] = args?.region;
resourceInputs["replicaRegions"] = args?.replicaRegions;
resourceInputs["tags"] = args?.tags;
resourceInputs["timeouts"] = args?.timeouts;
resourceInputs["waitForReplications"] = args?.waitForReplications;
resourceInputs["capabilities"] = undefined /*out*/;
resourceInputs["created"] = undefined /*out*/;
resourceInputs["createdBy"] = undefined /*out*/;
resourceInputs["deprecated"] = undefined /*out*/;
resourceInputs["expiry"] = undefined /*out*/;
resourceInputs["isPublic"] = undefined /*out*/;
resourceInputs["replications"] = undefined /*out*/;
resourceInputs["size"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
resourceInputs["totalSize"] = undefined /*out*/;
resourceInputs["type"] = undefined /*out*/;
resourceInputs["vendor"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Image.__pulumiType, name, resourceInputs, opts);
}
}
exports.Image = Image;
/** @internal */
Image.__pulumiType = 'linode:index/image:Image';
//# sourceMappingURL=image.js.map
;