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

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

/**
 * The resource `random.RandomPet` generates random pet names that are intended to be used as unique identifiers for other resources.
 * 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.RandomPet;
 * import com.pulumi.random.RandomPetArgs;
 * import com.pulumi.aws.ec2.Instance;
 * import com.pulumi.aws.ec2.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 serverRandomPet = new RandomPet("serverRandomPet", RandomPetArgs.builder()
 *             .keepers(Map.of("ami_id", var_.ami_id()))
 *             .build());
 *         var serverInstance = new Instance("serverInstance", InstanceArgs.builder()
 *             .tags(Map.of("Name", serverRandomPet.id().applyValue(id -> String.format("web-server-%s", id))))
 *             .ami(serverRandomPet.keepers().applyValue(keepers -> keepers.amiId()))
 *             .build());
 *     }
 * }
 * ```
 * @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 (in words) of the pet name. Defaults to 2
 * @property prefix A string to prefix the name with.
 * @property separator The character to separate words in the pet name. Defaults to "-"
 */
public data class RandomPetArgs(
    public val keepers: Output>? = null,
    public val length: Output? = null,
    public val prefix: Output? = null,
    public val separator: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.random.RandomPetArgs = com.pulumi.random.RandomPetArgs.builder()
        .keepers(keepers?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
        .length(length?.applyValue({ args0 -> args0 }))
        .prefix(prefix?.applyValue({ args0 -> args0 }))
        .separator(separator?.applyValue({ args0 -> args0 })).build()
}

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

    private var length: Output? = null

    private var prefix: Output? = null

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

    /**
     * @param value The length (in words) of the pet name. Defaults to 2
     */
    @JvmName("unbtfywtsiogdwfq")
    public suspend fun length(`value`: Output) {
        this.length = value
    }

    /**
     * @param value A string to prefix the name with.
     */
    @JvmName("kmovrrytlkntrfjx")
    public suspend fun prefix(`value`: Output) {
        this.prefix = value
    }

    /**
     * @param value The character to separate words in the pet name. Defaults to "-"
     */
    @JvmName("myuajbyhyxkgavgc")
    public suspend fun separator(`value`: Output) {
        this.separator = value
    }

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

    /**
     * @param value The length (in words) of the pet name. Defaults to 2
     */
    @JvmName("ohuqnejmijnjqpfn")
    public suspend fun length(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.length = mapped
    }

    /**
     * @param value A string to prefix the name with.
     */
    @JvmName("yvndlfmcsvxtywyp")
    public suspend fun prefix(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.prefix = mapped
    }

    /**
     * @param value The character to separate words in the pet name. Defaults to "-"
     */
    @JvmName("sldvccspxqamutsp")
    public suspend fun separator(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.separator = mapped
    }

    internal fun build(): RandomPetArgs = RandomPetArgs(
        keepers = keepers,
        length = length,
        prefix = prefix,
        separator = separator,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy