All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.random.kotlin.RandomStringArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 4.16.6.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.random.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.random.RandomStringArgs.builder
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.Int
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * 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
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.random.RandomString;
 * import com.pulumi.random.RandomStringArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var random = new RandomString("random", RandomStringArgs.builder()
 *             .length(16)
 *             .overrideSpecial("/@£$")
 *             .special(true)
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * You can import external strings into your Pulumi programs as RandomString resources as follows:
 * ```sh
 *  $ import random:index/randomString:RandomString newString myspecialdata
 * ```
 * This command will encode the `myspecialdata` token in Pulumi state and generate a code suggestion to include a new RandomString resource in your Pulumi program. Include the suggested code and do a `pulumi up`. Your data is now stored in Pulumi, and you can reference it in your Pulumi program as `newString.result`.
 * If the data needs to be stored securily as a secret, consider using the RandomPassword resource instead.
 * @property keepers Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
 * @property length The length of the string desired. The minimum value for length is 1 and, length must also be >= (`min_upper` + `min_lower` + `min_numeric` + `min_special`).
 * @property lower Include lowercase alphabet characters in the result. Default value is `true`.
 * @property minLower Minimum number of lowercase alphabet characters in the result. Default value is `0`.
 * @property minNumeric Minimum number of numeric characters in the result. Default value is `0`.
 * @property minSpecial Minimum number of special characters in the result. Default value is `0`.
 * @property minUpper Minimum number of uppercase alphabet characters in the result. Default value is `0`.
 * @property number Include numeric characters in the result. Default value is `true`. **NOTE**: This is deprecated, use `numeric` instead.
 * @property numeric Include numeric characters in the result. Default value is `true`.
 * @property overrideSpecial Supply your own list of special characters to use for string generation.  This overrides the default character list in the special argument.  The `special` argument must still be set to true for any overwritten characters to be used in generation.
 * @property special Include special characters in the result. These are `!@#$%&*()-_=+[]{}<>:?`. Default value is `true`.
 * @property upper Include uppercase alphabet characters in the result. Default value is `true`.
 */
public data class RandomStringArgs(
    public val keepers: Output>? = null,
    public val length: Output? = null,
    public val lower: Output? = null,
    public val minLower: Output? = null,
    public val minNumeric: Output? = null,
    public val minSpecial: Output? = null,
    public val minUpper: Output? = null,
    @Deprecated(
        message = """
  **NOTE**: This is deprecated, use `numeric` instead.
  """,
    )
    public val number: Output? = null,
    public val numeric: Output? = null,
    public val overrideSpecial: Output? = null,
    public val special: Output? = null,
    public val upper: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.random.RandomStringArgs =
        com.pulumi.random.RandomStringArgs.builder()
            .keepers(keepers?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .length(length?.applyValue({ args0 -> args0 }))
            .lower(lower?.applyValue({ args0 -> args0 }))
            .minLower(minLower?.applyValue({ args0 -> args0 }))
            .minNumeric(minNumeric?.applyValue({ args0 -> args0 }))
            .minSpecial(minSpecial?.applyValue({ args0 -> args0 }))
            .minUpper(minUpper?.applyValue({ args0 -> args0 }))
            .number(number?.applyValue({ args0 -> args0 }))
            .numeric(numeric?.applyValue({ args0 -> args0 }))
            .overrideSpecial(overrideSpecial?.applyValue({ args0 -> args0 }))
            .special(special?.applyValue({ args0 -> args0 }))
            .upper(upper?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [RandomStringArgs].
 */
@PulumiTagMarker
public class RandomStringArgsBuilder internal constructor() {
    private var keepers: Output>? = null

    private var length: Output? = null

    private var lower: Output? = null

    private var minLower: Output? = null

    private var minNumeric: Output? = null

    private var minSpecial: Output? = null

    private var minUpper: Output? = null

    private var number: Output? = null

    private var numeric: Output? = null

    private var overrideSpecial: Output? = null

    private var special: Output? = null

    private var upper: Output? = null

    /**
     * @param value Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
     */
    @JvmName("bvgomafpewjiqwsh")
    public suspend fun keepers(`value`: Output>) {
        this.keepers = value
    }

    /**
     * @param value The length of the string desired. The minimum value for length is 1 and, length must also be >= (`min_upper` + `min_lower` + `min_numeric` + `min_special`).
     */
    @JvmName("yhdmybxwbchlbajk")
    public suspend fun length(`value`: Output) {
        this.length = value
    }

    /**
     * @param value Include lowercase alphabet characters in the result. Default value is `true`.
     */
    @JvmName("ukijjljpgsaddnlp")
    public suspend fun lower(`value`: Output) {
        this.lower = value
    }

    /**
     * @param value Minimum number of lowercase alphabet characters in the result. Default value is `0`.
     */
    @JvmName("piolrbskhjuarwme")
    public suspend fun minLower(`value`: Output) {
        this.minLower = value
    }

    /**
     * @param value Minimum number of numeric characters in the result. Default value is `0`.
     */
    @JvmName("uajprwnxnjentvdg")
    public suspend fun minNumeric(`value`: Output) {
        this.minNumeric = value
    }

    /**
     * @param value Minimum number of special characters in the result. Default value is `0`.
     */
    @JvmName("twxbbeslhwpneevv")
    public suspend fun minSpecial(`value`: Output) {
        this.minSpecial = value
    }

    /**
     * @param value Minimum number of uppercase alphabet characters in the result. Default value is `0`.
     */
    @JvmName("kjsaeakrhmmnhicm")
    public suspend fun minUpper(`value`: Output) {
        this.minUpper = value
    }

    /**
     * @param value Include numeric characters in the result. Default value is `true`. **NOTE**: This is deprecated, use `numeric` instead.
     */
    @Deprecated(
        message = """
  **NOTE**: This is deprecated, use `numeric` instead.
  """,
    )
    @JvmName("qnsxxddhscvfcfng")
    public suspend fun number(`value`: Output) {
        this.number = value
    }

    /**
     * @param value Include numeric characters in the result. Default value is `true`.
     */
    @JvmName("itkmqhyktctuhmhc")
    public suspend fun numeric(`value`: Output) {
        this.numeric = value
    }

    /**
     * @param value Supply your own list of special characters to use for string generation.  This overrides the default character list in the special argument.  The `special` argument must still be set to true for any overwritten characters to be used in generation.
     */
    @JvmName("oquskilykhftluys")
    public suspend fun overrideSpecial(`value`: Output) {
        this.overrideSpecial = value
    }

    /**
     * @param value Include special characters in the result. These are `!@#$%&*()-_=+[]{}<>:?`. Default value is `true`.
     */
    @JvmName("mnqnxwtxfxrsonwq")
    public suspend fun special(`value`: Output) {
        this.special = value
    }

    /**
     * @param value Include uppercase alphabet characters in the result. Default value is `true`.
     */
    @JvmName("fhwqkxefnphnexyb")
    public suspend fun upper(`value`: Output) {
        this.upper = value
    }

    /**
     * @param value Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
     */
    @JvmName("ytivtlxidmhobbth")
    public suspend fun keepers(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.keepers = mapped
    }

    /**
     * @param values Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
     */
    @JvmName("jwlhhdduklnphgrb")
    public fun keepers(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.keepers = mapped
    }

    /**
     * @param value The length of the string desired. The minimum value for length is 1 and, length must also be >= (`min_upper` + `min_lower` + `min_numeric` + `min_special`).
     */
    @JvmName("lhrbhplmlhxvcxfe")
    public suspend fun length(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.length = mapped
    }

    /**
     * @param value Include lowercase alphabet characters in the result. Default value is `true`.
     */
    @JvmName("fhyvligfnhafhash")
    public suspend fun lower(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.lower = mapped
    }

    /**
     * @param value Minimum number of lowercase alphabet characters in the result. Default value is `0`.
     */
    @JvmName("skgucpfthylthqic")
    public suspend fun minLower(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.minLower = mapped
    }

    /**
     * @param value Minimum number of numeric characters in the result. Default value is `0`.
     */
    @JvmName("yqxaptgrjwaktcbp")
    public suspend fun minNumeric(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.minNumeric = mapped
    }

    /**
     * @param value Minimum number of special characters in the result. Default value is `0`.
     */
    @JvmName("casehybgvmbnbdlr")
    public suspend fun minSpecial(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.minSpecial = mapped
    }

    /**
     * @param value Minimum number of uppercase alphabet characters in the result. Default value is `0`.
     */
    @JvmName("eydedpmgkdcthqdi")
    public suspend fun minUpper(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.minUpper = mapped
    }

    /**
     * @param value Include numeric characters in the result. Default value is `true`. **NOTE**: This is deprecated, use `numeric` instead.
     */
    @Deprecated(
        message = """
  **NOTE**: This is deprecated, use `numeric` instead.
  """,
    )
    @JvmName("xkyjputrqniisvwe")
    public suspend fun number(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.number = mapped
    }

    /**
     * @param value Include numeric characters in the result. Default value is `true`.
     */
    @JvmName("jkiwyuqvrylpdckk")
    public suspend fun numeric(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.numeric = mapped
    }

    /**
     * @param value Supply your own list of special characters to use for string generation.  This overrides the default character list in the special argument.  The `special` argument must still be set to true for any overwritten characters to be used in generation.
     */
    @JvmName("wwfviutaxqpiwjyg")
    public suspend fun overrideSpecial(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.overrideSpecial = mapped
    }

    /**
     * @param value Include special characters in the result. These are `!@#$%&*()-_=+[]{}<>:?`. Default value is `true`.
     */
    @JvmName("aicqkaucwqxxobyt")
    public suspend fun special(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.special = mapped
    }

    /**
     * @param value Include uppercase alphabet characters in the result. Default value is `true`.
     */
    @JvmName("gsyikwshxnnwmkxm")
    public suspend fun upper(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.upper = mapped
    }

    internal fun build(): RandomStringArgs = RandomStringArgs(
        keepers = keepers,
        length = length,
        lower = lower,
        minLower = minLower,
        minNumeric = minNumeric,
        minSpecial = minSpecial,
        minUpper = minUpper,
        number = number,
        numeric = numeric,
        overrideSpecial = overrideSpecial,
        special = special,
        upper = upper,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy