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

com.pulumi.cloudflare.kotlin.ZeroTrustAccessServiceToken.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.cloudflare.kotlin

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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

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

    public var args: ZeroTrustAccessServiceTokenArgs = ZeroTrustAccessServiceTokenArgs()

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

/**
 * Access Service Tokens are used for service-to-service communication
 * when an application is behind Cloudflare Access.
 * ## Import
 * If you are importing an Access Service Token you will not have the
 * client_secret available in the state for use. The client_secret is only
 * available once, at creation. In most cases, it is better to just create a new
 * resource should you need to reference it in other resources.
 * ```sh
 * $ pulumi import cloudflare:index/zeroTrustAccessServiceToken:ZeroTrustAccessServiceToken example /
 * ```
 */
public class ZeroTrustAccessServiceToken internal constructor(
    override val javaResource: com.pulumi.cloudflare.ZeroTrustAccessServiceToken,
) : KotlinCustomResource(javaResource, ZeroTrustAccessServiceTokenMapper) {
    /**
     * The account identifier to target for the resource. Conflicts with `zone_id`.
     */
    public val accountId: Output?
        get() = javaResource.accountId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Client ID associated with the Service Token. **Modifying this attribute will force creation of a new resource.**
     */
    public val clientId: Output
        get() = javaResource.clientId().applyValue({ args0 -> args0 })

    /**
     * A secret for interacting with Access protocols. **Modifying this attribute will force creation of a new resource.**
     */
    public val clientSecret: Output
        get() = javaResource.clientSecret().applyValue({ args0 -> args0 })

    /**
     * Length of time the service token is valid for. Available values: `8760h`, `17520h`, `43800h`, `87600h`, `forever`.
     */
    public val duration: Output
        get() = javaResource.duration().applyValue({ args0 -> args0 })

    /**
     * Date when the token expires.
     */
    public val expiresAt: Output
        get() = javaResource.expiresAt().applyValue({ args0 -> args0 })

    public val minDaysForRenewal: Output?
        get() = javaResource.minDaysForRenewal().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Friendly name of the token's intent.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The zone identifier to target for the resource. Conflicts with `account_id`.
     */
    public val zoneId: Output?
        get() = javaResource.zoneId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

public object ZeroTrustAccessServiceTokenMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.cloudflare.ZeroTrustAccessServiceToken::class == javaResource::class

    override fun map(javaResource: Resource): ZeroTrustAccessServiceToken =
        ZeroTrustAccessServiceToken(javaResource as com.pulumi.cloudflare.ZeroTrustAccessServiceToken)
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy