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

com.pulumi.awsnative.ec2.kotlin.KeyPairArgs.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: 1.11.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.awsnative.ec2.kotlin

import com.pulumi.awsnative.ec2.KeyPairArgs.builder
import com.pulumi.awsnative.ec2.kotlin.enums.KeyPairKeyFormat
import com.pulumi.awsnative.ec2.kotlin.enums.KeyPairKeyType
import com.pulumi.awsnative.kotlin.inputs.CreateOnlyTagArgs
import com.pulumi.awsnative.kotlin.inputs.CreateOnlyTagArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Specifies a key pair for use with an EC2long instance as follows:
 *   +  To import an existing key pair, include the ``PublicKeyMaterial`` property.
 *   +  To create a new key pair, omit the ``PublicKeyMaterial`` property.
 *  When you import an existing key pair, you specify the public key material for the key. We assume that you have the private key material for the key. CFNlong does not create or return the private key material when you import a key pair.
 *  When you create a new key pair, the private key is saved to SYSlong Parameter Store, using a parameter with the following name: ``/ec2/keypair/{key_pair_id}``. For more information about retrieving private key, and the required permissions, see [Create a key pair using](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-key-pairs.html#create-key-pair-cloudformation) in the *User Guide*.
 *  When CFN deletes a key pair that was created or imported by a stack, it also deletes the parameter that was used to store the private key material in Parameter Store.
 * ## Example Usage
 * ### Example
 * No Java example available.
 * ### Example
 * No Java example available.
 * ### Example
 * No Java example available.
 * ### Example
 * No Java example available.
 * @property keyFormat The format of the key pair.
 *  Default: ``pem``
 * @property keyName A unique name for the key pair.
 *  Constraints: Up to 255 ASCII characters
 * @property keyType The type of key pair. Note that ED25519 keys are not supported for Windows instances.
 *  If the ``PublicKeyMaterial`` property is specified, the ``KeyType`` property is ignored, and the key type is inferred from the ``PublicKeyMaterial`` value.
 *  Default: ``rsa``
 * @property publicKeyMaterial The public key material. The ``PublicKeyMaterial`` property is used to import a key pair. If this property is not specified, then a new key pair will be created.
 * @property tags The tags to apply to the key pair.
 */
public data class KeyPairArgs(
    public val keyFormat: Output? = null,
    public val keyName: Output? = null,
    public val keyType: Output? = null,
    public val publicKeyMaterial: Output? = null,
    public val tags: Output>? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.awsnative.ec2.KeyPairArgs =
        com.pulumi.awsnative.ec2.KeyPairArgs.builder()
            .keyFormat(keyFormat?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .keyName(keyName?.applyValue({ args0 -> args0 }))
            .keyType(keyType?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .publicKeyMaterial(publicKeyMaterial?.applyValue({ args0 -> args0 }))
            .tags(
                tags?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            ).build()
}

/**
 * Builder for [KeyPairArgs].
 */
@PulumiTagMarker
public class KeyPairArgsBuilder internal constructor() {
    private var keyFormat: Output? = null

    private var keyName: Output? = null

    private var keyType: Output? = null

    private var publicKeyMaterial: Output? = null

    private var tags: Output>? = null

    /**
     * @param value The format of the key pair.
     *  Default: ``pem``
     */
    @JvmName("vjkmpkwrshqmbtmb")
    public suspend fun keyFormat(`value`: Output) {
        this.keyFormat = value
    }

    /**
     * @param value A unique name for the key pair.
     *  Constraints: Up to 255 ASCII characters
     */
    @JvmName("efpsnonwpneehpoj")
    public suspend fun keyName(`value`: Output) {
        this.keyName = value
    }

    /**
     * @param value The type of key pair. Note that ED25519 keys are not supported for Windows instances.
     *  If the ``PublicKeyMaterial`` property is specified, the ``KeyType`` property is ignored, and the key type is inferred from the ``PublicKeyMaterial`` value.
     *  Default: ``rsa``
     */
    @JvmName("gtkcsvjxcbrdlfef")
    public suspend fun keyType(`value`: Output) {
        this.keyType = value
    }

    /**
     * @param value The public key material. The ``PublicKeyMaterial`` property is used to import a key pair. If this property is not specified, then a new key pair will be created.
     */
    @JvmName("yuhptwcqyudbgfke")
    public suspend fun publicKeyMaterial(`value`: Output) {
        this.publicKeyMaterial = value
    }

    /**
     * @param value The tags to apply to the key pair.
     */
    @JvmName("mcnvmjobdpxccmpg")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    @JvmName("wymeesyuluidlcyb")
    public suspend fun tags(vararg values: Output) {
        this.tags = Output.all(values.asList())
    }

    /**
     * @param values The tags to apply to the key pair.
     */
    @JvmName("raolwuefqxtaxgkp")
    public suspend fun tags(values: List>) {
        this.tags = Output.all(values)
    }

    /**
     * @param value The format of the key pair.
     *  Default: ``pem``
     */
    @JvmName("nqcyuagnjwjqvxlf")
    public suspend fun keyFormat(`value`: KeyPairKeyFormat?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.keyFormat = mapped
    }

    /**
     * @param value A unique name for the key pair.
     *  Constraints: Up to 255 ASCII characters
     */
    @JvmName("pkikbkgrcsqqubvt")
    public suspend fun keyName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.keyName = mapped
    }

    /**
     * @param value The type of key pair. Note that ED25519 keys are not supported for Windows instances.
     *  If the ``PublicKeyMaterial`` property is specified, the ``KeyType`` property is ignored, and the key type is inferred from the ``PublicKeyMaterial`` value.
     *  Default: ``rsa``
     */
    @JvmName("peogissatchmevcr")
    public suspend fun keyType(`value`: KeyPairKeyType?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.keyType = mapped
    }

    /**
     * @param value The public key material. The ``PublicKeyMaterial`` property is used to import a key pair. If this property is not specified, then a new key pair will be created.
     */
    @JvmName("lthytcojjrowttjk")
    public suspend fun publicKeyMaterial(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.publicKeyMaterial = mapped
    }

    /**
     * @param value The tags to apply to the key pair.
     */
    @JvmName("orxjvlbsdxffxqir")
    public suspend fun tags(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param argument The tags to apply to the key pair.
     */
    @JvmName("etvpyvgauokljqmf")
    public suspend fun tags(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            CreateOnlyTagArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.tags = mapped
    }

    /**
     * @param argument The tags to apply to the key pair.
     */
    @JvmName("wdwkoqpfvxrarnjf")
    public suspend fun tags(vararg argument: suspend CreateOnlyTagArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            CreateOnlyTagArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.tags = mapped
    }

    /**
     * @param argument The tags to apply to the key pair.
     */
    @JvmName("urotfsornunxjddl")
    public suspend fun tags(argument: suspend CreateOnlyTagArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(CreateOnlyTagArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.tags = mapped
    }

    /**
     * @param values The tags to apply to the key pair.
     */
    @JvmName("hudgtgsyfdvcehht")
    public suspend fun tags(vararg values: CreateOnlyTagArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    internal fun build(): KeyPairArgs = KeyPairArgs(
        keyFormat = keyFormat,
        keyName = keyName,
        keyType = keyType,
        publicKeyMaterial = publicKeyMaterial,
        tags = tags,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy