# 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__ = [
    'GetSqlLoginResult',
    'AwaitableGetSqlLoginResult',
    'get_sql_login',
    'get_sql_login_output',
]

@pulumi.output_type
class GetSqlLoginResult:
    """
    A collection of values returned by getSqlLogin.
    """
    def __init__(__self__, check_password_expiration=None, check_password_policy=None, default_database_id=None, default_language=None, id=None, must_change_password=None, name=None, principal_id=None):
        if check_password_expiration and not isinstance(check_password_expiration, bool):
            raise TypeError("Expected argument 'check_password_expiration' to be a bool")
        pulumi.set(__self__, "check_password_expiration", check_password_expiration)
        if check_password_policy and not isinstance(check_password_policy, bool):
            raise TypeError("Expected argument 'check_password_policy' to be a bool")
        pulumi.set(__self__, "check_password_policy", check_password_policy)
        if default_database_id and not isinstance(default_database_id, str):
            raise TypeError("Expected argument 'default_database_id' to be a str")
        pulumi.set(__self__, "default_database_id", default_database_id)
        if default_language and not isinstance(default_language, str):
            raise TypeError("Expected argument 'default_language' to be a str")
        pulumi.set(__self__, "default_language", default_language)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if must_change_password and not isinstance(must_change_password, bool):
            raise TypeError("Expected argument 'must_change_password' to be a bool")
        pulumi.set(__self__, "must_change_password", must_change_password)
        if name and not isinstance(name, str):
            raise TypeError("Expected argument 'name' to be a str")
        pulumi.set(__self__, "name", name)
        if principal_id and not isinstance(principal_id, str):
            raise TypeError("Expected argument 'principal_id' to be a str")
        pulumi.set(__self__, "principal_id", principal_id)

    @property
    @pulumi.getter(name="checkPasswordExpiration")
    def check_password_expiration(self) -> bool:
        """
        When `true`, password expiration policy is enforced for this login.
        """
        return pulumi.get(self, "check_password_expiration")

    @property
    @pulumi.getter(name="checkPasswordPolicy")
    def check_password_policy(self) -> bool:
        """
        When `true`, the Windows password policies of the computer on which SQL Server is running are enforced on this login.
        """
        return pulumi.get(self, "check_password_policy")

    @property
    @pulumi.getter(name="defaultDatabaseId")
    def default_database_id(self) -> str:
        """
        ID of login's default DB. The ID can be retrieved using `Database` data resource.
        """
        return pulumi.get(self, "default_database_id")

    @property
    @pulumi.getter(name="defaultLanguage")
    def default_language(self) -> str:
        """
        Default language assigned to login.
        """
        return pulumi.get(self, "default_language")

    @property
    @pulumi.getter
    def id(self) -> str:
        """
        Login SID. Can be retrieved using `SELECT SUSER_SID('<login_name>')`.
        """
        return pulumi.get(self, "id")

    @property
    @pulumi.getter(name="mustChangePassword")
    def must_change_password(self) -> bool:
        """
        When true, password change will be forced on first logon.
        """
        return pulumi.get(self, "must_change_password")

    @property
    @pulumi.getter
    def name(self) -> str:
        """
        Login name. Must follow [Regular Identifiers rules](https://docs.microsoft.com/en-us/sql/relational-databases/databases/database-identifiers#rules-for-regular-identifiers) and cannot contain `\\`
        """
        return pulumi.get(self, "name")

    @property
    @pulumi.getter(name="principalId")
    def principal_id(self) -> str:
        """
        ID used to reference SQL Login in other resources, e.g. `server_role`. Can be retrieved from `sys.sql_logins`.
        """
        return pulumi.get(self, "principal_id")


class AwaitableGetSqlLoginResult(GetSqlLoginResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetSqlLoginResult(
            check_password_expiration=self.check_password_expiration,
            check_password_policy=self.check_password_policy,
            default_database_id=self.default_database_id,
            default_language=self.default_language,
            id=self.id,
            must_change_password=self.must_change_password,
            name=self.name,
            principal_id=self.principal_id)


def get_sql_login(name: Optional[str] = None,
                  opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetSqlLoginResult:
    """
    Obtains information about single SQL login.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_mssql as mssql

    sa = mssql.get_sql_login(name="sa")
    pulumi.export("id", sa.id)
    pulumi.export("dbId", sa.default_database_id)
    ```


    :param str name: Login name. Must follow [Regular Identifiers rules](https://docs.microsoft.com/en-us/sql/relational-databases/databases/database-identifiers#rules-for-regular-identifiers) and cannot contain `\\`
    """
    __args__ = dict()
    __args__['name'] = name
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('mssql:index/getSqlLogin:getSqlLogin', __args__, opts=opts, typ=GetSqlLoginResult).value

    return AwaitableGetSqlLoginResult(
        check_password_expiration=pulumi.get(__ret__, 'check_password_expiration'),
        check_password_policy=pulumi.get(__ret__, 'check_password_policy'),
        default_database_id=pulumi.get(__ret__, 'default_database_id'),
        default_language=pulumi.get(__ret__, 'default_language'),
        id=pulumi.get(__ret__, 'id'),
        must_change_password=pulumi.get(__ret__, 'must_change_password'),
        name=pulumi.get(__ret__, 'name'),
        principal_id=pulumi.get(__ret__, 'principal_id'))


@_utilities.lift_output_func(get_sql_login)
def get_sql_login_output(name: Optional[pulumi.Input[str]] = None,
                         opts: Optional[pulumi.InvokeOptions] = None) -> pulumi.Output[GetSqlLoginResult]:
    """
    Obtains information about single SQL login.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_mssql as mssql

    sa = mssql.get_sql_login(name="sa")
    pulumi.export("id", sa.id)
    pulumi.export("dbId", sa.default_database_id)
    ```


    :param str name: Login name. Must follow [Regular Identifiers rules](https://docs.microsoft.com/en-us/sql/relational-databases/databases/database-identifiers#rules-for-regular-identifiers) and cannot contain `\\`
    """
    ...
