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

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

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

package com.pulumi.awsnative.apigateway.kotlin

import com.pulumi.awsnative.apigateway.kotlin.outputs.ApiKeyStageKey
import com.pulumi.awsnative.kotlin.outputs.Tag
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.apigateway.kotlin.outputs.ApiKeyStageKey.Companion.toKotlin as apiKeyStageKeyToKotlin
import com.pulumi.awsnative.kotlin.outputs.Tag.Companion.toKotlin as tagToKotlin

/**
 * 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.apigateway.ApiKey(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return ApiKey(builtJavaResource)
    }
}

/**
 * The ``AWS::ApiGateway::ApiKey`` resource creates a unique key that you can distribute to clients who are executing API Gateway ``Method`` resources that require an API key. To specify which API key clients must use, map the API key with the ``RestApi`` and ``Stage`` resources that include the methods that require a key.
 * ## Example Usage
 * ### Example
 * No Java example available.
 * ### Example
 * No Java example available.
 */
public class ApiKey internal constructor(
    override val javaResource: com.pulumi.awsnative.apigateway.ApiKey,
) : KotlinCustomResource(javaResource, ApiKeyMapper) {
    /**
     * The ID for the API key. For example: `abc123` .
     */
    public val apiKeyId: Output
        get() = javaResource.apiKeyId().applyValue({ args0 -> args0 })

    /**
     * An MKT customer identifier, when integrating with the AWS SaaS Marketplace.
     */
    public val customerId: Output?
        get() = javaResource.customerId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The description of the ApiKey.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies whether the ApiKey can be used by callers.
     */
    public val enabled: Output?
        get() = javaResource.enabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Specifies whether (``true``) or not (``false``) the key identifier is distinct from the created API key value. This parameter is deprecated and should not be used.
     */
    public val generateDistinctId: Output?
        get() = javaResource.generateDistinctId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A name for the API key. If you don't specify a name, CFN generates a unique physical ID and uses that ID for the API key name. For more information, see [Name Type](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-name.html).
     *  If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.
     */
    public val name: Output?
        get() = javaResource.name().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * DEPRECATED FOR USAGE PLANS - Specifies stages associated with the API key.
     */
    public val stageKeys: Output>?
        get() = javaResource.stageKeys().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> apiKeyStageKeyToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * The key-value map of strings. The valid character set is [a-zA-Z+-=._:/]. The tag key can be up to 128 characters and must not start with ``aws:``. The tag value can be up to 256 characters.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> tagToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * Specifies a value of the API key.
     */
    public val `value`: Output?
        get() = javaResource.`value`().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

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

    override fun map(javaResource: Resource): ApiKey = ApiKey(
        javaResource as
            com.pulumi.awsnative.apigateway.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