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

com.pulumi.awsnative.location.kotlin.ApiKey.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.awsnative.location.kotlin

import com.pulumi.awsnative.kotlin.outputs.Tag
import com.pulumi.awsnative.location.kotlin.outputs.ApiKeyRestrictions
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.awsnative.kotlin.outputs.Tag.Companion.toKotlin as tagToKotlin
import com.pulumi.awsnative.location.kotlin.outputs.ApiKeyRestrictions.Companion.toKotlin as apiKeyRestrictionsToKotlin

/**
 * Builder for [ApiKey].
 */
@PulumiTagMarker
public class ApiKeyResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: ApiKeyArgs = ApiKeyArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend ApiKeyArgsBuilder.() -> Unit) {
        val builder = ApiKeyArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): ApiKey {
        val builtJavaResource = com.pulumi.awsnative.location.ApiKey(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return ApiKey(builtJavaResource)
    }
}

/**
 * Definition of AWS::Location::APIKey Resource Type
 */
public class ApiKey internal constructor(
    override val javaResource: com.pulumi.awsnative.location.ApiKey,
) : KotlinCustomResource(javaResource, ApiKeyMapper) {
    /**
     * The Amazon Resource Name (ARN) for the resource. Used when you need to specify a resource across all AWS .
     */
    public val arn: Output
        get() = javaResource.arn().applyValue({ args0 -> args0 })

    /**
     * The timestamp for when the API key resource was created in ISO 8601 format: YYYY-MM-DDThh:mm:ss.sssZ.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * Updates the description for the API key resource.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The optional timestamp for when the API key resource will expire in [ISO 8601 format](https://docs.aws.amazon.com/https://www.iso.org/iso-8601-date-and-time-format.html) .
     */
    public val expireTime: Output?
        get() = javaResource.expireTime().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * ForceDelete bypasses an API key's expiry conditions and deletes the key. Set the parameter `true` to delete the key or to `false` to not preemptively delete the API key.
     * Valid values: `true` , or `false` .
     * > This action is irreversible. Only use ForceDelete if you are certain the key is no longer in use.
     */
    public val forceDelete: Output?
        get() = javaResource.forceDelete().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The boolean flag to be included for updating `ExpireTime` or Restrictions details.
     * Must be set to `true` to update an API key resource that has been used in the past 7 days. `False` if force update is not preferred.
     */
    public val forceUpdate: Output?
        get() = javaResource.forceUpdate().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The Amazon Resource Name (ARN) for the API key resource. Used when you need to specify a resource across all AWS .
     */
    public val keyArn: Output
        get() = javaResource.keyArn().applyValue({ args0 -> args0 })

    /**
     * A custom name for the API key resource.
     * Requirements:
     * - Contain only alphanumeric characters (A–Z, a–z, 0–9), hyphens (-), periods (.), and underscores (_).
     * - Must be a unique API key name.
     * - No spaces allowed. For example, `ExampleAPIKey` .
     */
    public val keyName: Output
        get() = javaResource.keyName().applyValue({ args0 -> args0 })

    /**
     * Whether the API key should expire. Set to `true` to set the API key to have no expiration time.
     */
    public val noExpiry: Output?
        get() = javaResource.noExpiry().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The API key restrictions for the API key resource.
     */
    public val restrictions: Output
        get() = javaResource.restrictions().applyValue({ args0 ->
            args0.let({ args0 ->
                apiKeyRestrictionsToKotlin(args0)
            })
        })

    /**
     * An array of key-value pairs to apply to this resource.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> tagToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * The timestamp for when the API key resource was last updated in ISO 8601 format: `YYYY-MM-DDThh:mm:ss.sssZ` .
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })
}

public object ApiKeyMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.location.ApiKey::class == javaResource::class

    override fun map(javaResource: Resource): ApiKey = ApiKey(
        javaResource as
            com.pulumi.awsnative.location.ApiKey,
    )
}

/**
 * @see [ApiKey].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [ApiKey].
 */
public suspend fun apiKey(name: String, block: suspend ApiKeyResourceBuilder.() -> Unit): ApiKey {
    val builder = ApiKeyResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [ApiKey].
 * @param name The _unique_ name of the resulting resource.
 */
public fun apiKey(name: String): ApiKey {
    val builder = ApiKeyResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy