UNPKG

@pulumi/random

Version:

A Pulumi package to safely use randomness in Pulumi programs.

100 lines 4.4 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.RandomString = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * The resource `random.RandomString` generates a random permutation of alphanumeric characters and optionally special characters. * * This resource *does* use a cryptographic random number generator. * * Historically this resource's intended usage has been ambiguous as the original example used it in a password. For backwards compatibility it will continue to exist. For unique ids please use random_id, for sensitive random values please use random_password. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as random from "@pulumi/random"; * * const random = new random.RandomString("random", { * length: 16, * special: true, * overrideSpecial: "/@£$", * }); * ``` * * ## Import * * You can import external strings into your Pulumi programs as RandomString resources as follows: */ class RandomString extends pulumi.CustomResource { /** * Get an existing RandomString 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 RandomString(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of RandomString. 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'] === RandomString.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["keepers"] = state?.keepers; resourceInputs["length"] = state?.length; resourceInputs["lower"] = state?.lower; resourceInputs["minLower"] = state?.minLower; resourceInputs["minNumeric"] = state?.minNumeric; resourceInputs["minSpecial"] = state?.minSpecial; resourceInputs["minUpper"] = state?.minUpper; resourceInputs["number"] = state?.number; resourceInputs["numeric"] = state?.numeric; resourceInputs["overrideSpecial"] = state?.overrideSpecial; resourceInputs["result"] = state?.result; resourceInputs["special"] = state?.special; resourceInputs["upper"] = state?.upper; } else { const args = argsOrState; if (args?.length === undefined && !opts.urn) { throw new Error("Missing required property 'length'"); } resourceInputs["keepers"] = args?.keepers; resourceInputs["length"] = args?.length; resourceInputs["lower"] = args?.lower; resourceInputs["minLower"] = args?.minLower; resourceInputs["minNumeric"] = args?.minNumeric; resourceInputs["minSpecial"] = args?.minSpecial; resourceInputs["minUpper"] = args?.minUpper; resourceInputs["number"] = args?.number; resourceInputs["numeric"] = args?.numeric; resourceInputs["overrideSpecial"] = args?.overrideSpecial; resourceInputs["special"] = args?.special; resourceInputs["upper"] = args?.upper; resourceInputs["result"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(RandomString.__pulumiType, name, resourceInputs, opts); } } exports.RandomString = RandomString; /** @internal */ RandomString.__pulumiType = 'random:index/randomString:RandomString'; //# sourceMappingURL=randomString.js.map