Branch Protection Args
data class BranchProtectionArgs(val allowForcePush: Output<Boolean>? = null, val allowedToMerges: Output<List<BranchProtectionAllowedToMergeArgs>>? = null, val allowedToPushes: Output<List<BranchProtectionAllowedToPushArgs>>? = null, val allowedToUnprotects: Output<List<BranchProtectionAllowedToUnprotectArgs>>? = null, val branch: Output<String>? = null, val codeOwnerApprovalRequired: Output<Boolean>? = null, val mergeAccessLevel: Output<String>? = null, val project: Output<String>? = null, val pushAccessLevel: Output<String>? = null, val unprotectAccessLevel: Output<String>? = null) : ConvertibleToJava<BranchProtectionArgs>
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.BranchProtection;
import com.pulumi.gitlab.BranchProtectionArgs;
import com.pulumi.gitlab.inputs.BranchProtectionAllowedToPushArgs;
import com.pulumi.gitlab.inputs.BranchProtectionAllowedToMergeArgs;
import com.pulumi.gitlab.inputs.BranchProtectionAllowedToUnprotectArgs;
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 branchProtect = new BranchProtection("branchProtect", BranchProtectionArgs.builder()
.project("12345")
.branch("BranchProtected")
.pushAccessLevel("developer")
.mergeAccessLevel("developer")
.unprotectAccessLevel("developer")
.allowForcePush(true)
.codeOwnerApprovalRequired(true)
.allowedToPushes(
BranchProtectionAllowedToPushArgs.builder()
.userId(5)
.build(),
BranchProtectionAllowedToPushArgs.builder()
.userId(521)
.build())
.allowedToMerges(
BranchProtectionAllowedToMergeArgs.builder()
.userId(15)
.build(),
BranchProtectionAllowedToMergeArgs.builder()
.userId(37)
.build())
.allowedToUnprotects(
BranchProtectionAllowedToUnprotectArgs.builder()
.userId(15)
.build(),
BranchProtectionAllowedToUnprotectArgs.builder()
.groupId(42)
.build())
.build());
var main = new BranchProtection("main", BranchProtectionArgs.builder()
.project("12345")
.branch("main")
.pushAccessLevel("maintainer")
.mergeAccessLevel("maintainer")
.unprotectAccessLevel("maintainer")
.dynamic(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
.build());
}
}
Content copied to clipboard
Import
Gitlab protected branches can be imported with a key composed of <project_id>:<branch>
, e.g.
$ pulumi import gitlab:index/branchProtection:BranchProtection BranchProtect "12345:main"
Content copied to clipboard
Constructors
Link copied to clipboard
constructor(allowForcePush: Output<Boolean>? = null, allowedToMerges: Output<List<BranchProtectionAllowedToMergeArgs>>? = null, allowedToPushes: Output<List<BranchProtectionAllowedToPushArgs>>? = null, allowedToUnprotects: Output<List<BranchProtectionAllowedToUnprotectArgs>>? = null, branch: Output<String>? = null, codeOwnerApprovalRequired: Output<Boolean>? = null, mergeAccessLevel: Output<String>? = null, project: Output<String>? = null, pushAccessLevel: Output<String>? = null, unprotectAccessLevel: Output<String>? = null)
Properties
Link copied to clipboard
Defines permissions for action.
Link copied to clipboard
Defines permissions for action.
Link copied to clipboard
Defines permissions for action.
Link copied to clipboard
Can be set to true to allow users with push access to force push.
Link copied to clipboard
Can be set to true to require code owner approval before merging. Only available own Premium and Ultimate instances.
Link copied to clipboard
Access levels allowed to merge. Valid values are: no one
, developer
, maintainer
.
Link copied to clipboard
Access levels allowed to push. Valid values are: no one
, developer
, maintainer
.
Link copied to clipboard
Access levels allowed to unprotect. Valid values are: no one
, developer
, maintainer
.