# 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 builtins
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
from . import outputs

__all__ = [
    'GetDbAccountResult',
    'AwaitableGetDbAccountResult',
    'get_db_account',
    'get_db_account_output',
]

@pulumi.output_type
class GetDbAccountResult:
    """
    A collection of values returned by getDbAccount.
    """
    def __init__(__self__, account_desc=None, account_name=None, account_password=None, account_privileges=None, account_privileges_sqls=None, account_status=None, account_type=None, has_table_column_privilege_db_names=None, host=None, id=None, instance_id=None, table_column_privileges=None):
        if account_desc and not isinstance(account_desc, str):
            raise TypeError("Expected argument 'account_desc' to be a str")
        pulumi.set(__self__, "account_desc", account_desc)
        if account_name and not isinstance(account_name, str):
            raise TypeError("Expected argument 'account_name' to be a str")
        pulumi.set(__self__, "account_name", account_name)
        if account_password and not isinstance(account_password, str):
            raise TypeError("Expected argument 'account_password' to be a str")
        pulumi.set(__self__, "account_password", account_password)
        if account_privileges and not isinstance(account_privileges, list):
            raise TypeError("Expected argument 'account_privileges' to be a list")
        pulumi.set(__self__, "account_privileges", account_privileges)
        if account_privileges_sqls and not isinstance(account_privileges_sqls, list):
            raise TypeError("Expected argument 'account_privileges_sqls' to be a list")
        pulumi.set(__self__, "account_privileges_sqls", account_privileges_sqls)
        if account_status and not isinstance(account_status, str):
            raise TypeError("Expected argument 'account_status' to be a str")
        pulumi.set(__self__, "account_status", account_status)
        if account_type and not isinstance(account_type, str):
            raise TypeError("Expected argument 'account_type' to be a str")
        pulumi.set(__self__, "account_type", account_type)
        if has_table_column_privilege_db_names and not isinstance(has_table_column_privilege_db_names, list):
            raise TypeError("Expected argument 'has_table_column_privilege_db_names' to be a list")
        pulumi.set(__self__, "has_table_column_privilege_db_names", has_table_column_privilege_db_names)
        if host and not isinstance(host, str):
            raise TypeError("Expected argument 'host' to be a str")
        pulumi.set(__self__, "host", host)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if instance_id and not isinstance(instance_id, str):
            raise TypeError("Expected argument 'instance_id' to be a str")
        pulumi.set(__self__, "instance_id", instance_id)
        if table_column_privileges and not isinstance(table_column_privileges, list):
            raise TypeError("Expected argument 'table_column_privileges' to be a list")
        pulumi.set(__self__, "table_column_privileges", table_column_privileges)

    @property
    @pulumi.getter(name="accountDesc")
    def account_desc(self) -> builtins.str:
        """
        账号信息描述信息，长度不超过 256 个字符。
        """
        return pulumi.get(self, "account_desc")

    @property
    @pulumi.getter(name="accountName")
    def account_name(self) -> builtins.str:
        """
        数据库账号名称。命名规则如下：长度为 2~32 个字符。以字母开头，以字母或数字结尾。由字母、数字、下划线（_）和中划线（-）组成。账号名称在实例内必须是唯一的。不能使用某些预留字，被禁用的预留字请参见禁用词列表。说明在高权限账号名称中可使用关键字 root 和 admin。
        """
        return pulumi.get(self, "account_name")

    @property
    @pulumi.getter(name="accountPassword")
    def account_password(self) -> builtins.str:
        """
        数据库账号的密码。规则如下：长度为 8~32 个字符。由大写字母、小写字母、数字、特殊字符中的至少三种组成。特殊字符为 !@#$%^&*()_+-=,.&?|/。
        """
        return pulumi.get(self, "account_password")

    @property
    @pulumi.getter(name="accountPrivileges")
    def account_privileges(self) -> Sequence['outputs.GetDbAccountAccountPrivilegeResult']:
        """
        账号的指定数据库权限信息。说明当 AccountType 取值为 Super 时，无需为 AccountPrivileges 传值
        """
        return pulumi.get(self, "account_privileges")

    @property
    @pulumi.getter(name="accountPrivilegesSqls")
    def account_privileges_sqls(self) -> Sequence[builtins.str]:
        """
        账号的指定数据库权限信息的 SQL 语句。
        """
        return pulumi.get(self, "account_privileges_sqls")

    @property
    @pulumi.getter(name="accountStatus")
    def account_status(self) -> builtins.str:
        """
        账号状态，取值为：Unavailable：不可用。Available：可用。
        """
        return pulumi.get(self, "account_status")

    @property
    @pulumi.getter(name="accountType")
    def account_type(self) -> builtins.str:
        """
        账号类型，取值范围：Super：高权限账号。Normal：普通账号。
        """
        return pulumi.get(self, "account_type")

    @property
    @pulumi.getter(name="hasTableColumnPrivilegeDbNames")
    def has_table_column_privilege_db_names(self) -> Sequence[builtins.str]:
        """
        账号拥有的表列权限所属的数据库。说明如果账号没有表列权限，则不返回该字段。
        """
        return pulumi.get(self, "has_table_column_privilege_db_names")

    @property
    @pulumi.getter
    def host(self) -> builtins.str:
        """
        指定的数据库账号可以访问数据库的 IP 地址。
        """
        return pulumi.get(self, "host")

    @property
    @pulumi.getter
    def id(self) -> builtins.str:
        """
        Uniquely identifies the resource.
        """
        return pulumi.get(self, "id")

    @property
    @pulumi.getter(name="instanceId")
    def instance_id(self) -> builtins.str:
        """
        实例 ID。
        """
        return pulumi.get(self, "instance_id")

    @property
    @pulumi.getter(name="tableColumnPrivileges")
    def table_column_privileges(self) -> Sequence['outputs.GetDbAccountTableColumnPrivilegeResult']:
        """
        账号的表列权限设置。
        """
        return pulumi.get(self, "table_column_privileges")


class AwaitableGetDbAccountResult(GetDbAccountResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetDbAccountResult(
            account_desc=self.account_desc,
            account_name=self.account_name,
            account_password=self.account_password,
            account_privileges=self.account_privileges,
            account_privileges_sqls=self.account_privileges_sqls,
            account_status=self.account_status,
            account_type=self.account_type,
            has_table_column_privilege_db_names=self.has_table_column_privilege_db_names,
            host=self.host,
            id=self.id,
            instance_id=self.instance_id,
            table_column_privileges=self.table_column_privileges)


def get_db_account(id: Optional[builtins.str] = None,
                   opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetDbAccountResult:
    """
    Data Source schema for Byteplus::RDSMySQL::DBAccount


    :param builtins.str id: Uniquely identifies the resource.
    """
    __args__ = dict()
    __args__['id'] = id
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('bytepluscc:rdsmysql/getDbAccount:getDbAccount', __args__, opts=opts, typ=GetDbAccountResult).value

    return AwaitableGetDbAccountResult(
        account_desc=pulumi.get(__ret__, 'account_desc'),
        account_name=pulumi.get(__ret__, 'account_name'),
        account_password=pulumi.get(__ret__, 'account_password'),
        account_privileges=pulumi.get(__ret__, 'account_privileges'),
        account_privileges_sqls=pulumi.get(__ret__, 'account_privileges_sqls'),
        account_status=pulumi.get(__ret__, 'account_status'),
        account_type=pulumi.get(__ret__, 'account_type'),
        has_table_column_privilege_db_names=pulumi.get(__ret__, 'has_table_column_privilege_db_names'),
        host=pulumi.get(__ret__, 'host'),
        id=pulumi.get(__ret__, 'id'),
        instance_id=pulumi.get(__ret__, 'instance_id'),
        table_column_privileges=pulumi.get(__ret__, 'table_column_privileges'))
def get_db_account_output(id: Optional[pulumi.Input[builtins.str]] = None,
                          opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetDbAccountResult]:
    """
    Data Source schema for Byteplus::RDSMySQL::DBAccount


    :param builtins.str id: Uniquely identifies the resource.
    """
    __args__ = dict()
    __args__['id'] = id
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('bytepluscc:rdsmysql/getDbAccount:getDbAccount', __args__, opts=opts, typ=GetDbAccountResult)
    return __ret__.apply(lambda __response__: GetDbAccountResult(
        account_desc=pulumi.get(__response__, 'account_desc'),
        account_name=pulumi.get(__response__, 'account_name'),
        account_password=pulumi.get(__response__, 'account_password'),
        account_privileges=pulumi.get(__response__, 'account_privileges'),
        account_privileges_sqls=pulumi.get(__response__, 'account_privileges_sqls'),
        account_status=pulumi.get(__response__, 'account_status'),
        account_type=pulumi.get(__response__, 'account_type'),
        has_table_column_privilege_db_names=pulumi.get(__response__, 'has_table_column_privilege_db_names'),
        host=pulumi.get(__response__, 'host'),
        id=pulumi.get(__response__, 'id'),
        instance_id=pulumi.get(__response__, 'instance_id'),
        table_column_privileges=pulumi.get(__response__, 'table_column_privileges')))
