UNPKG

@pulumi/random

Version:

A Pulumi package to safely use randomness in Pulumi programs.

85 lines 3.27 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.RandomUuid7 = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * The resource `random.RandomUuid7` generates a random version 7 uuid string that is intended to be used as a unique identifier for other resources. * * This resource uses [google/uuid](https://github.com/google/uuid) to generate a valid V7 UUID for use with services needing a unique string identifier. * * ## 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.RandomUuid7("test", {}); * const testResourceGroup = new azurerm.index.ResourceGroup("test", { * name: `${test.result}-rg`, * location: "Central US", * }); * ``` * * ## Import * * The `pulumi import` command can be used, for example: * * 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/randomUuid7:RandomUuid7 main 0197ad85-fe6e-7e92-a2f5-7550daa83030 * ``` */ class RandomUuid7 extends pulumi.CustomResource { /** * Get an existing RandomUuid7 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 RandomUuid7(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of RandomUuid7. 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'] === RandomUuid7.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["keepers"] = state?.keepers; resourceInputs["result"] = state?.result; } else { const args = argsOrState; resourceInputs["keepers"] = args?.keepers; resourceInputs["result"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(RandomUuid7.__pulumiType, name, resourceInputs, opts); } } exports.RandomUuid7 = RandomUuid7; /** @internal */ RandomUuid7.__pulumiType = 'random:index/randomUuid7:RandomUuid7'; //# sourceMappingURL=randomUuid7.js.map