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

com.pulumi.cloudflare.kotlin.AccessServiceToken.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 [AccessServiceToken].
 */
@PulumiTagMarker
public class AccessServiceTokenResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: AccessServiceTokenArgs = AccessServiceTokenArgs()

    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 AccessServiceTokenArgsBuilder.() -> Unit) {
        val builder = AccessServiceTokenArgsBuilder()
        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(): AccessServiceToken {
        val builtJavaResource = com.pulumi.cloudflare.AccessServiceToken(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return AccessServiceToken(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/accessServiceToken:AccessServiceToken example /
 * ```
 */
public class AccessServiceToken internal constructor(
    override val javaResource: com.pulumi.cloudflare.AccessServiceToken,
) : KotlinCustomResource(javaResource, AccessServiceTokenMapper) {
    /**
     * 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 AccessServiceTokenMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.cloudflare.AccessServiceToken::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy