# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities
from . import outputs

__all__ = [
    'GetProjectProtectedBranchResult',
    'AwaitableGetProjectProtectedBranchResult',
    'get_project_protected_branch',
    'get_project_protected_branch_output',
]

@pulumi.output_type
class GetProjectProtectedBranchResult:
    """
    A collection of values returned by getProjectProtectedBranch.
    """
    def __init__(__self__, allow_force_push=None, code_owner_approval_required=None, id=None, merge_access_levels=None, name=None, project_id=None, push_access_levels=None):
        if allow_force_push and not isinstance(allow_force_push, bool):
            raise TypeError("Expected argument 'allow_force_push' to be a bool")
        pulumi.set(__self__, "allow_force_push", allow_force_push)
        if code_owner_approval_required and not isinstance(code_owner_approval_required, bool):
            raise TypeError("Expected argument 'code_owner_approval_required' to be a bool")
        pulumi.set(__self__, "code_owner_approval_required", code_owner_approval_required)
        if id and not isinstance(id, int):
            raise TypeError("Expected argument 'id' to be a int")
        pulumi.set(__self__, "id", id)
        if merge_access_levels and not isinstance(merge_access_levels, list):
            raise TypeError("Expected argument 'merge_access_levels' to be a list")
        pulumi.set(__self__, "merge_access_levels", merge_access_levels)
        if name and not isinstance(name, str):
            raise TypeError("Expected argument 'name' to be a str")
        pulumi.set(__self__, "name", name)
        if project_id and not isinstance(project_id, str):
            raise TypeError("Expected argument 'project_id' to be a str")
        pulumi.set(__self__, "project_id", project_id)
        if push_access_levels and not isinstance(push_access_levels, list):
            raise TypeError("Expected argument 'push_access_levels' to be a list")
        pulumi.set(__self__, "push_access_levels", push_access_levels)

    @property
    @pulumi.getter(name="allowForcePush")
    def allow_force_push(self) -> bool:
        return pulumi.get(self, "allow_force_push")

    @property
    @pulumi.getter(name="codeOwnerApprovalRequired")
    def code_owner_approval_required(self) -> bool:
        return pulumi.get(self, "code_owner_approval_required")

    @property
    @pulumi.getter
    def id(self) -> int:
        return pulumi.get(self, "id")

    @property
    @pulumi.getter(name="mergeAccessLevels")
    def merge_access_levels(self) -> Sequence['outputs.GetProjectProtectedBranchMergeAccessLevelResult']:
        return pulumi.get(self, "merge_access_levels")

    @property
    @pulumi.getter
    def name(self) -> str:
        return pulumi.get(self, "name")

    @property
    @pulumi.getter(name="projectId")
    def project_id(self) -> str:
        return pulumi.get(self, "project_id")

    @property
    @pulumi.getter(name="pushAccessLevels")
    def push_access_levels(self) -> Sequence['outputs.GetProjectProtectedBranchPushAccessLevelResult']:
        return pulumi.get(self, "push_access_levels")


class AwaitableGetProjectProtectedBranchResult(GetProjectProtectedBranchResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetProjectProtectedBranchResult(
            allow_force_push=self.allow_force_push,
            code_owner_approval_required=self.code_owner_approval_required,
            id=self.id,
            merge_access_levels=self.merge_access_levels,
            name=self.name,
            project_id=self.project_id,
            push_access_levels=self.push_access_levels)


def get_project_protected_branch(name: Optional[str] = None,
                                 project_id: Optional[str] = None,
                                 opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetProjectProtectedBranchResult:
    """
    The `gitlab_protected_branch` 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](https://docs.gitlab.com/ee/api/protected_branches.html#get-a-single-protected-branch-or-wildcard-protected-branch)

    ## Example Usage

    ```python
    import pulumi
    import pulumi_gitlab as gitlab

    example = gitlab.get_project_protected_branch(name="main",
        project_id="foo/bar/baz")
    ```
    """
    __args__ = dict()
    __args__['name'] = name
    __args__['projectId'] = project_id
    if opts is None:
        opts = pulumi.InvokeOptions()
    if opts.version is None:
        opts.version = _utilities.get_version()
    __ret__ = pulumi.runtime.invoke('gitlab:index/getProjectProtectedBranch:getProjectProtectedBranch', __args__, opts=opts, typ=GetProjectProtectedBranchResult).value

    return AwaitableGetProjectProtectedBranchResult(
        allow_force_push=__ret__.allow_force_push,
        code_owner_approval_required=__ret__.code_owner_approval_required,
        id=__ret__.id,
        merge_access_levels=__ret__.merge_access_levels,
        name=__ret__.name,
        project_id=__ret__.project_id,
        push_access_levels=__ret__.push_access_levels)


@_utilities.lift_output_func(get_project_protected_branch)
def get_project_protected_branch_output(name: Optional[pulumi.Input[str]] = None,
                                        project_id: Optional[pulumi.Input[str]] = None,
                                        opts: Optional[pulumi.InvokeOptions] = None) -> pulumi.Output[GetProjectProtectedBranchResult]:
    """
    The `gitlab_protected_branch` 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](https://docs.gitlab.com/ee/api/protected_branches.html#get-a-single-protected-branch-or-wildcard-protected-branch)

    ## Example Usage

    ```python
    import pulumi
    import pulumi_gitlab as gitlab

    example = gitlab.get_project_protected_branch(name="main",
        project_id="foo/bar/baz")
    ```
    """
    ...
