# 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 copy
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

__all__ = [
    'GetInstanceServiceAccountResult',
    'AwaitableGetInstanceServiceAccountResult',
    'get_instance_service_account',
    'get_instance_service_account_output',
]

@pulumi.output_type
class GetInstanceServiceAccountResult:
    """
    A collection of values returned by getInstanceServiceAccount.
    """
    def __init__(__self__, id=None, name=None, service_account_id=None, username=None):
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if name and not isinstance(name, str):
            raise TypeError("Expected argument 'name' to be a str")
        pulumi.set(__self__, "name", name)
        if service_account_id and not isinstance(service_account_id, str):
            raise TypeError("Expected argument 'service_account_id' to be a str")
        pulumi.set(__self__, "service_account_id", service_account_id)
        if username and not isinstance(username, str):
            raise TypeError("Expected argument 'username' to be a str")
        pulumi.set(__self__, "username", username)

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

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

    @property
    @pulumi.getter(name="serviceAccountId")
    def service_account_id(self) -> str:
        """
        The service account id.
        """
        return pulumi.get(self, "service_account_id")

    @property
    @pulumi.getter
    def username(self) -> str:
        """
        The username of the user.
        """
        return pulumi.get(self, "username")


class AwaitableGetInstanceServiceAccountResult(GetInstanceServiceAccountResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetInstanceServiceAccountResult(
            id=self.id,
            name=self.name,
            service_account_id=self.service_account_id,
            username=self.username)


def get_instance_service_account(service_account_id: Optional[str] = None,
                                 opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetInstanceServiceAccountResult:
    """
    The `InstanceServiceAccount` data source retrieves information about a gitlab service account.

    > In order for a user to create a user account, they must have admin privileges at the instance level. This makes this feature unavailable on `gitlab.com`

    **Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/api/user_service_accounts/)

    ## Example Usage

    ```python
    import pulumi
    import pulumi_gitlab as gitlab

    example = gitlab.get_instance_service_account(service_account_id="123")
    ```


    :param str service_account_id: The service account id.
    """
    __args__ = dict()
    __args__['serviceAccountId'] = service_account_id
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('gitlab:index/getInstanceServiceAccount:getInstanceServiceAccount', __args__, opts=opts, typ=GetInstanceServiceAccountResult).value

    return AwaitableGetInstanceServiceAccountResult(
        id=pulumi.get(__ret__, 'id'),
        name=pulumi.get(__ret__, 'name'),
        service_account_id=pulumi.get(__ret__, 'service_account_id'),
        username=pulumi.get(__ret__, 'username'))
def get_instance_service_account_output(service_account_id: Optional[pulumi.Input[str]] = None,
                                        opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetInstanceServiceAccountResult]:
    """
    The `InstanceServiceAccount` data source retrieves information about a gitlab service account.

    > In order for a user to create a user account, they must have admin privileges at the instance level. This makes this feature unavailable on `gitlab.com`

    **Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/api/user_service_accounts/)

    ## Example Usage

    ```python
    import pulumi
    import pulumi_gitlab as gitlab

    example = gitlab.get_instance_service_account(service_account_id="123")
    ```


    :param str service_account_id: The service account id.
    """
    __args__ = dict()
    __args__['serviceAccountId'] = service_account_id
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('gitlab:index/getInstanceServiceAccount:getInstanceServiceAccount', __args__, opts=opts, typ=GetInstanceServiceAccountResult)
    return __ret__.apply(lambda __response__: GetInstanceServiceAccountResult(
        id=pulumi.get(__response__, 'id'),
        name=pulumi.get(__response__, 'name'),
        service_account_id=pulumi.get(__response__, 'service_account_id'),
        username=pulumi.get(__response__, 'username')))
