@pulumi/random
Version:
A Pulumi package to safely use randomness in Pulumi programs.
100 lines • 4.91 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.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, Object.assign(Object.assign({}, 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 ? 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["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