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

com.pulumi.random.kotlin.RandomIntegerArgs.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.RandomIntegerArgs.builder
import kotlin.Int
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * The resource `random.RandomInteger` generates random values from a given range, described by the `min` and `max` attributes of a given resource.
 * This resource can be used in conjunction with resources that have the `create_before_destroy` lifecycle flag set, to avoid conflicts with unique names during the brief period where both the old and new resources exist concurrently.
 * ## Example Usage
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.random.RandomInteger;
 * import com.pulumi.random.RandomIntegerArgs;
 * import com.pulumi.aws.alb.ListenerRule;
 * import com.pulumi.aws.alb.ListenerRuleArgs;
 * import com.pulumi.aws.alb.inputs.ListenerRuleActionArgs;
 * 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 priority = new RandomInteger("priority", RandomIntegerArgs.builder()
 *             .min(1)
 *             .max(50000)
 *             .keepers(Map.of("listener_arn", var_.listener_arn()))
 *             .build());
 *         var main = new ListenerRule("main", ListenerRuleArgs.builder()
 *             .listenerArn(priority.keepers().applyValue(keepers -> keepers.listenerArn()))
 *             .priority(priority.result())
 *             .actions(ListenerRuleActionArgs.builder()
 *                 .type("forward")
 *                 .targetGroupArn(var_.target_group_arn())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * Random integers can be imported using the result, min, and max, with an optional seed. This can be used to replace a config value with a value interpolated from the random provider without experiencing diffs. Example (values are separated by a ,)
 * ```sh
 *  $ pulumi import random:index/randomInteger:RandomInteger priority 15390,1,50000
 * ```
 * @property keepers Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
 * @property max The maximum inclusive value of the range.
 * @property min The minimum inclusive value of the range.
 * @property seed A custom seed to always produce the same value.
 */
public data class RandomIntegerArgs(
    public val keepers: Output>? = null,
    public val max: Output? = null,
    public val min: Output? = null,
    public val seed: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.random.RandomIntegerArgs =
        com.pulumi.random.RandomIntegerArgs.builder()
            .keepers(keepers?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .max(max?.applyValue({ args0 -> args0 }))
            .min(min?.applyValue({ args0 -> args0 }))
            .seed(seed?.applyValue({ args0 -> args0 })).build()
}

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

    private var max: Output? = null

    private var min: Output? = null

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

    /**
     * @param value The maximum inclusive value of the range.
     */
    @JvmName("rxaabjwvecgybpfg")
    public suspend fun max(`value`: Output) {
        this.max = value
    }

    /**
     * @param value The minimum inclusive value of the range.
     */
    @JvmName("ocpwcgsdxpqhwggp")
    public suspend fun min(`value`: Output) {
        this.min = value
    }

    /**
     * @param value A custom seed to always produce the same value.
     */
    @JvmName("xmcyqorbcjaswbwd")
    public suspend fun seed(`value`: Output) {
        this.seed = value
    }

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

    /**
     * @param value The maximum inclusive value of the range.
     */
    @JvmName("nsfunwntgnmthyjy")
    public suspend fun max(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.max = mapped
    }

    /**
     * @param value The minimum inclusive value of the range.
     */
    @JvmName("qaltdksepajufeep")
    public suspend fun min(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.min = mapped
    }

    /**
     * @param value A custom seed to always produce the same value.
     */
    @JvmName("iavreqfuxcaenron")
    public suspend fun seed(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.seed = mapped
    }

    internal fun build(): RandomIntegerArgs = RandomIntegerArgs(
        keepers = keepers,
        max = max,
        min = min,
        seed = seed,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy