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

com.pulumi.random.kotlin.RandomPasswordArgs.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.18.0.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.RandomPasswordArgs.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

/**
 * Identical to random_string.
 * This resource *does* use a cryptographic random number generator.
 * ## Example Usage
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.random.RandomPassword;
 * import com.pulumi.random.RandomPasswordArgs;
 * import com.pulumi.aws.rds.Instance;
 * import com.pulumi.aws.rds.InstanceArgs;
 * 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 password = new RandomPassword("password", RandomPasswordArgs.builder()
 *             .length(16)
 *             .special(true)
 *             .overrideSpecial("!#$%&*()-_=+[]{}<>:?")
 *             .build());
 *         var example = new Instance("example", InstanceArgs.builder()
 *             .instanceClass("db.t3.micro")
 *             .allocatedStorage(64)
 *             .engine("mysql")
 *             .username("someone")
 *             .password(password.result())
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * You can import external passwords into your Pulumi programs as follows:
 * ```sh
 *  $ import random:index/randomPassword:RandomPassword newPassword supersecret
 * ```
 * This command will encode the `supersecret` token in Pulumi state and generate a code suggestion to include a new RandomPassword resource in your Pulumi program. Include the suggested code and do a `pulumi up`. Your secret password is now securely stored in Pulumi, and you can reference it in your Pulumi program as `newPassword.result`.
 * @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 RandomPasswordArgs(
    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.RandomPasswordArgs =
        com.pulumi.random.RandomPasswordArgs.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 [RandomPasswordArgs].
 */
@PulumiTagMarker
public class RandomPasswordArgsBuilder 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("rupykfuqnchtipdl")
    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("yjcioocgdulhgeeo")
    public suspend fun length(`value`: Output) {
        this.length = value
    }

    /**
     * @param value Include lowercase alphabet characters in the result. Default value is `true`.
     */
    @JvmName("yklqlxkkrojdaxcy")
    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("tkmpfbrqilimwdxu")
    public suspend fun minLower(`value`: Output) {
        this.minLower = value
    }

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

    /**
     * @param value Minimum number of special characters in the result. Default value is `0`.
     */
    @JvmName("qenwnhynwppvwxyl")
    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("dlapoisipuuinbbx")
    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("sufwuslkqhgpwfoh")
    public suspend fun number(`value`: Output) {
        this.number = value
    }

    /**
     * @param value Include numeric characters in the result. Default value is `true`.
     */
    @JvmName("jyfqydevwkkifwvv")
    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("tnoousnwdlkbfmpu")
    public suspend fun overrideSpecial(`value`: Output) {
        this.overrideSpecial = value
    }

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

    /**
     * @param value Include uppercase alphabet characters in the result. Default value is `true`.
     */
    @JvmName("btjlpcqcooxgvpnh")
    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("mdpffihnkulagmdh")
    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("ttduxivvmbyntcni")
    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("mmabjsigdnodiphc")
    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("xebhbioqmadqmwdo")
    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("ktytcobvqcimdgdr")
    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("evcgkymwngsrkpqc")
    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("eppytnbbmwwtljvr")
    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("bikfnvynthpauacq")
    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("pamsahvbpodqcpyl")
    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("wiaexmxhcovpngna")
    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("anldryrygflcthgl")
    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("lcbmpguyyxpgkksp")
    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("udowoprosiqdvecp")
    public suspend fun upper(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.upper = mapped
    }

    internal fun build(): RandomPasswordArgs = RandomPasswordArgs(
        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 - 2025 Weber Informatics LLC | Privacy Policy