UNPKG

@pulumi/linode

Version:

A Pulumi package for creating and managing linode cloud resources.

106 lines 4.92 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.Volume = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Provides a Linode Volume resource. This can be used to create, modify, and delete Linodes Block Storage Volumes. Block Storage Volumes are removable storage disks that persist outside the life-cycle of Linode Instances. These volumes can be attached to and detached from Linode instances throughout a region. * * For more information, see [How to Use Block Storage with Your Linode](https://www.linode.com/docs/platform/block-storage/how-to-use-block-storage-with-your-linode/) and the [Linode APIv4 docs](https://techdocs.akamai.com/linode-api/reference/post-volume). * * ## Example Usage * * The following example shows how one might use this resource to configure a Block Storage Volume attached to a Linode Instance. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as linode from "@pulumi/linode"; * * const foobaz = new linode.Instance("foobaz", { * rootPass: "3X4mp13", * type: "g6-nanode-1", * region: "us-west", * tags: ["foobaz"], * }); * const foobar = new linode.Volume("foobar", { * label: "foo-volume", * region: foobaz.region, * linodeId: foobaz.id, * }); * ``` * * Volumes can also be attached using the Linode Instance config device map. * * ## Import * * Linodes Volumes can be imported using the Linode Volume `id`, e.g. * * ```sh * $ pulumi import linode:index/volume:Volume myvolume 1234567 * ``` */ class Volume extends pulumi.CustomResource { /** * Get an existing Volume 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 Volume(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Volume. 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'] === Volume.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["encryption"] = state ? state.encryption : undefined; resourceInputs["filesystemPath"] = state ? state.filesystemPath : undefined; resourceInputs["label"] = state ? state.label : undefined; resourceInputs["linodeId"] = state ? state.linodeId : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["size"] = state ? state.size : undefined; resourceInputs["sourceVolumeId"] = state ? state.sourceVolumeId : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["timeouts"] = state ? state.timeouts : undefined; } else { const args = argsOrState; if ((!args || args.label === undefined) && !opts.urn) { throw new Error("Missing required property 'label'"); } resourceInputs["encryption"] = args ? args.encryption : undefined; resourceInputs["label"] = args ? args.label : undefined; resourceInputs["linodeId"] = args ? args.linodeId : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["size"] = args ? args.size : undefined; resourceInputs["sourceVolumeId"] = args ? args.sourceVolumeId : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["timeouts"] = args ? args.timeouts : undefined; resourceInputs["filesystemPath"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Volume.__pulumiType, name, resourceInputs, opts); } } exports.Volume = Volume; /** @internal */ Volume.__pulumiType = 'linode:index/volume:Volume'; //# sourceMappingURL=volume.js.map