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

com.pulumi.googlenative.apikeys.v2.kotlin.Key.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.

The newest version!
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.googlenative.apikeys.v2.kotlin

import com.pulumi.core.Output
import com.pulumi.googlenative.apikeys.v2.kotlin.outputs.V2RestrictionsResponse
import com.pulumi.googlenative.apikeys.v2.kotlin.outputs.V2RestrictionsResponse.Companion.toKotlin
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.Map

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

    public var args: KeyArgs = KeyArgs()

    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 KeyArgsBuilder.() -> Unit) {
        val builder = KeyArgsBuilder()
        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(): Key {
        val builtJavaResource = com.pulumi.googlenative.apikeys.v2.Key(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Key(builtJavaResource)
    }
}

/**
 * Creates a new API key. NOTE: Key is a global resource; hence the only supported value for location is `global`.
 * Auto-naming is currently not supported for this resource.
 */
public class Key internal constructor(
    override val javaResource: com.pulumi.googlenative.apikeys.v2.Key,
) : KotlinCustomResource(javaResource, KeyMapper) {
    /**
     * Annotations is an unstructured key-value map stored with a policy that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects.
     */
    public val annotations: Output>
        get() = javaResource.annotations().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * A timestamp identifying the time this key was originally created.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * A timestamp when this key was deleted. If the resource is not deleted, this must be empty.
     */
    public val deleteTime: Output
        get() = javaResource.deleteTime().applyValue({ args0 -> args0 })

    /**
     * Human-readable display name of this key that you can modify. The maximum length is 63 characters.
     */
    public val displayName: Output
        get() = javaResource.displayName().applyValue({ args0 -> args0 })

    /**
     * A checksum computed by the server based on the current value of the Key resource. This may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding. See https://google.aip.dev/154.
     */
    public val etag: Output
        get() = javaResource.etag().applyValue({ args0 -> args0 })

    /**
     * User specified key id (optional). If specified, it will become the final component of the key resource name. The id must be unique within the project, must conform with RFC-1034, is restricted to lower-cased letters, and has a maximum length of 63 characters. In another word, the id must match the regular expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. The id must NOT be a UUID-like string.
     */
    public val keyId: Output?
        get() = javaResource.keyId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * An encrypted and signed value held by this key. This field can be accessed only through the `GetKeyString` method.
     */
    public val keyString: Output
        get() = javaResource.keyString().applyValue({ args0 -> args0 })

    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The resource name of the key. The `name` has the form: `projects//locations/global/keys/`. For example: `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2` NOTE: Key is a global resource; hence the only supported value for location is `global`.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * Key restrictions.
     */
    public val restrictions: Output
        get() = javaResource.restrictions().applyValue({ args0 -> args0.let({ args0 -> toKotlin(args0) }) })

    /**
     * Unique id in UUID4 format.
     */
    public val uid: Output
        get() = javaResource.uid().applyValue({ args0 -> args0 })

    /**
     * A timestamp identifying the time this key was last updated.
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })
}

public object KeyMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.googlenative.apikeys.v2.Key::class == javaResource::class

    override fun map(javaResource: Resource): Key = Key(
        javaResource as
            com.pulumi.googlenative.apikeys.v2.Key,
    )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy