UNPKG

@pulumi/linode

Version:

A Pulumi package for creating and managing linode cloud resources.

191 lines 8.32 kB
"use strict"; // *** 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.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, Object.assign(Object.assign({}, 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 ? state.capabilities : undefined; resourceInputs["cloudInit"] = state ? state.cloudInit : undefined; resourceInputs["created"] = state ? state.created : undefined; resourceInputs["createdBy"] = state ? state.createdBy : undefined; resourceInputs["deprecated"] = state ? state.deprecated : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["diskId"] = state ? state.diskId : undefined; resourceInputs["expiry"] = state ? state.expiry : undefined; resourceInputs["fileHash"] = state ? state.fileHash : undefined; resourceInputs["filePath"] = state ? state.filePath : undefined; resourceInputs["isPublic"] = state ? state.isPublic : undefined; resourceInputs["label"] = state ? state.label : undefined; resourceInputs["linodeId"] = state ? state.linodeId : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["replicaRegions"] = state ? state.replicaRegions : undefined; resourceInputs["replications"] = state ? state.replications : undefined; resourceInputs["size"] = state ? state.size : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["timeouts"] = state ? state.timeouts : undefined; resourceInputs["totalSize"] = state ? state.totalSize : undefined; resourceInputs["type"] = state ? state.type : undefined; resourceInputs["vendor"] = state ? state.vendor : undefined; resourceInputs["waitForReplications"] = state ? state.waitForReplications : undefined; } else { const args = argsOrState; if ((!args || args.label === undefined) && !opts.urn) { throw new Error("Missing required property 'label'"); } resourceInputs["cloudInit"] = args ? args.cloudInit : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["diskId"] = args ? args.diskId : undefined; resourceInputs["fileHash"] = args ? args.fileHash : undefined; resourceInputs["filePath"] = args ? args.filePath : undefined; resourceInputs["label"] = args ? args.label : undefined; resourceInputs["linodeId"] = args ? args.linodeId : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["replicaRegions"] = args ? args.replicaRegions : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["timeouts"] = args ? args.timeouts : undefined; resourceInputs["waitForReplications"] = args ? args.waitForReplications : undefined; 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