UNPKG

@pulumi/hcloud

Version:

A Pulumi package for creating and managing hcloud cloud resources.

99 lines 4.04 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 Hetzner Cloud volume resource to manage volumes. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as hcloud from "@pulumi/hcloud"; * * const node1 = new hcloud.Server("node1", { * name: "node1", * image: "debian-11", * serverType: "cx22", * }); * const master = new hcloud.Volume("master", { * name: "volume1", * size: 50, * serverId: node1.id, * automount: true, * format: "ext4", * }); * ``` * * ## Import * * Volumes can be imported using their `id`: * * ```sh * $ pulumi import hcloud:index/volume:Volume example "$VOLUME_ID" * ``` */ 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["automount"] = state ? state.automount : undefined; resourceInputs["deleteProtection"] = state ? state.deleteProtection : undefined; resourceInputs["format"] = state ? state.format : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["linuxDevice"] = state ? state.linuxDevice : undefined; resourceInputs["location"] = state ? state.location : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["serverId"] = state ? state.serverId : undefined; resourceInputs["size"] = state ? state.size : undefined; } else { const args = argsOrState; if ((!args || args.size === undefined) && !opts.urn) { throw new Error("Missing required property 'size'"); } resourceInputs["automount"] = args ? args.automount : undefined; resourceInputs["deleteProtection"] = args ? args.deleteProtection : undefined; resourceInputs["format"] = args ? args.format : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["location"] = args ? args.location : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["serverId"] = args ? args.serverId : undefined; resourceInputs["size"] = args ? args.size : undefined; resourceInputs["linuxDevice"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Volume.__pulumiType, name, resourceInputs, opts); } } exports.Volume = Volume; /** @internal */ Volume.__pulumiType = 'hcloud:index/volume:Volume'; //# sourceMappingURL=volume.js.map