# 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

__all__ = ['DatabaseArgs', 'Database']

@pulumi.input_type
class DatabaseArgs:
    def __init__(__self__, *,
                 db_name: pulumi.Input[builtins.str],
                 instance_id: pulumi.Input[builtins.str],
                 c_type: Optional[pulumi.Input[builtins.str]] = None,
                 character_set_name: Optional[pulumi.Input[builtins.str]] = None,
                 collate: Optional[pulumi.Input[builtins.str]] = None,
                 owner: Optional[pulumi.Input[builtins.str]] = None):
        """
        The set of arguments for constructing a Database resource.
        :param pulumi.Input[builtins.str] db_name: 数据库名称。命名规则如下：长度 2~63 个字符。由字母、数字、下划线或中划线组成。以字母开头，字母或数字结尾。不能使用保留关键字，所有被禁用的关键词请参见禁用关键词。
        :param pulumi.Input[builtins.str] instance_id: 实例 ID
        :param pulumi.Input[builtins.str] c_type: 字符分类。取值范围： C（默认）、C.UTF-8、en*US.utf8、zh*CN.utf8 和 POSIX。
        :param pulumi.Input[builtins.str] character_set_name: 数据库字符集。目前支持的字符集包含：utf8（默认）、latin1、ascii
        :param pulumi.Input[builtins.str] collate: 排序规则。取值范围：C（默认）、C.UTF-8、en*US.utf8、zh*CN.utf8 和 POSIX
        :param pulumi.Input[builtins.str] owner: 数据库的 owner。说明：实例只读账号、被禁用了 DDL 权限的高权限账号或被禁用了 DDL 权限的普通账号不能作为数据库的 owner。不传值或传空值时，会为该字段取值为 rds superuser
        """
        pulumi.set(__self__, "db_name", db_name)
        pulumi.set(__self__, "instance_id", instance_id)
        if c_type is not None:
            pulumi.set(__self__, "c_type", c_type)
        if character_set_name is not None:
            pulumi.set(__self__, "character_set_name", character_set_name)
        if collate is not None:
            pulumi.set(__self__, "collate", collate)
        if owner is not None:
            pulumi.set(__self__, "owner", owner)

    @property
    @pulumi.getter(name="dbName")
    def db_name(self) -> pulumi.Input[builtins.str]:
        """
        数据库名称。命名规则如下：长度 2~63 个字符。由字母、数字、下划线或中划线组成。以字母开头，字母或数字结尾。不能使用保留关键字，所有被禁用的关键词请参见禁用关键词。
        """
        return pulumi.get(self, "db_name")

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

    @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(name="cType")
    def c_type(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        字符分类。取值范围： C（默认）、C.UTF-8、en*US.utf8、zh*CN.utf8 和 POSIX。
        """
        return pulumi.get(self, "c_type")

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

    @property
    @pulumi.getter(name="characterSetName")
    def character_set_name(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        数据库字符集。目前支持的字符集包含：utf8（默认）、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
    def collate(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        排序规则。取值范围：C（默认）、C.UTF-8、en*US.utf8、zh*CN.utf8 和 POSIX
        """
        return pulumi.get(self, "collate")

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

    @property
    @pulumi.getter
    def owner(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        数据库的 owner。说明：实例只读账号、被禁用了 DDL 权限的高权限账号或被禁用了 DDL 权限的普通账号不能作为数据库的 owner。不传值或传空值时，会为该字段取值为 rds superuser
        """
        return pulumi.get(self, "owner")

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


@pulumi.input_type
class _DatabaseState:
    def __init__(__self__, *,
                 c_type: Optional[pulumi.Input[builtins.str]] = None,
                 character_set_name: Optional[pulumi.Input[builtins.str]] = None,
                 collate: Optional[pulumi.Input[builtins.str]] = None,
                 db_name: Optional[pulumi.Input[builtins.str]] = None,
                 db_status: Optional[pulumi.Input[builtins.str]] = None,
                 instance_id: Optional[pulumi.Input[builtins.str]] = None,
                 owner: Optional[pulumi.Input[builtins.str]] = None):
        """
        Input properties used for looking up and filtering Database resources.
        :param pulumi.Input[builtins.str] c_type: 字符分类。取值范围： C（默认）、C.UTF-8、en*US.utf8、zh*CN.utf8 和 POSIX。
        :param pulumi.Input[builtins.str] character_set_name: 数据库字符集。目前支持的字符集包含：utf8（默认）、latin1、ascii
        :param pulumi.Input[builtins.str] collate: 排序规则。取值范围：C（默认）、C.UTF-8、en*US.utf8、zh*CN.utf8 和 POSIX
        :param pulumi.Input[builtins.str] db_name: 数据库名称。命名规则如下：长度 2~63 个字符。由字母、数字、下划线或中划线组成。以字母开头，字母或数字结尾。不能使用保留关键字，所有被禁用的关键词请参见禁用关键词。
        :param pulumi.Input[builtins.str] db_status: 数据库状态：Unavailable：不可用。Available：可用。
        :param pulumi.Input[builtins.str] instance_id: 实例 ID
        :param pulumi.Input[builtins.str] owner: 数据库的 owner。说明：实例只读账号、被禁用了 DDL 权限的高权限账号或被禁用了 DDL 权限的普通账号不能作为数据库的 owner。不传值或传空值时，会为该字段取值为 rds superuser
        """
        if c_type is not None:
            pulumi.set(__self__, "c_type", c_type)
        if character_set_name is not None:
            pulumi.set(__self__, "character_set_name", character_set_name)
        if collate is not None:
            pulumi.set(__self__, "collate", collate)
        if db_name is not None:
            pulumi.set(__self__, "db_name", db_name)
        if db_status is not None:
            pulumi.set(__self__, "db_status", db_status)
        if instance_id is not None:
            pulumi.set(__self__, "instance_id", instance_id)
        if owner is not None:
            pulumi.set(__self__, "owner", owner)

    @property
    @pulumi.getter(name="cType")
    def c_type(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        字符分类。取值范围： C（默认）、C.UTF-8、en*US.utf8、zh*CN.utf8 和 POSIX。
        """
        return pulumi.get(self, "c_type")

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

    @property
    @pulumi.getter(name="characterSetName")
    def character_set_name(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        数据库字符集。目前支持的字符集包含：utf8（默认）、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
    def collate(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        排序规则。取值范围：C（默认）、C.UTF-8、en*US.utf8、zh*CN.utf8 和 POSIX
        """
        return pulumi.get(self, "collate")

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

    @property
    @pulumi.getter(name="dbName")
    def db_name(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        数据库名称。命名规则如下：长度 2~63 个字符。由字母、数字、下划线或中划线组成。以字母开头，字母或数字结尾。不能使用保留关键字，所有被禁用的关键词请参见禁用关键词。
        """
        return pulumi.get(self, "db_name")

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

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

    @db_status.setter
    def db_status(self, value: Optional[pulumi.Input[builtins.str]]):
        pulumi.set(self, "db_status", 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 owner(self) -> Optional[pulumi.Input[builtins.str]]:
        """
        数据库的 owner。说明：实例只读账号、被禁用了 DDL 权限的高权限账号或被禁用了 DDL 权限的普通账号不能作为数据库的 owner。不传值或传空值时，会为该字段取值为 rds superuser
        """
        return pulumi.get(self, "owner")

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


@pulumi.type_token("bytepluscc:rdspostgresql/database:Database")
class Database(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 c_type: Optional[pulumi.Input[builtins.str]] = None,
                 character_set_name: Optional[pulumi.Input[builtins.str]] = None,
                 collate: Optional[pulumi.Input[builtins.str]] = None,
                 db_name: Optional[pulumi.Input[builtins.str]] = None,
                 instance_id: Optional[pulumi.Input[builtins.str]] = None,
                 owner: Optional[pulumi.Input[builtins.str]] = None,
                 __props__=None):
        """
        数据库是 PostgreSQL 实例中的一个独立数据库，用于存储和管理数据。

        ## Example Usage

        ```python
        import pulumi
        import pulumi_bytepluscc as bytepluscc

        r_ds_postgre_sql_database_demo = bytepluscc.rdspostgresql.Database("RDSPostgreSQLDatabaseDemo",
            instance_id="postgres-8d1fcxxxxxx",
            db_name="ccapi-terraform-1001",
            character_set_name="utf8",
            owner="test-1",
            collate="C",
            c_type="C.UTF-8")
        ```

        ## Import

        ```sh
        $ pulumi import bytepluscc:rdspostgresql/database:Database example "instance_id|db_name"
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[builtins.str] c_type: 字符分类。取值范围： C（默认）、C.UTF-8、en*US.utf8、zh*CN.utf8 和 POSIX。
        :param pulumi.Input[builtins.str] character_set_name: 数据库字符集。目前支持的字符集包含：utf8（默认）、latin1、ascii
        :param pulumi.Input[builtins.str] collate: 排序规则。取值范围：C（默认）、C.UTF-8、en*US.utf8、zh*CN.utf8 和 POSIX
        :param pulumi.Input[builtins.str] db_name: 数据库名称。命名规则如下：长度 2~63 个字符。由字母、数字、下划线或中划线组成。以字母开头，字母或数字结尾。不能使用保留关键字，所有被禁用的关键词请参见禁用关键词。
        :param pulumi.Input[builtins.str] instance_id: 实例 ID
        :param pulumi.Input[builtins.str] owner: 数据库的 owner。说明：实例只读账号、被禁用了 DDL 权限的高权限账号或被禁用了 DDL 权限的普通账号不能作为数据库的 owner。不传值或传空值时，会为该字段取值为 rds superuser
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: DatabaseArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        数据库是 PostgreSQL 实例中的一个独立数据库，用于存储和管理数据。

        ## Example Usage

        ```python
        import pulumi
        import pulumi_bytepluscc as bytepluscc

        r_ds_postgre_sql_database_demo = bytepluscc.rdspostgresql.Database("RDSPostgreSQLDatabaseDemo",
            instance_id="postgres-8d1fcxxxxxx",
            db_name="ccapi-terraform-1001",
            character_set_name="utf8",
            owner="test-1",
            collate="C",
            c_type="C.UTF-8")
        ```

        ## Import

        ```sh
        $ pulumi import bytepluscc:rdspostgresql/database:Database example "instance_id|db_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,
                 c_type: Optional[pulumi.Input[builtins.str]] = None,
                 character_set_name: Optional[pulumi.Input[builtins.str]] = None,
                 collate: Optional[pulumi.Input[builtins.str]] = None,
                 db_name: Optional[pulumi.Input[builtins.str]] = None,
                 instance_id: Optional[pulumi.Input[builtins.str]] = None,
                 owner: 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__["c_type"] = c_type
            __props__.__dict__["character_set_name"] = character_set_name
            __props__.__dict__["collate"] = collate
            if db_name is None and not opts.urn:
                raise TypeError("Missing required property 'db_name'")
            __props__.__dict__["db_name"] = db_name
            if instance_id is None and not opts.urn:
                raise TypeError("Missing required property 'instance_id'")
            __props__.__dict__["instance_id"] = instance_id
            __props__.__dict__["owner"] = owner
            __props__.__dict__["db_status"] = None
        super(Database, __self__).__init__(
            'bytepluscc:rdspostgresql/database:Database',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            c_type: Optional[pulumi.Input[builtins.str]] = None,
            character_set_name: Optional[pulumi.Input[builtins.str]] = None,
            collate: Optional[pulumi.Input[builtins.str]] = None,
            db_name: Optional[pulumi.Input[builtins.str]] = None,
            db_status: Optional[pulumi.Input[builtins.str]] = None,
            instance_id: Optional[pulumi.Input[builtins.str]] = None,
            owner: 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] c_type: 字符分类。取值范围： C（默认）、C.UTF-8、en*US.utf8、zh*CN.utf8 和 POSIX。
        :param pulumi.Input[builtins.str] character_set_name: 数据库字符集。目前支持的字符集包含：utf8（默认）、latin1、ascii
        :param pulumi.Input[builtins.str] collate: 排序规则。取值范围：C（默认）、C.UTF-8、en*US.utf8、zh*CN.utf8 和 POSIX
        :param pulumi.Input[builtins.str] db_name: 数据库名称。命名规则如下：长度 2~63 个字符。由字母、数字、下划线或中划线组成。以字母开头，字母或数字结尾。不能使用保留关键字，所有被禁用的关键词请参见禁用关键词。
        :param pulumi.Input[builtins.str] db_status: 数据库状态：Unavailable：不可用。Available：可用。
        :param pulumi.Input[builtins.str] instance_id: 实例 ID
        :param pulumi.Input[builtins.str] owner: 数据库的 owner。说明：实例只读账号、被禁用了 DDL 权限的高权限账号或被禁用了 DDL 权限的普通账号不能作为数据库的 owner。不传值或传空值时，会为该字段取值为 rds superuser
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _DatabaseState.__new__(_DatabaseState)

        __props__.__dict__["c_type"] = c_type
        __props__.__dict__["character_set_name"] = character_set_name
        __props__.__dict__["collate"] = collate
        __props__.__dict__["db_name"] = db_name
        __props__.__dict__["db_status"] = db_status
        __props__.__dict__["instance_id"] = instance_id
        __props__.__dict__["owner"] = owner
        return Database(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="cType")
    def c_type(self) -> pulumi.Output[builtins.str]:
        """
        字符分类。取值范围： C（默认）、C.UTF-8、en*US.utf8、zh*CN.utf8 和 POSIX。
        """
        return pulumi.get(self, "c_type")

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

    @property
    @pulumi.getter
    def collate(self) -> pulumi.Output[builtins.str]:
        """
        排序规则。取值范围：C（默认）、C.UTF-8、en*US.utf8、zh*CN.utf8 和 POSIX
        """
        return pulumi.get(self, "collate")

    @property
    @pulumi.getter(name="dbName")
    def db_name(self) -> pulumi.Output[builtins.str]:
        """
        数据库名称。命名规则如下：长度 2~63 个字符。由字母、数字、下划线或中划线组成。以字母开头，字母或数字结尾。不能使用保留关键字，所有被禁用的关键词请参见禁用关键词。
        """
        return pulumi.get(self, "db_name")

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

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

    @property
    @pulumi.getter
    def owner(self) -> pulumi.Output[builtins.str]:
        """
        数据库的 owner。说明：实例只读账号、被禁用了 DDL 权限的高权限账号或被禁用了 DDL 权限的普通账号不能作为数据库的 owner。不传值或传空值时，会为该字段取值为 rds superuser
        """
        return pulumi.get(self, "owner")

