com.pulumi.gitlab.kotlin.ProjectJobTokenScopes.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gitlab-kotlin Show documentation
Show all versions of pulumi-gitlab-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@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.Deprecated
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
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gitlab from "@pulumi/gitlab";
* const allowedSingleProject = new gitlab.ProjectJobTokenScopes("allowed_single_project", {
* project: "111",
* targetProjectIds: [123],
* });
* const allowedMultipleProject = new gitlab.ProjectJobTokenScopes("allowed_multiple_project", {
* project: "111",
* targetProjectIds: [
* 123,
* 456,
* 789,
* ],
* });
* const allowedMultipleGroups = new gitlab.ProjectJobTokenScopes("allowed_multiple_groups", {
* projectId: 111,
* targetProjectIds: [],
* targetGroupIds: [
* 321,
* 654,
* ],
* });
* // This will remove all job token scopes, even if added outside of TF.
* const explicitDeny = new gitlab.ProjectJobTokenScopes("explicit_deny", {
* project: "111",
* targetProjectIds: [],
* });
* ```
* ```python
* import pulumi
* import pulumi_gitlab as gitlab
* allowed_single_project = gitlab.ProjectJobTokenScopes("allowed_single_project",
* project="111",
* target_project_ids=[123])
* allowed_multiple_project = gitlab.ProjectJobTokenScopes("allowed_multiple_project",
* project="111",
* target_project_ids=[
* 123,
* 456,
* 789,
* ])
* allowed_multiple_groups = gitlab.ProjectJobTokenScopes("allowed_multiple_groups",
* project_id=111,
* target_project_ids=[],
* target_group_ids=[
* 321,
* 654,
* ])
* # This will remove all job token scopes, even if added outside of TF.
* explicit_deny = gitlab.ProjectJobTokenScopes("explicit_deny",
* project="111",
* target_project_ids=[])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using GitLab = Pulumi.GitLab;
* return await Deployment.RunAsync(() =>
* {
* var allowedSingleProject = new GitLab.ProjectJobTokenScopes("allowed_single_project", new()
* {
* Project = "111",
* TargetProjectIds = new[]
* {
* 123,
* },
* });
* var allowedMultipleProject = new GitLab.ProjectJobTokenScopes("allowed_multiple_project", new()
* {
* Project = "111",
* TargetProjectIds = new[]
* {
* 123,
* 456,
* 789,
* },
* });
* var allowedMultipleGroups = new GitLab.ProjectJobTokenScopes("allowed_multiple_groups", new()
* {
* ProjectId = 111,
* TargetProjectIds = new[] {},
* TargetGroupIds = new[]
* {
* 321,
* 654,
* },
* });
* // This will remove all job token scopes, even if added outside of TF.
* var explicitDeny = new GitLab.ProjectJobTokenScopes("explicit_deny", new()
* {
* Project = "111",
* TargetProjectIds = new[] {},
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gitlab/sdk/v8/go/gitlab"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := gitlab.NewProjectJobTokenScopes(ctx, "allowed_single_project", &gitlab.ProjectJobTokenScopesArgs{
* Project: pulumi.String("111"),
* TargetProjectIds: pulumi.IntArray{
* pulumi.Int(123),
* },
* })
* if err != nil {
* return err
* }
* _, err = gitlab.NewProjectJobTokenScopes(ctx, "allowed_multiple_project", &gitlab.ProjectJobTokenScopesArgs{
* Project: pulumi.String("111"),
* TargetProjectIds: pulumi.IntArray{
* pulumi.Int(123),
* pulumi.Int(456),
* pulumi.Int(789),
* },
* })
* if err != nil {
* return err
* }
* _, err = gitlab.NewProjectJobTokenScopes(ctx, "allowed_multiple_groups", &gitlab.ProjectJobTokenScopesArgs{
* ProjectId: pulumi.Int(111),
* TargetProjectIds: pulumi.IntArray{},
* TargetGroupIds: pulumi.IntArray{
* pulumi.Int(321),
* pulumi.Int(654),
* },
* })
* if err != nil {
* return err
* }
* // This will remove all job token scopes, even if added outside of TF.
* _, err = gitlab.NewProjectJobTokenScopes(ctx, "explicit_deny", &gitlab.ProjectJobTokenScopesArgs{
* Project: pulumi.String("111"),
* TargetProjectIds: pulumi.IntArray{},
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gitlab.ProjectJobTokenScopes;
* import com.pulumi.gitlab.ProjectJobTokenScopesArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var allowedSingleProject = new ProjectJobTokenScopes("allowedSingleProject", ProjectJobTokenScopesArgs.builder()
* .project("111")
* .targetProjectIds(123)
* .build());
* var allowedMultipleProject = new ProjectJobTokenScopes("allowedMultipleProject", ProjectJobTokenScopesArgs.builder()
* .project("111")
* .targetProjectIds(
* 123,
* 456,
* 789)
* .build());
* var allowedMultipleGroups = new ProjectJobTokenScopes("allowedMultipleGroups", ProjectJobTokenScopesArgs.builder()
* .projectId(111)
* .targetProjectIds()
* .targetGroupIds(
* 321,
* 654)
* .build());
* // This will remove all job token scopes, even if added outside of TF.
* var explicitDeny = new ProjectJobTokenScopes("explicitDeny", ProjectJobTokenScopesArgs.builder()
* .project("111")
* .targetProjectIds()
* .build());
* }
* }
* ```
* ```yaml
* resources:
* allowedSingleProject:
* type: gitlab:ProjectJobTokenScopes
* name: allowed_single_project
* properties:
* project: '111'
* targetProjectIds:
* - 123
* allowedMultipleProject:
* type: gitlab:ProjectJobTokenScopes
* name: allowed_multiple_project
* properties:
* project: '111'
* targetProjectIds:
* - 123
* - 456
* - 789
* allowedMultipleGroups:
* type: gitlab:ProjectJobTokenScopes
* name: allowed_multiple_groups
* properties:
* projectId: 111
* targetProjectIds: []
* targetGroupIds:
* - 321
* - 654
* # This will remove all job token scopes, even if added outside of TF.
* explicitDeny:
* type: gitlab:ProjectJobTokenScopes
* name: explicit_deny
* properties:
* project: '111'
* targetProjectIds: []
* ```
*
* ## Import
* Starting in Terraform v1.5.0 you can use an import block to import `gitlab_project_job_token_scopes`. For example:
* terraform
* import {
* to = gitlab_project_job_token_scopes.example
* id = "see CLI command below for ID"
* }
* Import using the CLI is supported using the following syntax:
* GitLab project job token scopes can be imported using an id made up of just the `project_id`
* ```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 or full path of the project.
*/
public val project: Output
get() = javaResource.project().applyValue({ args0 -> args0 })
/**
* The ID of the project.
*/
@Deprecated(
message = """
`project_id` has been deprecated. Use `project` instead.
""",
)
public val projectId: Output
get() = javaResource.projectId().applyValue({ args0 -> args0 })
/**
* A set of group IDs that are in the CI/CD job token inbound allowlist.
*/
public val targetGroupIds: Output>
get() = javaResource.targetGroupIds().applyValue({ args0 -> args0.map({ 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 - 2024 Weber Informatics LLC | Privacy Policy