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

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

@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.RandomBytesArgs.builder
import kotlin.Int
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * The resource `random.RandomBytes` generates random bytes that are intended to be used as a secret, or key. Use this in preference to `random.RandomId` when the output is considered sensitive, and should not be displayed in the CLI.
 * ## Example Usage
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.random.RandomBytes;
 * import com.pulumi.random.RandomBytesArgs;
 * import com.pulumi.azure.keyvault.Secret;
 * import com.pulumi.azure.keyvault.SecretArgs;
 * 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 jwtSecretRandomBytes = new RandomBytes("jwtSecretRandomBytes", RandomBytesArgs.builder()
 *             .length(64)
 *             .build());
 *         var jwtSecretSecret = new Secret("jwtSecretSecret", SecretArgs.builder()
 *             .keyVaultId("some-azure-key-vault-id")
 *             .value(jwtSecretRandomBytes.base64())
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * Random bytes can be imported by specifying the value as base64 string.
 * ```sh
 *  $ pulumi import random:index/randomBytes:RandomBytes basic "8/fu3q+2DcgSJ19i0jZ5Cw=="
 * ```
 * @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 number of bytes requested. The minimum value for length is 1.
 */
public data class RandomBytesArgs(
    public val keepers: Output>? = null,
    public val length: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.random.RandomBytesArgs =
        com.pulumi.random.RandomBytesArgs.builder()
            .keepers(keepers?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .length(length?.applyValue({ args0 -> args0 })).build()
}

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

    private var length: 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("utofdldbxnqogatl")
    public suspend fun keepers(`value`: Output>) {
        this.keepers = value
    }

    /**
     * @param value The number of bytes requested. The minimum value for length is 1.
     */
    @JvmName("lqmrasdvaiomxxau")
    public suspend fun length(`value`: Output) {
        this.length = value
    }

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

    /**
     * @param value The number of bytes requested. The minimum value for length is 1.
     */
    @JvmName("qbbtrumonpbrokus")
    public suspend fun length(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.length = mapped
    }

    internal fun build(): RandomBytesArgs = RandomBytesArgs(
        keepers = keepers,
        length = length,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy