UNPKG

@pulumi/random

Version:

A Pulumi package to safely use randomness in Pulumi programs.

106 lines 4.47 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.RandomPassword = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * import * as random from "@pulumi/random"; * * const password = new random.RandomPassword("password", { * length: 16, * special: true, * overrideSpecial: "!#$%&*()-_=+[]{}<>:?", * }); * const example = new aws.index.DbInstance("example", { * instanceClass: "db.t3.micro", * allocatedStorage: 64, * engine: "mysql", * username: "someone", * password: password.result, * }); * ``` * * ## Import * * You can import external passwords into your Pulumi programs as follows: */ class RandomPassword extends pulumi.CustomResource { /** * Get an existing RandomPassword 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 RandomPassword(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of RandomPassword. 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'] === RandomPassword.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["bcryptHash"] = state?.bcryptHash; 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["bcryptHash"] = undefined /*out*/; resourceInputs["result"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["bcryptHash", "result"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(RandomPassword.__pulumiType, name, resourceInputs, opts); } } exports.RandomPassword = RandomPassword; /** @internal */ RandomPassword.__pulumiType = 'random:index/randomPassword:RandomPassword'; //# sourceMappingURL=randomPassword.js.map