com.pulumi.gitlab.kotlin.BranchProtectionArgs.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.core.Output.of
import com.pulumi.gitlab.BranchProtectionArgs.builder
import com.pulumi.gitlab.kotlin.inputs.BranchProtectionAllowedToMergeArgs
import com.pulumi.gitlab.kotlin.inputs.BranchProtectionAllowedToMergeArgsBuilder
import com.pulumi.gitlab.kotlin.inputs.BranchProtectionAllowedToPushArgs
import com.pulumi.gitlab.kotlin.inputs.BranchProtectionAllowedToPushArgsBuilder
import com.pulumi.gitlab.kotlin.inputs.BranchProtectionAllowedToUnprotectArgs
import com.pulumi.gitlab.kotlin.inputs.BranchProtectionAllowedToUnprotectArgsBuilder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName
/**
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gitlab from "@pulumi/gitlab";
* const branchProtect = new gitlab.BranchProtection("BranchProtect", {
* project: "12345",
* branch: "BranchProtected",
* pushAccessLevel: "developer",
* mergeAccessLevel: "developer",
* unprotectAccessLevel: "developer",
* allowForcePush: true,
* codeOwnerApprovalRequired: true,
* allowedToPushes: [
* {
* userId: 5,
* },
* {
* userId: 521,
* },
* ],
* allowedToMerges: [
* {
* userId: 15,
* },
* {
* userId: 37,
* },
* ],
* allowedToUnprotects: [
* {
* userId: 15,
* },
* {
* groupId: 42,
* },
* ],
* });
* // Example using dynamic block
* const main = new gitlab.BranchProtection("main", {
* allowedToPushes: [
* 50,
* 55,
* 60,
* ].map((v, k) => ({key: k, value: v})).map(entry => ({
* userId: entry.value,
* })),
* project: "12345",
* branch: "main",
* pushAccessLevel: "maintainer",
* mergeAccessLevel: "maintainer",
* unprotectAccessLevel: "maintainer",
* });
* ```
* ```python
* import pulumi
* import pulumi_gitlab as gitlab
* branch_protect = gitlab.BranchProtection("BranchProtect",
* project="12345",
* branch="BranchProtected",
* push_access_level="developer",
* merge_access_level="developer",
* unprotect_access_level="developer",
* allow_force_push=True,
* code_owner_approval_required=True,
* allowed_to_pushes=[
* {
* "user_id": 5,
* },
* {
* "user_id": 521,
* },
* ],
* allowed_to_merges=[
* {
* "user_id": 15,
* },
* {
* "user_id": 37,
* },
* ],
* allowed_to_unprotects=[
* {
* "user_id": 15,
* },
* {
* "group_id": 42,
* },
* ])
* # Example using dynamic block
* main = gitlab.BranchProtection("main",
* allowed_to_pushes=[{
* "user_id": entry["value"],
* } for entry in [{"key": k, "value": v} for k, v in [
* 50,
* 55,
* 60,
* ]]],
* project="12345",
* branch="main",
* push_access_level="maintainer",
* merge_access_level="maintainer",
* unprotect_access_level="maintainer")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using GitLab = Pulumi.GitLab;
* return await Deployment.RunAsync(() =>
* {
* var branchProtect = new GitLab.BranchProtection("BranchProtect", new()
* {
* Project = "12345",
* Branch = "BranchProtected",
* PushAccessLevel = "developer",
* MergeAccessLevel = "developer",
* UnprotectAccessLevel = "developer",
* AllowForcePush = true,
* CodeOwnerApprovalRequired = true,
* AllowedToPushes = new[]
* {
* new GitLab.Inputs.BranchProtectionAllowedToPushArgs
* {
* UserId = 5,
* },
* new GitLab.Inputs.BranchProtectionAllowedToPushArgs
* {
* UserId = 521,
* },
* },
* AllowedToMerges = new[]
* {
* new GitLab.Inputs.BranchProtectionAllowedToMergeArgs
* {
* UserId = 15,
* },
* new GitLab.Inputs.BranchProtectionAllowedToMergeArgs
* {
* UserId = 37,
* },
* },
* AllowedToUnprotects = new[]
* {
* new GitLab.Inputs.BranchProtectionAllowedToUnprotectArgs
* {
* UserId = 15,
* },
* new GitLab.Inputs.BranchProtectionAllowedToUnprotectArgs
* {
* GroupId = 42,
* },
* },
* });
* // Example using dynamic block
* var main = new GitLab.BranchProtection("main", new()
* {
* AllowedToPushes = new[]
* {
* 50,
* 55,
* 60,
* }.Select((v, k) => new { Key = k, Value = v }).Select(entry =>
* {
* return new GitLab.Inputs.BranchProtectionAllowedToPushArgs
* {
* UserId = entry.Value,
* };
* }).ToList(),
* Project = "12345",
* Branch = "main",
* PushAccessLevel = "maintainer",
* MergeAccessLevel = "maintainer",
* UnprotectAccessLevel = "maintainer",
* });
* });
* ```
*
* ## Import
* Starting in Terraform v1.5.0 you can use an import block to import `gitlab_branch_protection`. For example:
* terraform
* import {
* to = gitlab_branch_protection.example
* id = "see CLI command below for ID"
* }
* Import using the CLI is supported using the following syntax:
* Gitlab protected branches can be imported with a key composed of `:`, e.g.
* ```sh
* $ pulumi import gitlab:index/branchProtection:BranchProtection BranchProtect "12345:main"
* ```
* @property allowForcePush Can be set to true to allow users with push access to force push.
* @property allowedToMerges Array of access levels and user(s)/group(s) allowed to merge to protected branch.
* @property allowedToPushes Array of access levels and user(s)/group(s) allowed to push to protected branch.
* @property allowedToUnprotects Array of access levels and user(s)/group(s) allowed to unprotect push to protected branch.
* @property branch Name of the branch.
* @property codeOwnerApprovalRequired Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
* @property mergeAccessLevel Access levels allowed to merge. Valid values are: `no one`, `developer`, `maintainer`.
* @property project The id of the project.
* @property pushAccessLevel Access levels allowed to push. Valid values are: `no one`, `developer`, `maintainer`.
* @property unprotectAccessLevel Access levels allowed to unprotect. Valid values are: `developer`, `maintainer`, `admin`.
*/
public data class BranchProtectionArgs(
public val allowForcePush: Output? = null,
public val allowedToMerges: Output>? = null,
public val allowedToPushes: Output>? = null,
public val allowedToUnprotects: Output>? = null,
public val branch: Output? = null,
public val codeOwnerApprovalRequired: Output? = null,
public val mergeAccessLevel: Output? = null,
public val project: Output? = null,
public val pushAccessLevel: Output? = null,
public val unprotectAccessLevel: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.gitlab.BranchProtectionArgs =
com.pulumi.gitlab.BranchProtectionArgs.builder()
.allowForcePush(allowForcePush?.applyValue({ args0 -> args0 }))
.allowedToMerges(
allowedToMerges?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
})
}),
)
.allowedToPushes(
allowedToPushes?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
})
}),
)
.allowedToUnprotects(
allowedToUnprotects?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> args0.toJava() })
})
}),
)
.branch(branch?.applyValue({ args0 -> args0 }))
.codeOwnerApprovalRequired(codeOwnerApprovalRequired?.applyValue({ args0 -> args0 }))
.mergeAccessLevel(mergeAccessLevel?.applyValue({ args0 -> args0 }))
.project(project?.applyValue({ args0 -> args0 }))
.pushAccessLevel(pushAccessLevel?.applyValue({ args0 -> args0 }))
.unprotectAccessLevel(unprotectAccessLevel?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [BranchProtectionArgs].
*/
@PulumiTagMarker
public class BranchProtectionArgsBuilder internal constructor() {
private var allowForcePush: Output? = null
private var allowedToMerges: Output>? = null
private var allowedToPushes: Output>? = null
private var allowedToUnprotects: Output>? = null
private var branch: Output? = null
private var codeOwnerApprovalRequired: Output? = null
private var mergeAccessLevel: Output? = null
private var project: Output? = null
private var pushAccessLevel: Output? = null
private var unprotectAccessLevel: Output? = null
/**
* @param value Can be set to true to allow users with push access to force push.
*/
@JvmName("sqsektyngopkqxtg")
public suspend fun allowForcePush(`value`: Output) {
this.allowForcePush = value
}
/**
* @param value Array of access levels and user(s)/group(s) allowed to merge to protected branch.
*/
@JvmName("ufbmldmtaofprgdc")
public suspend fun allowedToMerges(`value`: Output>) {
this.allowedToMerges = value
}
@JvmName("rwcxmohbvvkpphhf")
public suspend fun allowedToMerges(vararg values: Output) {
this.allowedToMerges = Output.all(values.asList())
}
/**
* @param values Array of access levels and user(s)/group(s) allowed to merge to protected branch.
*/
@JvmName("hardvrukybfpupck")
public suspend fun allowedToMerges(values: List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy