# 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
from ._inputs import *

__all__ = ['DatabaseArgs', 'Database']

@pulumi.input_type
class DatabaseArgs:
    def __init__(__self__, *,
                 instance_id: pulumi.Input[builtins.str],
                 name: pulumi.Input[builtins.str],
                 character_set_name: Optional[pulumi.Input[builtins.str]] = None,
                 database_privileges: Optional[pulumi.Input[Sequence[pulumi.Input['DatabaseDatabasePrivilegeArgs']]]] = None,
                 description: Optional[pulumi.Input[builtins.str]] = None):
        """
        The set of arguments for constructing a Database resource.
        :param pulumi.Input[builtins.str] instance_id: 数据库实例 ID。
        :param pulumi.Input[builtins.str] name: 数据库名称。命名规则如下：名称唯一。长度为 2~64 个字符。以字母开头，以字母或数字结尾。由字母、数字、下划线（_）或中划线（-）组成。不能使用某些预留字，包括 root、admin 等。
        :param pulumi.Input[builtins.str] character_set_name: 数据库字符集。目前支持的字符集包含：utf8、utf8mb4（默认）、latin1、ascii。
        :param pulumi.Input[builtins.str] description: 数据库的描述信息，长度不超过 256 个字符。该字段可选，若不设置该字段，或设置了该字段但描述信息长度为 0 ，则描述信息为空。
        """
        pulumi.set(__self__, "instance_id", instance_id)
        pulumi.set(__self__, "name", name)
        if character_set_name is not None:
            pulumi.set(__self__, "character_set_name", character_set_name)
        if database_privileges is not None:
            pulumi.set(__self__, "database_privileges", database_privileges)
        if description is not None:
            pulumi.set(__self__, "description", description)

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

    @instance_id.setter
    def instance_id(self, value: pulumi.Input[builtins.str]):
        pulumi.set(self, "instance_id", value)

    @property
    @pulumi.getter
    def name(self) -> pulumi.Input[builtins.str]:
        """
        数据库名称。命名规则如下：名称唯一。长度为 2~64 个字符。以字母开头，以字母或数字结尾。由字母、数字、下划线（_）或中划线（-）组成。不能使用某些预留字，包括 root、admin 等。
        """
        return pulumi.get(self, "name")

    @name.setter
    def name(self, value: pulumi.Input[builtins.str]):
        pulumi.set(self, "name", value)

    @property
    @pulumi.getter(name="characterSetName")
    def character_set_name(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        数据库字符集。目前支持的字符集包含：utf8、utf8mb4（默认）、latin1、ascii。
        """
        return pulumi.get(self, "character_set_name")

    @character_set_name.setter
    def character_set_name(self, value: Optional[pulumi.Input[builtins.str]]):
        pulumi.set(self, "character_set_name", value)

    @property
    @pulumi.getter(name="databasePrivileges")
    def database_privileges(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['DatabaseDatabasePrivilegeArgs']]]]:
        return pulumi.get(self, "database_privileges")

    @database_privileges.setter
    def database_privileges(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['DatabaseDatabasePrivilegeArgs']]]]):
        pulumi.set(self, "database_privileges", value)

    @property
    @pulumi.getter
    def description(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        数据库的描述信息，长度不超过 256 个字符。该字段可选，若不设置该字段，或设置了该字段但描述信息长度为 0 ，则描述信息为空。
        """
        return pulumi.get(self, "description")

    @description.setter
    def description(self, value: Optional[pulumi.Input[builtins.str]]):
        pulumi.set(self, "description", value)


@pulumi.input_type
class _DatabaseState:
    def __init__(__self__, *,
                 character_set_name: Optional[pulumi.Input[builtins.str]] = None,
                 database_privileges: Optional[pulumi.Input[Sequence[pulumi.Input['DatabaseDatabasePrivilegeArgs']]]] = None,
                 description: Optional[pulumi.Input[builtins.str]] = None,
                 instance_id: Optional[pulumi.Input[builtins.str]] = None,
                 name: Optional[pulumi.Input[builtins.str]] = None,
                 status: Optional[pulumi.Input[builtins.str]] = None):
        """
        Input properties used for looking up and filtering Database resources.
        :param pulumi.Input[builtins.str] character_set_name: 数据库字符集。目前支持的字符集包含：utf8、utf8mb4（默认）、latin1、ascii。
        :param pulumi.Input[builtins.str] description: 数据库的描述信息，长度不超过 256 个字符。该字段可选，若不设置该字段，或设置了该字段但描述信息长度为 0 ，则描述信息为空。
        :param pulumi.Input[builtins.str] instance_id: 数据库实例 ID。
        :param pulumi.Input[builtins.str] name: 数据库名称。命名规则如下：名称唯一。长度为 2~64 个字符。以字母开头，以字母或数字结尾。由字母、数字、下划线（_）或中划线（-）组成。不能使用某些预留字，包括 root、admin 等。
        :param pulumi.Input[builtins.str] status: 数据库状态。取值为：Unavailable：不可用。Available：可用。
        """
        if character_set_name is not None:
            pulumi.set(__self__, "character_set_name", character_set_name)
        if database_privileges is not None:
            pulumi.set(__self__, "database_privileges", database_privileges)
        if description is not None:
            pulumi.set(__self__, "description", description)
        if instance_id is not None:
            pulumi.set(__self__, "instance_id", instance_id)
        if name is not None:
            pulumi.set(__self__, "name", name)
        if status is not None:
            pulumi.set(__self__, "status", status)

    @property
    @pulumi.getter(name="characterSetName")
    def character_set_name(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        数据库字符集。目前支持的字符集包含：utf8、utf8mb4（默认）、latin1、ascii。
        """
        return pulumi.get(self, "character_set_name")

    @character_set_name.setter
    def character_set_name(self, value: Optional[pulumi.Input[builtins.str]]):
        pulumi.set(self, "character_set_name", value)

    @property
    @pulumi.getter(name="databasePrivileges")
    def database_privileges(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['DatabaseDatabasePrivilegeArgs']]]]:
        return pulumi.get(self, "database_privileges")

    @database_privileges.setter
    def database_privileges(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['DatabaseDatabasePrivilegeArgs']]]]):
        pulumi.set(self, "database_privileges", value)

    @property
    @pulumi.getter
    def description(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        数据库的描述信息，长度不超过 256 个字符。该字段可选，若不设置该字段，或设置了该字段但描述信息长度为 0 ，则描述信息为空。
        """
        return pulumi.get(self, "description")

    @description.setter
    def description(self, value: Optional[pulumi.Input[builtins.str]]):
        pulumi.set(self, "description", value)

    @property
    @pulumi.getter(name="instanceId")
    def instance_id(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        数据库实例 ID。
        """
        return pulumi.get(self, "instance_id")

    @instance_id.setter
    def instance_id(self, value: Optional[pulumi.Input[builtins.str]]):
        pulumi.set(self, "instance_id", value)

    @property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        数据库名称。命名规则如下：名称唯一。长度为 2~64 个字符。以字母开头，以字母或数字结尾。由字母、数字、下划线（_）或中划线（-）组成。不能使用某些预留字，包括 root、admin 等。
        """
        return pulumi.get(self, "name")

    @name.setter
    def name(self, value: Optional[pulumi.Input[builtins.str]]):
        pulumi.set(self, "name", value)

    @property
    @pulumi.getter
    def status(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        数据库状态。取值为：Unavailable：不可用。Available：可用。
        """
        return pulumi.get(self, "status")

    @status.setter
    def status(self, value: Optional[pulumi.Input[builtins.str]]):
        pulumi.set(self, "status", value)


@pulumi.type_token("bytepluscc:rdsmysql/database:Database")
class Database(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 character_set_name: Optional[pulumi.Input[builtins.str]] = None,
                 database_privileges: Optional[pulumi.Input[Sequence[pulumi.Input[Union['DatabaseDatabasePrivilegeArgs', 'DatabaseDatabasePrivilegeArgsDict']]]]] = None,
                 description: Optional[pulumi.Input[builtins.str]] = None,
                 instance_id: Optional[pulumi.Input[builtins.str]] = None,
                 name: Optional[pulumi.Input[builtins.str]] = None,
                 __props__=None):
        """
        数据库

        ## Import

        ```sh
        $ pulumi import bytepluscc:rdsmysql/database:Database example "instance_id|name"
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[builtins.str] character_set_name: 数据库字符集。目前支持的字符集包含：utf8、utf8mb4（默认）、latin1、ascii。
        :param pulumi.Input[builtins.str] description: 数据库的描述信息，长度不超过 256 个字符。该字段可选，若不设置该字段，或设置了该字段但描述信息长度为 0 ，则描述信息为空。
        :param pulumi.Input[builtins.str] instance_id: 数据库实例 ID。
        :param pulumi.Input[builtins.str] name: 数据库名称。命名规则如下：名称唯一。长度为 2~64 个字符。以字母开头，以字母或数字结尾。由字母、数字、下划线（_）或中划线（-）组成。不能使用某些预留字，包括 root、admin 等。
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: DatabaseArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        数据库

        ## Import

        ```sh
        $ pulumi import bytepluscc:rdsmysql/database:Database example "instance_id|name"
        ```

        :param str resource_name: The name of the resource.
        :param DatabaseArgs args: The arguments to use to populate this resource's properties.
        :param pulumi.ResourceOptions opts: Options for the resource.
        """
        ...
    def __init__(__self__, resource_name: str, *args, **kwargs):
        resource_args, opts = _utilities.get_resource_args_opts(DatabaseArgs, pulumi.ResourceOptions, *args, **kwargs)
        if resource_args is not None:
            __self__._internal_init(resource_name, opts, **resource_args.__dict__)
        else:
            __self__._internal_init(resource_name, *args, **kwargs)

    def _internal_init(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 character_set_name: Optional[pulumi.Input[builtins.str]] = None,
                 database_privileges: Optional[pulumi.Input[Sequence[pulumi.Input[Union['DatabaseDatabasePrivilegeArgs', 'DatabaseDatabasePrivilegeArgsDict']]]]] = None,
                 description: Optional[pulumi.Input[builtins.str]] = None,
                 instance_id: Optional[pulumi.Input[builtins.str]] = None,
                 name: Optional[pulumi.Input[builtins.str]] = None,
                 __props__=None):
        opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.id is None:
            if __props__ is not None:
                raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
            __props__ = DatabaseArgs.__new__(DatabaseArgs)

            __props__.__dict__["character_set_name"] = character_set_name
            __props__.__dict__["database_privileges"] = database_privileges
            __props__.__dict__["description"] = description
            if instance_id is None and not opts.urn:
                raise TypeError("Missing required property 'instance_id'")
            __props__.__dict__["instance_id"] = instance_id
            if name is None and not opts.urn:
                raise TypeError("Missing required property 'name'")
            __props__.__dict__["name"] = name
            __props__.__dict__["status"] = None
        super(Database, __self__).__init__(
            'bytepluscc:rdsmysql/database:Database',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            character_set_name: Optional[pulumi.Input[builtins.str]] = None,
            database_privileges: Optional[pulumi.Input[Sequence[pulumi.Input[Union['DatabaseDatabasePrivilegeArgs', 'DatabaseDatabasePrivilegeArgsDict']]]]] = None,
            description: Optional[pulumi.Input[builtins.str]] = None,
            instance_id: Optional[pulumi.Input[builtins.str]] = None,
            name: Optional[pulumi.Input[builtins.str]] = None,
            status: Optional[pulumi.Input[builtins.str]] = None) -> 'Database':
        """
        Get an existing Database resource's state with the given name, id, and optional extra
        properties used to qualify the lookup.

        :param str resource_name: The unique name of the resulting resource.
        :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[builtins.str] character_set_name: 数据库字符集。目前支持的字符集包含：utf8、utf8mb4（默认）、latin1、ascii。
        :param pulumi.Input[builtins.str] description: 数据库的描述信息，长度不超过 256 个字符。该字段可选，若不设置该字段，或设置了该字段但描述信息长度为 0 ，则描述信息为空。
        :param pulumi.Input[builtins.str] instance_id: 数据库实例 ID。
        :param pulumi.Input[builtins.str] name: 数据库名称。命名规则如下：名称唯一。长度为 2~64 个字符。以字母开头，以字母或数字结尾。由字母、数字、下划线（_）或中划线（-）组成。不能使用某些预留字，包括 root、admin 等。
        :param pulumi.Input[builtins.str] status: 数据库状态。取值为：Unavailable：不可用。Available：可用。
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _DatabaseState.__new__(_DatabaseState)

        __props__.__dict__["character_set_name"] = character_set_name
        __props__.__dict__["database_privileges"] = database_privileges
        __props__.__dict__["description"] = description
        __props__.__dict__["instance_id"] = instance_id
        __props__.__dict__["name"] = name
        __props__.__dict__["status"] = status
        return Database(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="characterSetName")
    def character_set_name(self) -> pulumi.Output[builtins.str]:
        """
        数据库字符集。目前支持的字符集包含：utf8、utf8mb4（默认）、latin1、ascii。
        """
        return pulumi.get(self, "character_set_name")

    @property
    @pulumi.getter(name="databasePrivileges")
    def database_privileges(self) -> pulumi.Output[Sequence['outputs.DatabaseDatabasePrivilege']]:
        return pulumi.get(self, "database_privileges")

    @property
    @pulumi.getter
    def description(self) -> pulumi.Output[builtins.str]:
        """
        数据库的描述信息，长度不超过 256 个字符。该字段可选，若不设置该字段，或设置了该字段但描述信息长度为 0 ，则描述信息为空。
        """
        return pulumi.get(self, "description")

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

    @property
    @pulumi.getter
    def name(self) -> pulumi.Output[builtins.str]:
        """
        数据库名称。命名规则如下：名称唯一。长度为 2~64 个字符。以字母开头，以字母或数字结尾。由字母、数字、下划线（_）或中划线（-）组成。不能使用某些预留字，包括 root、admin 等。
        """
        return pulumi.get(self, "name")

    @property
    @pulumi.getter
    def status(self) -> pulumi.Output[builtins.str]:
        """
        数据库状态。取值为：Unavailable：不可用。Available：可用。
        """
        return pulumi.get(self, "status")

