UNPKG

@pulumi/nomad

Version:

A Pulumi package for creating and managing nomad cloud resources.

97 lines 3.67 kB
"use strict"; // *** 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.Variable = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * ## Example Usage * * Creating a variable in the default namespace: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as nomad from "@pulumi/nomad"; * * const example = new nomad.Variable("example", { * path: "some/path/of/your/choosing", * items: { * example_key: "example_value", * }, * }); * ``` * * Creating a variable in a custom namespace: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as nomad from "@pulumi/nomad"; * * const example = new nomad.Namespace("example", { * name: "example", * description: "Example namespace.", * }); * const exampleVariable = new nomad.Variable("example", { * path: "some/path/of/your/choosing", * namespace: example.name, * items: { * example_key: "example_value", * }, * }); * ``` */ class Variable extends pulumi.CustomResource { /** * Get an existing Variable 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 Variable(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Variable. 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'] === Variable.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["items"] = state ? state.items : undefined; resourceInputs["namespace"] = state ? state.namespace : undefined; resourceInputs["path"] = state ? state.path : undefined; } else { const args = argsOrState; if ((!args || args.items === undefined) && !opts.urn) { throw new Error("Missing required property 'items'"); } if ((!args || args.path === undefined) && !opts.urn) { throw new Error("Missing required property 'path'"); } resourceInputs["items"] = (args === null || args === void 0 ? void 0 : args.items) ? pulumi.secret(args.items) : undefined; resourceInputs["namespace"] = args ? args.namespace : undefined; resourceInputs["path"] = args ? args.path : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["items"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(Variable.__pulumiType, name, resourceInputs, opts); } } exports.Variable = Variable; /** @internal */ Variable.__pulumiType = 'nomad:index/variable:Variable'; //# sourceMappingURL=variable.js.map