1. Packages
  2. Packages
  3. Gitlab Provider
  4. API Docs
  5. getProjectProtectedBranch
Viewing docs for GitLab v10.1.1
published on Thursday, Jul 23, 2026 by Pulumi
gitlab logo
Viewing docs for GitLab v10.1.1
published on Thursday, Jul 23, 2026 by Pulumi

    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>
    def get_project_protected_branch(name: Optional[str] = None,
                                     project_id: Optional[str] = None,
                                     opts: Optional[InvokeOptions] = None) -> GetProjectProtectedBranchResult
    def get_project_protected_branch_output(name: pulumi.Input[Optional[str]] = None,
                                     project_id: pulumi.Input[Optional[str]] = None,
                                     opts: Optional[InvokeOptions] = None) -> Output[GetProjectProtectedBranchResult]
    func GetProjectProtectedBranch(ctx *Context, args *GetProjectProtectedBranchArgs, opts ...InvokeOption) (*GetProjectProtectedBranchResult, error)
    func GetProjectProtectedBranchOutput(ctx *Context, args *GetProjectProtectedBranchOutputArgs, opts ...InvokeOption) GetProjectProtectedBranchResultOutput

    > 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)
    }
    public static CompletableFuture<GetProjectProtectedBranchResult> getProjectProtectedBranch(GetProjectProtectedBranchArgs args, InvokeOptions options)
    public static Output<GetProjectProtectedBranchResult> getProjectProtectedBranch(GetProjectProtectedBranchArgs args, InvokeOptions options)
    
    fn::invoke:
      function: gitlab:index/getProjectProtectedBranch:getProjectProtectedBranch
      arguments:
        # arguments dictionary
    data "gitlab_get_project_protected_branch" "name" {
        # arguments
    }

    The following arguments are supported:

    Name string
    The name of the protected branch.
    ProjectId string
    The integer or path with namespace that uniquely identifies the project.
    Name string
    The name of the protected branch.
    ProjectId string
    The integer or path with namespace that uniquely identifies the project.
    name string
    The name of the protected branch.
    project_id string
    The integer or path with namespace that uniquely identifies the project.
    name String
    The name of the protected branch.
    projectId String
    The integer or path with namespace that uniquely identifies the project.
    name string
    The name of the protected branch.
    projectId string
    The integer or path with namespace that uniquely identifies the project.
    name str
    The name of the protected branch.
    project_id str
    The integer or path with namespace that uniquely identifies the project.
    name String
    The name of the protected branch.
    projectId String
    The integer or path with namespace that uniquely identifies the project.

    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.
    MergeAccessLevels List<Pulumi.GitLab.Outputs.GetProjectProtectedBranchMergeAccessLevel>
    Array of merge access levels/users/groups allowed for the protected branch.
    Name string
    The name of the protected branch.
    ProjectId string
    The integer or path with namespace that uniquely identifies the project.
    PushAccessLevels List<Pulumi.GitLab.Outputs.GetProjectProtectedBranchPushAccessLevel>
    Array of push access levels/users/groups/deploy keys allowed for the protected branch.
    UnprotectAccessLevels List<Pulumi.GitLab.Outputs.GetProjectProtectedBranchUnprotectAccessLevel>
    Array of unprotect access levels/users/groups allowed for the 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.
    MergeAccessLevels []GetProjectProtectedBranchMergeAccessLevel
    Array of merge access levels/users/groups allowed for the protected branch.
    Name string
    The name of the protected branch.
    ProjectId string
    The integer or path with namespace that uniquely identifies the project.
    PushAccessLevels []GetProjectProtectedBranchPushAccessLevel
    Array of push access levels/users/groups/deploy keys allowed for the protected branch.
    UnprotectAccessLevels []GetProjectProtectedBranchUnprotectAccessLevel
    Array of unprotect access levels/users/groups allowed for the 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 number
    The ID of this resource.
    merge_access_levels list(object)
    Array of merge access levels/users/groups allowed for the protected branch.
    name string
    The name of the protected branch.
    project_id string
    The integer or path with namespace that uniquely identifies the project.
    push_access_levels list(object)
    Array of push access levels/users/groups/deploy keys allowed for the protected branch.
    unprotect_access_levels list(object)
    Array of unprotect access levels/users/groups allowed for the 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.
    mergeAccessLevels List<GetProjectProtectedBranchMergeAccessLevel>
    Array of merge access levels/users/groups allowed for the protected branch.
    name String
    The name of the protected branch.
    projectId String
    The integer or path with namespace that uniquely identifies the project.
    pushAccessLevels List<GetProjectProtectedBranchPushAccessLevel>
    Array of push access levels/users/groups/deploy keys allowed for the protected branch.
    unprotectAccessLevels List<GetProjectProtectedBranchUnprotectAccessLevel>
    Array of unprotect access levels/users/groups allowed for the 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.
    mergeAccessLevels GetProjectProtectedBranchMergeAccessLevel[]
    Array of merge access levels/users/groups allowed for the protected branch.
    name string
    The name of the protected branch.
    projectId string
    The integer or path with namespace that uniquely identifies the project.
    pushAccessLevels GetProjectProtectedBranchPushAccessLevel[]
    Array of push access levels/users/groups/deploy keys allowed for the protected branch.
    unprotectAccessLevels GetProjectProtectedBranchUnprotectAccessLevel[]
    Array of unprotect access levels/users/groups allowed for the 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.
    merge_access_levels Sequence[GetProjectProtectedBranchMergeAccessLevel]
    Array of merge access levels/users/groups allowed for the protected branch.
    name str
    The name of the protected branch.
    project_id str
    The integer or path with namespace that uniquely identifies the project.
    push_access_levels Sequence[GetProjectProtectedBranchPushAccessLevel]
    Array of push access levels/users/groups/deploy keys allowed for the protected branch.
    unprotect_access_levels Sequence[GetProjectProtectedBranchUnprotectAccessLevel]
    Array of unprotect access levels/users/groups allowed for the 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.
    mergeAccessLevels List<Property Map>
    Array of merge access levels/users/groups allowed for the protected branch.
    name String
    The name of the protected branch.
    projectId String
    The integer or path with namespace that uniquely identifies the project.
    pushAccessLevels List<Property Map>
    Array of push access levels/users/groups/deploy keys allowed for the protected branch.
    unprotectAccessLevels List<Property Map>
    Array of unprotect access levels/users/groups allowed for the protected branch.

    Supporting Types

    GetProjectProtectedBranchMergeAccessLevel

    AccessLevel string
    Access level allowed to perform the relevant action.
    AccessLevelDescription string
    Readable description of access level.
    GroupId int
    The ID of a GitLab group allowed to perform the relevant action.
    UserId int
    The ID of a GitLab user allowed to perform the relevant action.
    AccessLevel string
    Access level allowed to perform the relevant action.
    AccessLevelDescription string
    Readable description of access level.
    GroupId int
    The ID of a GitLab group allowed to perform the relevant action.
    UserId int
    The ID of a GitLab user allowed to perform the relevant action.
    access_level string
    Access level allowed to perform the relevant action.
    access_level_description string
    Readable description of access level.
    group_id number
    The ID of a GitLab group allowed to perform the relevant action.
    user_id number
    The ID of a GitLab user allowed to perform the relevant action.
    accessLevel String
    Access level allowed to perform the relevant action.
    accessLevelDescription String
    Readable description of access level.
    groupId Integer
    The ID of a GitLab group allowed to perform the relevant action.
    userId Integer
    The ID of a GitLab user allowed to perform the relevant action.
    accessLevel string
    Access level allowed to perform the relevant action.
    accessLevelDescription string
    Readable description of access level.
    groupId number
    The ID of a GitLab group allowed to perform the relevant action.
    userId number
    The ID of a GitLab user allowed to perform the relevant action.
    access_level str
    Access level allowed to perform the relevant action.
    access_level_description str
    Readable description of access level.
    group_id int
    The ID of a GitLab group allowed to perform the relevant action.
    user_id int
    The ID of a GitLab user allowed to perform the relevant action.
    accessLevel String
    Access level allowed to perform the relevant action.
    accessLevelDescription String
    Readable description of access level.
    groupId Number
    The ID of a GitLab group allowed to perform the relevant action.
    userId Number
    The ID of a GitLab user allowed to perform the relevant action.

    GetProjectProtectedBranchPushAccessLevel

    AccessLevel string
    Access level allowed to perform the relevant action.
    AccessLevelDescription string
    Readable description of access level.
    DeployKeyId int
    The ID of a GitLab deploy key allowed to perform the relevant action.
    GroupId int
    The ID of a GitLab group allowed to perform the relevant action.
    UserId int
    The ID of a GitLab user allowed to perform the relevant action.
    AccessLevel string
    Access level allowed to perform the relevant action.
    AccessLevelDescription string
    Readable description of access level.
    DeployKeyId int
    The ID of a GitLab deploy key allowed to perform the relevant action.
    GroupId int
    The ID of a GitLab group allowed to perform the relevant action.
    UserId int
    The ID of a GitLab user allowed to perform the relevant action.
    access_level string
    Access level allowed to perform the relevant action.
    access_level_description string
    Readable description of access level.
    deploy_key_id number
    The ID of a GitLab deploy key allowed to perform the relevant action.
    group_id number
    The ID of a GitLab group allowed to perform the relevant action.
    user_id number
    The ID of a GitLab user allowed to perform the relevant action.
    accessLevel String
    Access level allowed to perform the relevant action.
    accessLevelDescription String
    Readable description of access level.
    deployKeyId Integer
    The ID of a GitLab deploy key allowed to perform the relevant action.
    groupId Integer
    The ID of a GitLab group allowed to perform the relevant action.
    userId Integer
    The ID of a GitLab user allowed to perform the relevant action.
    accessLevel string
    Access level allowed to perform the relevant action.
    accessLevelDescription string
    Readable description of access level.
    deployKeyId number
    The ID of a GitLab deploy key allowed to perform the relevant action.
    groupId number
    The ID of a GitLab group allowed to perform the relevant action.
    userId number
    The ID of a GitLab user allowed to perform the relevant action.
    access_level str
    Access level allowed to perform the relevant action.
    access_level_description str
    Readable description of access level.
    deploy_key_id int
    The ID of a GitLab deploy key allowed to perform the relevant action.
    group_id int
    The ID of a GitLab group allowed to perform the relevant action.
    user_id int
    The ID of a GitLab user allowed to perform the relevant action.
    accessLevel String
    Access level allowed to perform the relevant action.
    accessLevelDescription String
    Readable description of access level.
    deployKeyId Number
    The ID of a GitLab deploy key allowed to perform the relevant action.
    groupId Number
    The ID of a GitLab group allowed to perform the relevant action.
    userId Number
    The ID of a GitLab user allowed to perform the relevant action.

    GetProjectProtectedBranchUnprotectAccessLevel

    AccessLevel string
    Access level allowed to perform the relevant action.
    AccessLevelDescription string
    Readable description of access level.
    GroupId int
    The ID of a GitLab group allowed to perform the relevant action.
    UserId int
    The ID of a GitLab user allowed to perform the relevant action.
    AccessLevel string
    Access level allowed to perform the relevant action.
    AccessLevelDescription string
    Readable description of access level.
    GroupId int
    The ID of a GitLab group allowed to perform the relevant action.
    UserId int
    The ID of a GitLab user allowed to perform the relevant action.
    access_level string
    Access level allowed to perform the relevant action.
    access_level_description string
    Readable description of access level.
    group_id number
    The ID of a GitLab group allowed to perform the relevant action.
    user_id number
    The ID of a GitLab user allowed to perform the relevant action.
    accessLevel String
    Access level allowed to perform the relevant action.
    accessLevelDescription String
    Readable description of access level.
    groupId Integer
    The ID of a GitLab group allowed to perform the relevant action.
    userId Integer
    The ID of a GitLab user allowed to perform the relevant action.
    accessLevel string
    Access level allowed to perform the relevant action.
    accessLevelDescription string
    Readable description of access level.
    groupId number
    The ID of a GitLab group allowed to perform the relevant action.
    userId number
    The ID of a GitLab user allowed to perform the relevant action.
    access_level str
    Access level allowed to perform the relevant action.
    access_level_description str
    Readable description of access level.
    group_id int
    The ID of a GitLab group allowed to perform the relevant action.
    user_id int
    The ID of a GitLab user allowed to perform the relevant action.
    accessLevel String
    Access level allowed to perform the relevant action.
    accessLevelDescription String
    Readable description of access level.
    groupId Number
    The ID of a GitLab group allowed to perform the relevant action.
    userId Number
    The ID of a GitLab user allowed to perform the relevant action.

    Package Details

    Repository
    GitLab pulumi/pulumi-gitlab
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the gitlab Terraform Provider.
    gitlab logo
    Viewing docs for GitLab v10.1.1
    published on Thursday, Jul 23, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial