@pulumi/linode
Version:
A Pulumi package for creating and managing linode cloud resources.
138 lines • 5.33 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.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.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const foo = new linode.Instance("foo", {
* region: "us-east",
* type: "g6-nanode-1",
* });
* const fooInstanceConfig = new linode.InstanceConfig("foo", {
* linodeId: foo.id,
* label: "boot-existing-volume",
* kernel: "linode/grub2",
* devices: [{
* deviceName: "sda",
* volumeId: 12345,
* }],
* booted: true,
* });
* ```
*
* Volumes may also be cloned from existing volumes.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const foobar = new linode.Volume("foobar", {
* label: "my-cloned-volume",
* sourceVolumeId: 12345,
* });
* ```
*
* ## 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, { ...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?.encryption;
resourceInputs["filesystemPath"] = state?.filesystemPath;
resourceInputs["label"] = state?.label;
resourceInputs["linodeId"] = state?.linodeId;
resourceInputs["region"] = state?.region;
resourceInputs["size"] = state?.size;
resourceInputs["sourceVolumeId"] = state?.sourceVolumeId;
resourceInputs["status"] = state?.status;
resourceInputs["tags"] = state?.tags;
resourceInputs["timeouts"] = state?.timeouts;
}
else {
const args = argsOrState;
if (args?.label === undefined && !opts.urn) {
throw new Error("Missing required property 'label'");
}
resourceInputs["encryption"] = args?.encryption;
resourceInputs["label"] = args?.label;
resourceInputs["linodeId"] = args?.linodeId;
resourceInputs["region"] = args?.region;
resourceInputs["size"] = args?.size;
resourceInputs["sourceVolumeId"] = args?.sourceVolumeId;
resourceInputs["tags"] = args?.tags;
resourceInputs["timeouts"] = args?.timeouts;
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