# coding=utf-8
# *** WARNING: this file was generated by pulumi-language-python. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import builtins as _builtins
import warnings
import sys
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
if sys.version_info >= (3, 11):
    from typing import NotRequired, TypedDict, TypeAlias
else:
    from typing_extensions import NotRequired, TypedDict, TypeAlias
from . import _utilities
from . import outputs
from ._inputs import *

__all__ = [
    'GetProjectApprovalRulesResult',
    'AwaitableGetProjectApprovalRulesResult',
    'get_project_approval_rules',
    'get_project_approval_rules_output',
]

@pulumi.output_type
class GetProjectApprovalRulesResult:
    """
    A collection of values returned by getProjectApprovalRules.
    """
    def __init__(__self__, approval_rules=None, id=None, project=None):
        if approval_rules and not isinstance(approval_rules, list):
            raise TypeError("Expected argument 'approval_rules' to be a list")
        pulumi.set(__self__, "approval_rules", approval_rules)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if project and not isinstance(project, str):
            raise TypeError("Expected argument 'project' to be a str")
        pulumi.set(__self__, "project", project)

    @_builtins.property
    @pulumi.getter(name="approvalRules")
    def approval_rules(self) -> Optional[Sequence['outputs.GetProjectApprovalRulesApprovalRuleResult']]:
        """
        A list of project approval rules, as defined below.
        """
        return pulumi.get(self, "approval_rules")

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

    @_builtins.property
    @pulumi.getter
    def project(self) -> _builtins.str:
        """
        The ID or path with namespace that identifies the project.
        """
        return pulumi.get(self, "project")


class AwaitableGetProjectApprovalRulesResult(GetProjectApprovalRulesResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetProjectApprovalRulesResult(
            approval_rules=self.approval_rules,
            id=self.id,
            project=self.project)


def get_project_approval_rules(approval_rules: Optional[Sequence[Union['GetProjectApprovalRulesApprovalRuleArgs', 'GetProjectApprovalRulesApprovalRuleArgsDict']]] = None,
                               project: Optional[_builtins.str] = None,
                               opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetProjectApprovalRulesResult:
    """
    The `get_project_approval_rules` data source retrieves all approval rules of a given project.

    **Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/api/merge_request_approvals/#list-all-approval-rules-for-a-project)

    ## Example Usage

    ```python
    import pulumi
    import pulumi_gitlab as gitlab

    by_project_id = gitlab.get_project_approval_rules(project="12345")
    by_project_path = gitlab.get_project_approval_rules(project="my-group/my-project")
    ```


    :param Sequence[Union['GetProjectApprovalRulesApprovalRuleArgs', 'GetProjectApprovalRulesApprovalRuleArgsDict']] approval_rules: A list of project approval rules, as defined below.
    :param _builtins.str project: The ID or path with namespace that identifies the project.
    """
    __args__ = dict()
    __args__['approvalRules'] = approval_rules
    __args__['project'] = project
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('gitlab:index/getProjectApprovalRules:getProjectApprovalRules', __args__, opts=opts, typ=GetProjectApprovalRulesResult).value

    return AwaitableGetProjectApprovalRulesResult(
        approval_rules=pulumi.get(__ret__, 'approval_rules'),
        id=pulumi.get(__ret__, 'id'),
        project=pulumi.get(__ret__, 'project'))
def get_project_approval_rules_output(approval_rules: Optional[pulumi.Input[Optional[Sequence[Union['GetProjectApprovalRulesApprovalRuleArgs', 'GetProjectApprovalRulesApprovalRuleArgsDict']]]]] = None,
                                      project: Optional[pulumi.Input[_builtins.str]] = None,
                                      opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetProjectApprovalRulesResult]:
    """
    The `get_project_approval_rules` data source retrieves all approval rules of a given project.

    **Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/api/merge_request_approvals/#list-all-approval-rules-for-a-project)

    ## Example Usage

    ```python
    import pulumi
    import pulumi_gitlab as gitlab

    by_project_id = gitlab.get_project_approval_rules(project="12345")
    by_project_path = gitlab.get_project_approval_rules(project="my-group/my-project")
    ```


    :param Sequence[Union['GetProjectApprovalRulesApprovalRuleArgs', 'GetProjectApprovalRulesApprovalRuleArgsDict']] approval_rules: A list of project approval rules, as defined below.
    :param _builtins.str project: The ID or path with namespace that identifies the project.
    """
    __args__ = dict()
    __args__['approvalRules'] = approval_rules
    __args__['project'] = project
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('gitlab:index/getProjectApprovalRules:getProjectApprovalRules', __args__, opts=opts, typ=GetProjectApprovalRulesResult)
    return __ret__.apply(lambda __response__: GetProjectApprovalRulesResult(
        approval_rules=pulumi.get(__response__, 'approval_rules'),
        id=pulumi.get(__response__, 'id'),
        project=pulumi.get(__response__, 'project')))
