@pulumi/nomad
Version:
A Pulumi package for creating and managing nomad cloud resources.
129 lines • 6.07 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.DynamicHostVolume = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* layout: "nomad"
* page_title: "Nomad: nomad.DynamicHostVolume"
* sidebar_current: "docs-nomad-resource-dynamic-host-volume"
* description: |-
* Manages the lifecycle of creating and deleting dynamic host volumes.
* ---
*
* Creates and registers a dynamic host volume in Nomad. Note that Nomad supports
* two workflows for dynamic host volumes: create and register. Both resources
* result in the same data source with the same outputs.
*
* > **Warning:** Destroying this resource **will result in data loss**. Use the
* [`preventDestroy`][tfDocsPreventDestroy] directive to avoid accidental
* deletions.
*
* ## Example Usage
*
* Creating a dynamic host volume:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as nomad from "@pulumi/nomad";
*
* const example = new nomad.DynamicHostVolume("example", {
* name: "example",
* namespace: "prod",
* pluginId: "mkdir",
* capacityMax: "12 GiB",
* capacityMin: "1.0 GiB",
* capabilities: [{
* accessMode: "single-node-writer",
* attachmentMode: "file-system",
* }],
* constraints: [{
* attribute: `${attr.kernel.name}`,
* value: "linux",
* }],
* parameters: {
* some_key: "some_value",
* },
* });
* ```
*/
class DynamicHostVolume extends pulumi.CustomResource {
/**
* Get an existing DynamicHostVolume 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 DynamicHostVolume(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of DynamicHostVolume. 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'] === DynamicHostVolume.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["capabilities"] = state ? state.capabilities : undefined;
resourceInputs["capacity"] = state ? state.capacity : undefined;
resourceInputs["capacityBytes"] = state ? state.capacityBytes : undefined;
resourceInputs["capacityMax"] = state ? state.capacityMax : undefined;
resourceInputs["capacityMaxBytes"] = state ? state.capacityMaxBytes : undefined;
resourceInputs["capacityMin"] = state ? state.capacityMin : undefined;
resourceInputs["capacityMinBytes"] = state ? state.capacityMinBytes : undefined;
resourceInputs["constraints"] = state ? state.constraints : undefined;
resourceInputs["hostPath"] = state ? state.hostPath : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["namespace"] = state ? state.namespace : undefined;
resourceInputs["nodeId"] = state ? state.nodeId : undefined;
resourceInputs["nodePool"] = state ? state.nodePool : undefined;
resourceInputs["parameters"] = state ? state.parameters : undefined;
resourceInputs["pluginId"] = state ? state.pluginId : undefined;
resourceInputs["state"] = state ? state.state : undefined;
}
else {
const args = argsOrState;
if ((!args || args.capabilities === undefined) && !opts.urn) {
throw new Error("Missing required property 'capabilities'");
}
if ((!args || args.pluginId === undefined) && !opts.urn) {
throw new Error("Missing required property 'pluginId'");
}
resourceInputs["capabilities"] = args ? args.capabilities : undefined;
resourceInputs["capacityMax"] = args ? args.capacityMax : undefined;
resourceInputs["capacityMin"] = args ? args.capacityMin : undefined;
resourceInputs["constraints"] = args ? args.constraints : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["namespace"] = args ? args.namespace : undefined;
resourceInputs["nodeId"] = args ? args.nodeId : undefined;
resourceInputs["nodePool"] = args ? args.nodePool : undefined;
resourceInputs["parameters"] = args ? args.parameters : undefined;
resourceInputs["pluginId"] = args ? args.pluginId : undefined;
resourceInputs["capacity"] = undefined /*out*/;
resourceInputs["capacityBytes"] = undefined /*out*/;
resourceInputs["capacityMaxBytes"] = undefined /*out*/;
resourceInputs["capacityMinBytes"] = undefined /*out*/;
resourceInputs["hostPath"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(DynamicHostVolume.__pulumiType, name, resourceInputs, opts);
}
}
exports.DynamicHostVolume = DynamicHostVolume;
/** @internal */
DynamicHostVolume.__pulumiType = 'nomad:index/dynamicHostVolume:DynamicHostVolume';
//# sourceMappingURL=dynamicHostVolume.js.map