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

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

package com.pulumi.gitlab.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
import kotlin.collections.List

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

    public var args: ProjectJobTokenScopesArgs = ProjectJobTokenScopesArgs()

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

/**
 * The `gitlab.ProjectJobTokenScopes` resource allows to manage the CI/CD Job Token scopes in a project.
 * Any project not within the defined set in this attribute will be removed, which allows this resource to be used as an explicit deny.
 * > Conflicts with the use of `gitlab.ProjectJobTokenScope` when used on the same project. Use one or the other to ensure the desired state.
 * **Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/ee/api/project_job_token_scopes.html)
 * ## Example Usage
 * 
 * ```yaml
 * resources:
 *   allowedSingleProject:
 *     type: gitlab:ProjectJobTokenScopes
 *     name: allowed_single_project
 *     properties:
 *       project: gitlab-org/gitlab
 *       targetProjectIds:
 *         - 123
 *   allowedMultipleProject:
 *     type: gitlab:ProjectJobTokenScopes
 *     name: allowed_multiple_project
 *     properties:
 *       project: gitlab-org/gitlab
 *       targetProjectIds:
 *         - 123
 *         - 456
 *         - 789
 *   # This will remove all job token scopes, even if added outside of TF.
 *   explicitDeny:
 *     type: gitlab:ProjectJobTokenScopes
 *     name: explicit_deny
 *     properties:
 *       project: gitlab-org/gitlab
 *       targetProjectIds: []
 * ```
 * 
 * ## Import
 * GitLab project job token scopes can be imported using an id made up of just the `project_id` as an integer
 * ```sh
 * $ pulumi import gitlab:index/projectJobTokenScopes:ProjectJobTokenScopes bar 123
 * ```
 */
public class ProjectJobTokenScopes internal constructor(
    override val javaResource: com.pulumi.gitlab.ProjectJobTokenScopes,
) : KotlinCustomResource(javaResource, ProjectJobTokenScopesMapper) {
    /**
     * The ID of the project.
     */
    public val projectId: Output
        get() = javaResource.projectId().applyValue({ args0 -> args0 })

    /**
     * A set of project IDs that are in the CI/CD job token inbound allowlist.
     */
    public val targetProjectIds: Output>
        get() = javaResource.targetProjectIds().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
}

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

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy