# 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__ = [
    'GetGroupServiceAccountAccessTokensResult',
    'AwaitableGetGroupServiceAccountAccessTokensResult',
    'get_group_service_account_access_tokens',
    'get_group_service_account_access_tokens_output',
]

@pulumi.output_type
class GetGroupServiceAccountAccessTokensResult:
    """
    A collection of values returned by getGroupServiceAccountAccessTokens.
    """
    def __init__(__self__, access_tokens=None, group=None, id=None, service_account_id=None):
        if access_tokens and not isinstance(access_tokens, list):
            raise TypeError("Expected argument 'access_tokens' to be a list")
        pulumi.set(__self__, "access_tokens", access_tokens)
        if group and not isinstance(group, str):
            raise TypeError("Expected argument 'group' to be a str")
        pulumi.set(__self__, "group", group)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if service_account_id and not isinstance(service_account_id, int):
            raise TypeError("Expected argument 'service_account_id' to be a int")
        pulumi.set(__self__, "service_account_id", service_account_id)

    @_builtins.property
    @pulumi.getter(name="accessTokens")
    def access_tokens(self) -> Sequence['outputs.GetGroupServiceAccountAccessTokensAccessTokenResult']:
        """
        The list of access tokens for the service account.
        """
        return pulumi.get(self, "access_tokens")

    @_builtins.property
    @pulumi.getter
    def group(self) -> _builtins.str:
        """
        The ID or URL-encoded path of the group containing the service account. Must be a top level group.
        """
        return pulumi.get(self, "group")

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

    @_builtins.property
    @pulumi.getter(name="serviceAccountId")
    def service_account_id(self) -> _builtins.int:
        """
        The ID of the service account user.
        """
        return pulumi.get(self, "service_account_id")


class AwaitableGetGroupServiceAccountAccessTokensResult(GetGroupServiceAccountAccessTokensResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetGroupServiceAccountAccessTokensResult(
            access_tokens=self.access_tokens,
            group=self.group,
            id=self.id,
            service_account_id=self.service_account_id)


def get_group_service_account_access_tokens(group: Optional[_builtins.str] = None,
                                            service_account_id: Optional[_builtins.int] = None,
                                            opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetGroupServiceAccountAccessTokensResult:
    """
    The `get_group_service_account_access_tokens` data source allows to retrieve all access tokens for a group service account.

    > **Note:** The data source returns the token metadata only. The token value is not available.

    > **Permissions:** You must have administrator access or be an Owner of the group to list the tokens of a service account.

    **Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/api/personal_access_tokens/#list-all-personal-access-tokens)


    :param _builtins.str group: The ID or URL-encoded path of the group containing the service account. Must be a top level group.
    :param _builtins.int service_account_id: The ID of the service account user.
    """
    __args__ = dict()
    __args__['group'] = group
    __args__['serviceAccountId'] = service_account_id
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('gitlab:index/getGroupServiceAccountAccessTokens:getGroupServiceAccountAccessTokens', __args__, opts=opts, typ=GetGroupServiceAccountAccessTokensResult).value

    return AwaitableGetGroupServiceAccountAccessTokensResult(
        access_tokens=pulumi.get(__ret__, 'access_tokens'),
        group=pulumi.get(__ret__, 'group'),
        id=pulumi.get(__ret__, 'id'),
        service_account_id=pulumi.get(__ret__, 'service_account_id'))
def get_group_service_account_access_tokens_output(group: Optional[pulumi.Input[_builtins.str]] = None,
                                                   service_account_id: Optional[pulumi.Input[_builtins.int]] = None,
                                                   opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetGroupServiceAccountAccessTokensResult]:
    """
    The `get_group_service_account_access_tokens` data source allows to retrieve all access tokens for a group service account.

    > **Note:** The data source returns the token metadata only. The token value is not available.

    > **Permissions:** You must have administrator access or be an Owner of the group to list the tokens of a service account.

    **Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/api/personal_access_tokens/#list-all-personal-access-tokens)


    :param _builtins.str group: The ID or URL-encoded path of the group containing the service account. Must be a top level group.
    :param _builtins.int service_account_id: The ID of the service account user.
    """
    __args__ = dict()
    __args__['group'] = group
    __args__['serviceAccountId'] = service_account_id
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('gitlab:index/getGroupServiceAccountAccessTokens:getGroupServiceAccountAccessTokens', __args__, opts=opts, typ=GetGroupServiceAccountAccessTokensResult)
    return __ret__.apply(lambda __response__: GetGroupServiceAccountAccessTokensResult(
        access_tokens=pulumi.get(__response__, 'access_tokens'),
        group=pulumi.get(__response__, 'group'),
        id=pulumi.get(__response__, 'id'),
        service_account_id=pulumi.get(__response__, 'service_account_id')))
