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

com.pulumi.gcp.kms.kotlin.KeyRingImportJob.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: 8.10.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.kms.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.kms.kotlin.outputs.KeyRingImportJobAttestation
import com.pulumi.gcp.kms.kotlin.outputs.KeyRingImportJobPublicKey
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.gcp.kms.kotlin.outputs.KeyRingImportJobAttestation.Companion.toKotlin as keyRingImportJobAttestationToKotlin
import com.pulumi.gcp.kms.kotlin.outputs.KeyRingImportJobPublicKey.Companion.toKotlin as keyRingImportJobPublicKeyToKotlin

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

    public var args: KeyRingImportJobArgs = KeyRingImportJobArgs()

    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 KeyRingImportJobArgsBuilder.() -> Unit) {
        val builder = KeyRingImportJobArgsBuilder()
        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(): KeyRingImportJob {
        val builtJavaResource = com.pulumi.gcp.kms.KeyRingImportJob(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return KeyRingImportJob(builtJavaResource)
    }
}

/**
 * A `KeyRingImportJob` can be used to create `CryptoKeys` and `CryptoKeyVersions` using pre-existing
 * key material, generated outside of Cloud KMS. A `KeyRingImportJob` expires 3 days after it is created.
 * Once expired, Cloud KMS will no longer be able to import or unwrap any key material that
 * was wrapped with the `KeyRingImportJob`'s public key.
 * > **Note:** KeyRingImportJobs cannot be deleted from Google Cloud Platform.
 * Destroying a provider-managed KeyRingImportJob will remove it from state but
 * *will not delete the resource from the project.*
 * To get more information about KeyRingImportJob, see:
 * * [API documentation](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.importJobs)
 * * How-to Guides
 *     * [Importing a key](https://cloud.google.com/kms/docs/importing-a-key)
 * ## Example Usage
 * ## Import
 * KeyRingImportJob can be imported using any of these accepted formats:
 * * `{{name}}`
 * When using the `pulumi import` command, KeyRingImportJob can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:kms/keyRingImportJob:KeyRingImportJob default {{name}}
 * ```
 */
public class KeyRingImportJob internal constructor(
    override val javaResource: com.pulumi.gcp.kms.KeyRingImportJob,
) : KotlinCustomResource(javaResource, KeyRingImportJobMapper) {
    /**
     * Statement that was generated and signed by the key creator (for example, an HSM) at key creation time.
     * Use this statement to verify attributes of the key as stored on the HSM, independently of Google.
     * Only present if the chosen ImportMethod is one with a protection level of HSM.
     * Structure is documented below.
     */
    public val attestations: Output>
        get() = javaResource.attestations().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    keyRingImportJobAttestationToKotlin(args0)
                })
            })
        })

    /**
     * The time at which this resource is scheduled for expiration and can no longer be used.
     * This is in RFC3339 text format.
     */
    public val expireTime: Output
        get() = javaResource.expireTime().applyValue({ args0 -> args0 })

    /**
     * It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}
     * - - -
     */
    public val importJobId: Output
        get() = javaResource.importJobId().applyValue({ args0 -> args0 })

    /**
     * The wrapping method to be used for incoming key material.
     * Possible values are: `RSA_OAEP_3072_SHA1_AES_256`, `RSA_OAEP_4096_SHA1_AES_256`.
     */
    public val importMethod: Output
        get() = javaResource.importMethod().applyValue({ args0 -> args0 })

    /**
     * The KeyRing that this import job belongs to.
     * Format: `'projects/{{project}}/locations/{{location}}/keyRings/{{keyRing}}'`.
     */
    public val keyRing: Output
        get() = javaResource.keyRing().applyValue({ args0 -> args0 })

    /**
     * The resource name for this ImportJob in the format projects/*/locations/*/keyRings/*/importJobs/*.
     * */*/*/*/
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The protection level of the ImportJob. This must match the protectionLevel of the
     * versionTemplate on the CryptoKey you attempt to import into.
     * Possible values are: `SOFTWARE`, `HSM`, `EXTERNAL`.
     */
    public val protectionLevel: Output
        get() = javaResource.protectionLevel().applyValue({ args0 -> args0 })

    /**
     * The public key with which to wrap key material prior to import. Only returned if state is `ACTIVE`.
     * Structure is documented below.
     */
    public val publicKeys: Output>
        get() = javaResource.publicKeys().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    keyRingImportJobPublicKeyToKotlin(args0)
                })
            })
        })

    /**
     * The current state of the ImportJob, indicating if it can be used.
     */
    public val state: Output
        get() = javaResource.state().applyValue({ args0 -> args0 })
}

public object KeyRingImportJobMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.kms.KeyRingImportJob::class == javaResource::class

    override fun map(javaResource: Resource): KeyRingImportJob = KeyRingImportJob(
        javaResource as
            com.pulumi.gcp.kms.KeyRingImportJob,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy