# 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

__all__ = [
    'GetDsyncGroupsResult',
    'AwaitableGetDsyncGroupsResult',
    'get_dsync_groups',
    'get_dsync_groups_output',
]

@pulumi.output_type
class GetDsyncGroupsResult:
    """
    A collection of values returned by getDsyncGroups.
    """
    def __init__(__self__, id=None, lists=None, map=None, team_id=None):
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if lists and not isinstance(lists, list):
            raise TypeError("Expected argument 'lists' to be a list")
        pulumi.set(__self__, "lists", lists)
        if map and not isinstance(map, dict):
            raise TypeError("Expected argument 'map' to be a dict")
        pulumi.set(__self__, "map", map)
        if team_id and not isinstance(team_id, str):
            raise TypeError("Expected argument 'team_id' to be a str")
        pulumi.set(__self__, "team_id", team_id)

    @_builtins.property
    @pulumi.getter
    def id(self) -> _builtins.str:
        """
        The provider-assigned unique ID for this managed resource.
        """
        return pulumi.get(self, "id")

    @_builtins.property
    @pulumi.getter
    def lists(self) -> Sequence['outputs.GetDsyncGroupsListResult']:
        """
        A list of DSync groups for the team.
        """
        return pulumi.get(self, "lists")

    @_builtins.property
    @pulumi.getter
    def map(self) -> Mapping[str, _builtins.str]:
        """
        A map of Identity Provider group names to their Vercel IDs. This can be used to look up the ID of a group by its name using the lookup function.
        """
        return pulumi.get(self, "map")

    @_builtins.property
    @pulumi.getter(name="teamId")
    def team_id(self) -> _builtins.str:
        """
        The ID of the team the Dsync Groups are associated to. Required when configuring a team resource if a default team has not been set in the provider.
        """
        return pulumi.get(self, "team_id")


class AwaitableGetDsyncGroupsResult(GetDsyncGroupsResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetDsyncGroupsResult(
            id=self.id,
            lists=self.lists,
            map=self.map,
            team_id=self.team_id)


def get_dsync_groups(team_id: Optional[_builtins.str] = None,
                     opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetDsyncGroupsResult:
    """
    Provides information about DSync groups for a team.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_std as std
    import pulumi_vercel as vercel
    import pulumiverse_vercel as vercel

    example = vercel.get_dsync_groups(team_id="team_xxxxxxxxxxxxxxxxxxxxxxxxxxxx")
    contractor = vercel.AccessGroup("contractor",
        team_id="team_xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        name="contractor",
        description="Access group for contractors")
    example_team_config = vercel.TeamConfig("example",
        id="team_xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        saml={
            "enforced": True,
            "roles": {
                std.index.lookup(map=example_vercel_dsync_groups["map"],
                    key="admin")["result"]: {
                    "role": "OWNER",
                },
                std.index.lookup(map=example_vercel_dsync_groups["map"],
                    key="finance")["result"]: {
                    "role": "BILLING",
                },
                std.index.lookup(map=example_vercel_dsync_groups["map"],
                    key="contractor")["result"]: {
                    "role": "CONTRIBUTOR",
                    "accessGroupId": contractor.id,
                },
            },
        })
    ```


    :param _builtins.str team_id: The ID of the team the Dsync Groups are associated to. Required when configuring a team resource if a default team has not been set in the provider.
    """
    __args__ = dict()
    __args__['teamId'] = team_id
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('vercel:index/getDsyncGroups:getDsyncGroups', __args__, opts=opts, typ=GetDsyncGroupsResult).value

    return AwaitableGetDsyncGroupsResult(
        id=pulumi.get(__ret__, 'id'),
        lists=pulumi.get(__ret__, 'lists'),
        map=pulumi.get(__ret__, 'map'),
        team_id=pulumi.get(__ret__, 'team_id'))
def get_dsync_groups_output(team_id: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                            opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetDsyncGroupsResult]:
    """
    Provides information about DSync groups for a team.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_std as std
    import pulumi_vercel as vercel
    import pulumiverse_vercel as vercel

    example = vercel.get_dsync_groups(team_id="team_xxxxxxxxxxxxxxxxxxxxxxxxxxxx")
    contractor = vercel.AccessGroup("contractor",
        team_id="team_xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        name="contractor",
        description="Access group for contractors")
    example_team_config = vercel.TeamConfig("example",
        id="team_xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        saml={
            "enforced": True,
            "roles": {
                std.index.lookup(map=example_vercel_dsync_groups["map"],
                    key="admin")["result"]: {
                    "role": "OWNER",
                },
                std.index.lookup(map=example_vercel_dsync_groups["map"],
                    key="finance")["result"]: {
                    "role": "BILLING",
                },
                std.index.lookup(map=example_vercel_dsync_groups["map"],
                    key="contractor")["result"]: {
                    "role": "CONTRIBUTOR",
                    "accessGroupId": contractor.id,
                },
            },
        })
    ```


    :param _builtins.str team_id: The ID of the team the Dsync Groups are associated to. Required when configuring a team resource if a default team has not been set in the provider.
    """
    __args__ = dict()
    __args__['teamId'] = team_id
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('vercel:index/getDsyncGroups:getDsyncGroups', __args__, opts=opts, typ=GetDsyncGroupsResult)
    return __ret__.apply(lambda __response__: GetDsyncGroupsResult(
        id=pulumi.get(__response__, 'id'),
        lists=pulumi.get(__response__, 'lists'),
        map=pulumi.get(__response__, 'map'),
        team_id=pulumi.get(__response__, 'team_id')))
