# 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 pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities

__all__ = [
    'GetAzureadUserResult',
    'AwaitableGetAzureadUserResult',
    'get_azuread_user',
    'get_azuread_user_output',
]

@pulumi.output_type
class GetAzureadUserResult:
    """
    A collection of values returned by getAzureadUser.
    """
    def __init__(__self__, database_id=None, id=None, name=None, user_object_id=None):
        if database_id and not isinstance(database_id, str):
            raise TypeError("Expected argument 'database_id' to be a str")
        pulumi.set(__self__, "database_id", database_id)
        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 user_object_id and not isinstance(user_object_id, str):
            raise TypeError("Expected argument 'user_object_id' to be a str")
        pulumi.set(__self__, "user_object_id", user_object_id)

    @property
    @pulumi.getter(name="databaseId")
    def database_id(self) -> str:
        """
        ID of database. Can be retrieved using `Database` or `SELECT DB_ID('<db_name>')`.
        """
        return pulumi.get(self, "database_id")

    @property
    @pulumi.getter
    def id(self) -> str:
        """
        `<database_id>/<user_id>`. User ID can be retrieved using `sys.database_principals` view.
        """
        return pulumi.get(self, "id")

    @property
    @pulumi.getter
    def name(self) -> str:
        """
        User name. Cannot be longer than 128 chars.
        """
        return pulumi.get(self, "name")

    @property
    @pulumi.getter(name="userObjectId")
    def user_object_id(self) -> str:
        """
        Azure AD object_id of the user. This can be either regular user or a group.
        """
        return pulumi.get(self, "user_object_id")


class AwaitableGetAzureadUserResult(GetAzureadUserResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetAzureadUserResult(
            database_id=self.database_id,
            id=self.id,
            name=self.name,
            user_object_id=self.user_object_id)


def get_azuread_user(database_id: Optional[str] = None,
                     name: Optional[str] = None,
                     user_object_id: Optional[str] = None,
                     opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetAzureadUserResult:
    """
    Obtains information about single Azure AD database user.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_mssql as mssql

    example_database = mssql.get_database(name="example")
    example_azuread_user = mssql.get_azuread_user(name="example",
        database_id=example_database.id)
    pulumi.export("userObjectId", example_azuread_user.user_object_id)
    ```


    :param str database_id: ID of database. Can be retrieved using `Database` or `SELECT DB_ID('<db_name>')`.
    :param str name: User name. Cannot be longer than 128 chars.
    :param str user_object_id: Azure AD object_id of the user. This can be either regular user or a group.
    """
    __args__ = dict()
    __args__['databaseId'] = database_id
    __args__['name'] = name
    __args__['userObjectId'] = user_object_id
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('mssql:index/getAzureadUser:getAzureadUser', __args__, opts=opts, typ=GetAzureadUserResult).value

    return AwaitableGetAzureadUserResult(
        database_id=pulumi.get(__ret__, 'database_id'),
        id=pulumi.get(__ret__, 'id'),
        name=pulumi.get(__ret__, 'name'),
        user_object_id=pulumi.get(__ret__, 'user_object_id'))


@_utilities.lift_output_func(get_azuread_user)
def get_azuread_user_output(database_id: Optional[pulumi.Input[str]] = None,
                            name: Optional[pulumi.Input[Optional[str]]] = None,
                            user_object_id: Optional[pulumi.Input[Optional[str]]] = None,
                            opts: Optional[pulumi.InvokeOptions] = None) -> pulumi.Output[GetAzureadUserResult]:
    """
    Obtains information about single Azure AD database user.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_mssql as mssql

    example_database = mssql.get_database(name="example")
    example_azuread_user = mssql.get_azuread_user(name="example",
        database_id=example_database.id)
    pulumi.export("userObjectId", example_azuread_user.user_object_id)
    ```


    :param str database_id: ID of database. Can be retrieved using `Database` or `SELECT DB_ID('<db_name>')`.
    :param str name: User name. Cannot be longer than 128 chars.
    :param str user_object_id: Azure AD object_id of the user. This can be either regular user or a group.
    """
    ...
