@pulumi/random
Version:
A Pulumi package to safely use randomness in Pulumi programs.
106 lines • 5 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.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.rds.Instance("example", {
* instanceClass: aws.rds.InstanceType.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, Object.assign(Object.assign({}, 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 ? state.bcryptHash : undefined;
resourceInputs["keepers"] = state ? state.keepers : undefined;
resourceInputs["length"] = state ? state.length : undefined;
resourceInputs["lower"] = state ? state.lower : undefined;
resourceInputs["minLower"] = state ? state.minLower : undefined;
resourceInputs["minNumeric"] = state ? state.minNumeric : undefined;
resourceInputs["minSpecial"] = state ? state.minSpecial : undefined;
resourceInputs["minUpper"] = state ? state.minUpper : undefined;
resourceInputs["number"] = state ? state.number : undefined;
resourceInputs["numeric"] = state ? state.numeric : undefined;
resourceInputs["overrideSpecial"] = state ? state.overrideSpecial : undefined;
resourceInputs["result"] = state ? state.result : undefined;
resourceInputs["special"] = state ? state.special : undefined;
resourceInputs["upper"] = state ? state.upper : undefined;
}
else {
const args = argsOrState;
if ((!args || args.length === undefined) && !opts.urn) {
throw new Error("Missing required property 'length'");
}
resourceInputs["keepers"] = args ? args.keepers : undefined;
resourceInputs["length"] = args ? args.length : undefined;
resourceInputs["lower"] = args ? args.lower : undefined;
resourceInputs["minLower"] = args ? args.minLower : undefined;
resourceInputs["minNumeric"] = args ? args.minNumeric : undefined;
resourceInputs["minSpecial"] = args ? args.minSpecial : undefined;
resourceInputs["minUpper"] = args ? args.minUpper : undefined;
resourceInputs["number"] = args ? args.number : undefined;
resourceInputs["numeric"] = args ? args.numeric : undefined;
resourceInputs["overrideSpecial"] = args ? args.overrideSpecial : undefined;
resourceInputs["special"] = args ? args.special : undefined;
resourceInputs["upper"] = args ? args.upper : undefined;
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