UNPKG

@pulumi/random

Version:

A Pulumi package to safely use randomness in Pulumi programs.

79 lines 2.97 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.RandomUuid = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azurerm from "@pulumi/azurerm"; * import * as random from "@pulumi/random"; * * // The following example shows how to generate a unique name for an Azure Resource Group. * const test = new random.RandomUuid("test", {}); * const testResourceGroup = new azurerm.index.ResourceGroup("test", { * name: `${test.result}-rg`, * location: "Central US", * }); * ``` * * ## Import * * Random UUID's can be imported. This can be used to replace a config * * value with a value interpolated from the random provider without * * experiencing diffs. * * ```sh * $ pulumi import random:index/randomUuid:RandomUuid main aabbccdd-eeff-0011-2233-445566778899 * ``` */ class RandomUuid extends pulumi.CustomResource { /** * Get an existing RandomUuid 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 RandomUuid(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of RandomUuid. 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'] === RandomUuid.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["keepers"] = state ? state.keepers : undefined; resourceInputs["result"] = state ? state.result : undefined; } else { const args = argsOrState; resourceInputs["keepers"] = args ? args.keepers : undefined; resourceInputs["result"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(RandomUuid.__pulumiType, name, resourceInputs, opts); } } exports.RandomUuid = RandomUuid; /** @internal */ RandomUuid.__pulumiType = 'random:index/randomUuid:RandomUuid'; //# sourceMappingURL=randomUuid.js.map