1. Packages
  2. Gitlab Provider
  3. API Docs
  4. getProjectProtectedBranch
GitLab v8.10.0 published on Friday, Mar 21, 2025 by Pulumi

gitlab.getProjectProtectedBranch

Explore with Pulumi AI

The gitlab.getProjectProtectedBranch data source allows details of a protected branch to be retrieved by its name and the project it belongs to.

Upstream API: GitLab REST API docs

Using getProjectProtectedBranch

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getProjectProtectedBranch(args: GetProjectProtectedBranchArgs, opts?: InvokeOptions): Promise<GetProjectProtectedBranchResult>
function getProjectProtectedBranchOutput(args: GetProjectProtectedBranchOutputArgs, opts?: InvokeOptions): Output<GetProjectProtectedBranchResult>
Copy
def get_project_protected_branch(merge_access_levels: Optional[Sequence[GetProjectProtectedBranchMergeAccessLevel]] = None,
                                 name: Optional[str] = None,
                                 project_id: Optional[str] = None,
                                 push_access_levels: Optional[Sequence[GetProjectProtectedBranchPushAccessLevel]] = None,
                                 opts: Optional[InvokeOptions] = None) -> GetProjectProtectedBranchResult
def get_project_protected_branch_output(merge_access_levels: Optional[pulumi.Input[Sequence[pulumi.Input[GetProjectProtectedBranchMergeAccessLevelArgs]]]] = None,
                                 name: Optional[pulumi.Input[str]] = None,
                                 project_id: Optional[pulumi.Input[str]] = None,
                                 push_access_levels: Optional[pulumi.Input[Sequence[pulumi.Input[GetProjectProtectedBranchPushAccessLevelArgs]]]] = None,
                                 opts: Optional[InvokeOptions] = None) -> Output[GetProjectProtectedBranchResult]
Copy
func GetProjectProtectedBranch(ctx *Context, args *GetProjectProtectedBranchArgs, opts ...InvokeOption) (*GetProjectProtectedBranchResult, error)
func GetProjectProtectedBranchOutput(ctx *Context, args *GetProjectProtectedBranchOutputArgs, opts ...InvokeOption) GetProjectProtectedBranchResultOutput
Copy

> Note: This function is named GetProjectProtectedBranch in the Go SDK.

public static class GetProjectProtectedBranch 
{
    public static Task<GetProjectProtectedBranchResult> InvokeAsync(GetProjectProtectedBranchArgs args, InvokeOptions? opts = null)
    public static Output<GetProjectProtectedBranchResult> Invoke(GetProjectProtectedBranchInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetProjectProtectedBranchResult> getProjectProtectedBranch(GetProjectProtectedBranchArgs args, InvokeOptions options)
public static Output<GetProjectProtectedBranchResult> getProjectProtectedBranch(GetProjectProtectedBranchArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: gitlab:index/getProjectProtectedBranch:getProjectProtectedBranch
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
The name of the protected branch.
ProjectId This property is required. string
The integer or path with namespace that uniquely identifies the project.
MergeAccessLevels List<Pulumi.GitLab.Inputs.GetProjectProtectedBranchMergeAccessLevel>
Array of access levels and user(s)/group(s) allowed to merge to protected branch.
PushAccessLevels List<Pulumi.GitLab.Inputs.GetProjectProtectedBranchPushAccessLevel>
Array of access levels and user(s)/group(s) allowed to push to protected branch.
Name This property is required. string
The name of the protected branch.
ProjectId This property is required. string
The integer or path with namespace that uniquely identifies the project.
MergeAccessLevels []GetProjectProtectedBranchMergeAccessLevel
Array of access levels and user(s)/group(s) allowed to merge to protected branch.
PushAccessLevels []GetProjectProtectedBranchPushAccessLevel
Array of access levels and user(s)/group(s) allowed to push to protected branch.
name This property is required. String
The name of the protected branch.
projectId This property is required. String
The integer or path with namespace that uniquely identifies the project.
mergeAccessLevels List<GetProjectProtectedBranchMergeAccessLevel>
Array of access levels and user(s)/group(s) allowed to merge to protected branch.
pushAccessLevels List<GetProjectProtectedBranchPushAccessLevel>
Array of access levels and user(s)/group(s) allowed to push to protected branch.
name This property is required. string
The name of the protected branch.
projectId This property is required. string
The integer or path with namespace that uniquely identifies the project.
mergeAccessLevels GetProjectProtectedBranchMergeAccessLevel[]
Array of access levels and user(s)/group(s) allowed to merge to protected branch.
pushAccessLevels GetProjectProtectedBranchPushAccessLevel[]
Array of access levels and user(s)/group(s) allowed to push to protected branch.
name This property is required. str
The name of the protected branch.
project_id This property is required. str
The integer or path with namespace that uniquely identifies the project.
merge_access_levels Sequence[GetProjectProtectedBranchMergeAccessLevel]
Array of access levels and user(s)/group(s) allowed to merge to protected branch.
push_access_levels Sequence[GetProjectProtectedBranchPushAccessLevel]
Array of access levels and user(s)/group(s) allowed to push to protected branch.
name This property is required. String
The name of the protected branch.
projectId This property is required. String
The integer or path with namespace that uniquely identifies the project.
mergeAccessLevels List<Property Map>
Array of access levels and user(s)/group(s) allowed to merge to protected branch.
pushAccessLevels List<Property Map>
Array of access levels and user(s)/group(s) allowed to push to protected branch.

getProjectProtectedBranch Result

The following output properties are available:

AllowForcePush bool
Whether force push is allowed.
CodeOwnerApprovalRequired bool
Reject code pushes that change files listed in the CODEOWNERS file.
Id int
The ID of this resource.
Name string
The name of the protected branch.
ProjectId string
The integer or path with namespace that uniquely identifies the project.
MergeAccessLevels List<Pulumi.GitLab.Outputs.GetProjectProtectedBranchMergeAccessLevel>
Array of access levels and user(s)/group(s) allowed to merge to protected branch.
PushAccessLevels List<Pulumi.GitLab.Outputs.GetProjectProtectedBranchPushAccessLevel>
Array of access levels and user(s)/group(s) allowed to push to protected branch.
AllowForcePush bool
Whether force push is allowed.
CodeOwnerApprovalRequired bool
Reject code pushes that change files listed in the CODEOWNERS file.
Id int
The ID of this resource.
Name string
The name of the protected branch.
ProjectId string
The integer or path with namespace that uniquely identifies the project.
MergeAccessLevels []GetProjectProtectedBranchMergeAccessLevel
Array of access levels and user(s)/group(s) allowed to merge to protected branch.
PushAccessLevels []GetProjectProtectedBranchPushAccessLevel
Array of access levels and user(s)/group(s) allowed to push to protected branch.
allowForcePush Boolean
Whether force push is allowed.
codeOwnerApprovalRequired Boolean
Reject code pushes that change files listed in the CODEOWNERS file.
id Integer
The ID of this resource.
name String
The name of the protected branch.
projectId String
The integer or path with namespace that uniquely identifies the project.
mergeAccessLevels List<GetProjectProtectedBranchMergeAccessLevel>
Array of access levels and user(s)/group(s) allowed to merge to protected branch.
pushAccessLevels List<GetProjectProtectedBranchPushAccessLevel>
Array of access levels and user(s)/group(s) allowed to push to protected branch.
allowForcePush boolean
Whether force push is allowed.
codeOwnerApprovalRequired boolean
Reject code pushes that change files listed in the CODEOWNERS file.
id number
The ID of this resource.
name string
The name of the protected branch.
projectId string
The integer or path with namespace that uniquely identifies the project.
mergeAccessLevels GetProjectProtectedBranchMergeAccessLevel[]
Array of access levels and user(s)/group(s) allowed to merge to protected branch.
pushAccessLevels GetProjectProtectedBranchPushAccessLevel[]
Array of access levels and user(s)/group(s) allowed to push to protected branch.
allow_force_push bool
Whether force push is allowed.
code_owner_approval_required bool
Reject code pushes that change files listed in the CODEOWNERS file.
id int
The ID of this resource.
name str
The name of the protected branch.
project_id str
The integer or path with namespace that uniquely identifies the project.
merge_access_levels Sequence[GetProjectProtectedBranchMergeAccessLevel]
Array of access levels and user(s)/group(s) allowed to merge to protected branch.
push_access_levels Sequence[GetProjectProtectedBranchPushAccessLevel]
Array of access levels and user(s)/group(s) allowed to push to protected branch.
allowForcePush Boolean
Whether force push is allowed.
codeOwnerApprovalRequired Boolean
Reject code pushes that change files listed in the CODEOWNERS file.
id Number
The ID of this resource.
name String
The name of the protected branch.
projectId String
The integer or path with namespace that uniquely identifies the project.
mergeAccessLevels List<Property Map>
Array of access levels and user(s)/group(s) allowed to merge to protected branch.
pushAccessLevels List<Property Map>
Array of access levels and user(s)/group(s) allowed to push to protected branch.

Supporting Types

GetProjectProtectedBranchMergeAccessLevel

AccessLevel This property is required. string
Access levels allowed to merge to protected branch. Valid values are: no one, developer, maintainer.
AccessLevelDescription This property is required. string
Readable description of access level.
GroupId int
The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with user_id.
UserId int
The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with group_id.
AccessLevel This property is required. string
Access levels allowed to merge to protected branch. Valid values are: no one, developer, maintainer.
AccessLevelDescription This property is required. string
Readable description of access level.
GroupId int
The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with user_id.
UserId int
The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with group_id.
accessLevel This property is required. String
Access levels allowed to merge to protected branch. Valid values are: no one, developer, maintainer.
accessLevelDescription This property is required. String
Readable description of access level.
groupId Integer
The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with user_id.
userId Integer
The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with group_id.
accessLevel This property is required. string
Access levels allowed to merge to protected branch. Valid values are: no one, developer, maintainer.
accessLevelDescription This property is required. string
Readable description of access level.
groupId number
The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with user_id.
userId number
The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with group_id.
access_level This property is required. str
Access levels allowed to merge to protected branch. Valid values are: no one, developer, maintainer.
access_level_description This property is required. str
Readable description of access level.
group_id int
The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with user_id.
user_id int
The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with group_id.
accessLevel This property is required. String
Access levels allowed to merge to protected branch. Valid values are: no one, developer, maintainer.
accessLevelDescription This property is required. String
Readable description of access level.
groupId Number
The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with user_id.
userId Number
The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with group_id.

GetProjectProtectedBranchPushAccessLevel

AccessLevel This property is required. string
Access levels allowed to push to protected branch. Valid values are: no one, developer, maintainer.
AccessLevelDescription This property is required. string
Readable description of access level.
DeployKeyId int
The ID of a GitLab deploy key allowed to perform the relevant action. Mutually exclusive with group_id and user_id. This field is read-only until Gitlab 17.5.
GroupId int
The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with deploy_key_id and user_id.
UserId int
The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with deploy_key_id and group_id.
AccessLevel This property is required. string
Access levels allowed to push to protected branch. Valid values are: no one, developer, maintainer.
AccessLevelDescription This property is required. string
Readable description of access level.
DeployKeyId int
The ID of a GitLab deploy key allowed to perform the relevant action. Mutually exclusive with group_id and user_id. This field is read-only until Gitlab 17.5.
GroupId int
The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with deploy_key_id and user_id.
UserId int
The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with deploy_key_id and group_id.
accessLevel This property is required. String
Access levels allowed to push to protected branch. Valid values are: no one, developer, maintainer.
accessLevelDescription This property is required. String
Readable description of access level.
deployKeyId Integer
The ID of a GitLab deploy key allowed to perform the relevant action. Mutually exclusive with group_id and user_id. This field is read-only until Gitlab 17.5.
groupId Integer
The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with deploy_key_id and user_id.
userId Integer
The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with deploy_key_id and group_id.
accessLevel This property is required. string
Access levels allowed to push to protected branch. Valid values are: no one, developer, maintainer.
accessLevelDescription This property is required. string
Readable description of access level.
deployKeyId number
The ID of a GitLab deploy key allowed to perform the relevant action. Mutually exclusive with group_id and user_id. This field is read-only until Gitlab 17.5.
groupId number
The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with deploy_key_id and user_id.
userId number
The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with deploy_key_id and group_id.
access_level This property is required. str
Access levels allowed to push to protected branch. Valid values are: no one, developer, maintainer.
access_level_description This property is required. str
Readable description of access level.
deploy_key_id int
The ID of a GitLab deploy key allowed to perform the relevant action. Mutually exclusive with group_id and user_id. This field is read-only until Gitlab 17.5.
group_id int
The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with deploy_key_id and user_id.
user_id int
The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with deploy_key_id and group_id.
accessLevel This property is required. String
Access levels allowed to push to protected branch. Valid values are: no one, developer, maintainer.
accessLevelDescription This property is required. String
Readable description of access level.
deployKeyId Number
The ID of a GitLab deploy key allowed to perform the relevant action. Mutually exclusive with group_id and user_id. This field is read-only until Gitlab 17.5.
groupId Number
The ID of a GitLab group allowed to perform the relevant action. Mutually exclusive with deploy_key_id and user_id.
userId Number
The ID of a GitLab user allowed to perform the relevant action. Mutually exclusive with deploy_key_id and group_id.

Package Details

Repository
GitLab pulumi/pulumi-gitlab
License
Apache-2.0
Notes
This Pulumi package is based on the gitlab Terraform Provider.