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

com.pulumi.gitlab.kotlin.GroupServiceAccountAccessToken.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.4.2.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gitlab.kotlin

import com.pulumi.core.Output
import com.pulumi.gitlab.kotlin.outputs.GroupServiceAccountAccessTokenRotationConfiguration
import com.pulumi.gitlab.kotlin.outputs.GroupServiceAccountAccessTokenRotationConfiguration.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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List

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

    public var args: GroupServiceAccountAccessTokenArgs = GroupServiceAccountAccessTokenArgs()

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

/**
 * The `gitlab.GroupServiceAccountAccessToken` resource allows to manage the lifecycle of a group service account access token.
 * > Use of the `timestamp()` function with expires_at will cause the resource to be re-created with every apply, it's recommended to use `plantimestamp()` or a static value instead.
 * > Reading the access token status of a service account requires an admin token or a top-level group owner token on gitlab.com. As a result, this resource will ignore permission errors when attempting to read the token status, and will rely on the values in state instead. This can lead to apply-time failures if the token configured for the provider doesn't have permissions to rotate tokens for the service account.
 * > Use `rotation_configuration` to automatically rotate tokens instead of using `timestamp()` as timestamp will cause changes with every plan. `pulumi up` must still be run to rotate the token.
 * > Due to a limitation in the API, the `rotation_configuration` is unable to set the new expiry date. Instead, when the resource is created, it will default the expiry date to 7 days in the future. On each subsequent apply, the new expiry will be 7 days from the date of the apply.
 * **Upstream API**: [GitLab API docs](https://docs.gitlab.com/ee/api/group_service_accounts.html#create-a-personal-access-token-for-a-service-account-user)
 * ## Import
 * Starting in Terraform v1.5.0 you can use an import block to import `gitlab_group_service_account_access_token`. For example:
 * terraform
 * import {
 *   to = gitlab_group_service_account_access_token.example
 *   id = "see CLI command below for ID"
 * }
 * Import using the CLI is supported using the following syntax:
 * ```sh
 * $ pulumi import gitlab:index/groupServiceAccountAccessToken:GroupServiceAccountAccessToken You can import a service account access token using ` `. The
 * ```
 * `id` is in the form of ::
 * Importing an access token does not import the access token value.
 * ```sh
 * $ pulumi import gitlab:index/groupServiceAccountAccessToken:GroupServiceAccountAccessToken example 1:2:3
 * ```
 */
public class GroupServiceAccountAccessToken internal constructor(
    override val javaResource: com.pulumi.gitlab.GroupServiceAccountAccessToken,
) : KotlinCustomResource(javaResource, GroupServiceAccountAccessTokenMapper) {
    /**
     * True if the token is active.
     */
    public val active: Output
        get() = javaResource.active().applyValue({ args0 -> args0 })

    /**
     * Time the token has been created, RFC3339 format.
     */
    public val createdAt: Output
        get() = javaResource.createdAt().applyValue({ args0 -> args0 })

    /**
     * The service account access token expiry date. When left blank, the token follows the standard rule of expiry for personal access tokens.
     */
    public val expiresAt: Output
        get() = javaResource.expiresAt().applyValue({ args0 -> args0 })

    /**
     * The ID or URL-encoded path of the group containing the service account. Must be a top level group.
     */
    public val group: Output
        get() = javaResource.group().applyValue({ args0 -> args0 })

    /**
     * The name of the personal access token.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * True if the token is revoked.
     */
    public val revoked: Output
        get() = javaResource.revoked().applyValue({ args0 -> args0 })

    /**
     * The configuration for when to rotate a token automatically. Will not rotate a token until `pulumi up` is run.
     */
    public val rotationConfiguration: Output?
        get() = javaResource.rotationConfiguration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> toKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The scopes of the group service account access token. valid values are: `api`, `read_api`, `read_registry`, `write_registry`, `read_repository`, `write_repository`, `create_runner`, `manage_runner`, `ai_features`, `k8s_proxy`, `read_observability`, `write_observability`
     */
    public val scopes: Output>
        get() = javaResource.scopes().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * The token of the group service account access token. **Note**: the token is not available for imported resources.
     */
    public val token: Output
        get() = javaResource.token().applyValue({ args0 -> args0 })

    /**
     * The ID of a service account user.
     */
    public val userId: Output
        get() = javaResource.userId().applyValue({ args0 -> args0 })
}

public object GroupServiceAccountAccessTokenMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gitlab.GroupServiceAccountAccessToken::class == javaResource::class

    override fun map(javaResource: Resource): GroupServiceAccountAccessToken =
        GroupServiceAccountAccessToken(
            javaResource as
                com.pulumi.gitlab.GroupServiceAccountAccessToken,
        )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy