# 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__ = [
    'GetDbEndpointResult',
    'AwaitableGetDbEndpointResult',
    'get_db_endpoint',
    'get_db_endpoint_output',
]

@pulumi.output_type
class GetDbEndpointResult:
    """
    A collection of values returned by getDbEndpoint.
    """
    def __init__(__self__, addresses=None, auto_add_new_nodes=None, description=None, enable_read_only=None, enable_read_write_splitting=None, endpoint_id=None, endpoint_name=None, endpoint_type=None, id=None, instance_id=None, nodes=None, read_only_node_distribution_type=None, read_only_node_max_delay_time=None, read_only_node_weights=None, read_write_mode=None, read_write_proxy_connection=None, write_node_halt_writing=None):
        if addresses and not isinstance(addresses, list):
            raise TypeError("Expected argument 'addresses' to be a list")
        pulumi.set(__self__, "addresses", addresses)
        if auto_add_new_nodes and not isinstance(auto_add_new_nodes, str):
            raise TypeError("Expected argument 'auto_add_new_nodes' to be a str")
        pulumi.set(__self__, "auto_add_new_nodes", auto_add_new_nodes)
        if description and not isinstance(description, str):
            raise TypeError("Expected argument 'description' to be a str")
        pulumi.set(__self__, "description", description)
        if enable_read_only and not isinstance(enable_read_only, str):
            raise TypeError("Expected argument 'enable_read_only' to be a str")
        pulumi.set(__self__, "enable_read_only", enable_read_only)
        if enable_read_write_splitting and not isinstance(enable_read_write_splitting, str):
            raise TypeError("Expected argument 'enable_read_write_splitting' to be a str")
        pulumi.set(__self__, "enable_read_write_splitting", enable_read_write_splitting)
        if endpoint_id and not isinstance(endpoint_id, str):
            raise TypeError("Expected argument 'endpoint_id' to be a str")
        pulumi.set(__self__, "endpoint_id", endpoint_id)
        if endpoint_name and not isinstance(endpoint_name, str):
            raise TypeError("Expected argument 'endpoint_name' to be a str")
        pulumi.set(__self__, "endpoint_name", endpoint_name)
        if endpoint_type and not isinstance(endpoint_type, str):
            raise TypeError("Expected argument 'endpoint_type' to be a str")
        pulumi.set(__self__, "endpoint_type", endpoint_type)
        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 nodes and not isinstance(nodes, str):
            raise TypeError("Expected argument 'nodes' to be a str")
        pulumi.set(__self__, "nodes", nodes)
        if read_only_node_distribution_type and not isinstance(read_only_node_distribution_type, str):
            raise TypeError("Expected argument 'read_only_node_distribution_type' to be a str")
        pulumi.set(__self__, "read_only_node_distribution_type", read_only_node_distribution_type)
        if read_only_node_max_delay_time and not isinstance(read_only_node_max_delay_time, int):
            raise TypeError("Expected argument 'read_only_node_max_delay_time' to be a int")
        pulumi.set(__self__, "read_only_node_max_delay_time", read_only_node_max_delay_time)
        if read_only_node_weights and not isinstance(read_only_node_weights, list):
            raise TypeError("Expected argument 'read_only_node_weights' to be a list")
        pulumi.set(__self__, "read_only_node_weights", read_only_node_weights)
        if read_write_mode and not isinstance(read_write_mode, str):
            raise TypeError("Expected argument 'read_write_mode' to be a str")
        pulumi.set(__self__, "read_write_mode", read_write_mode)
        if read_write_proxy_connection and not isinstance(read_write_proxy_connection, int):
            raise TypeError("Expected argument 'read_write_proxy_connection' to be a int")
        pulumi.set(__self__, "read_write_proxy_connection", read_write_proxy_connection)
        if write_node_halt_writing and not isinstance(write_node_halt_writing, bool):
            raise TypeError("Expected argument 'write_node_halt_writing' to be a bool")
        pulumi.set(__self__, "write_node_halt_writing", write_node_halt_writing)

    @property
    @pulumi.getter
    def addresses(self) -> Sequence['outputs.GetDbEndpointAddressResult']:
        """
        地址列表。
        """
        return pulumi.get(self, "addresses")

    @property
    @pulumi.getter(name="autoAddNewNodes")
    def auto_add_new_nodes(self) -> builtins.str:
        """
        当终端类型为读写终端或只读终端时，支持设置新节点是否自动加入。取值：Enable：自动加入。Disable：不自动加入（默认）。
        """
        return pulumi.get(self, "auto_add_new_nodes")

    @property
    @pulumi.getter
    def description(self) -> builtins.str:
        """
        地址描述。
        """
        return pulumi.get(self, "description")

    @property
    @pulumi.getter(name="enableReadOnly")
    def enable_read_only(self) -> builtins.str:
        """
        是否已开启全局只读。Enable：开启。Disable：未开启。
        """
        return pulumi.get(self, "enable_read_only")

    @property
    @pulumi.getter(name="enableReadWriteSplitting")
    def enable_read_write_splitting(self) -> builtins.str:
        """
        是否已开启读写分离，取值：Enable：开启。Disable：未开启。
        """
        return pulumi.get(self, "enable_read_write_splitting")

    @property
    @pulumi.getter(name="endpointId")
    def endpoint_id(self) -> builtins.str:
        """
        实例连接终端 ID。
        """
        return pulumi.get(self, "endpoint_id")

    @property
    @pulumi.getter(name="endpointName")
    def endpoint_name(self) -> builtins.str:
        """
        实例连接终端名称。
        """
        return pulumi.get(self, "endpoint_name")

    @property
    @pulumi.getter(name="endpointType")
    def endpoint_type(self) -> builtins.str:
        """
        终端类型：Cluster：默认终端（默认创建）。Custom：自定义终端。
        """
        return pulumi.get(self, "endpoint_type")

    @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
    def nodes(self) -> builtins.str:
        """
        连接终端配置的节点列表。说明当 EndpointType 为 Custom 时必选。主节点无需传节点 ID，传入 Primary 字符串即可。
        """
        return pulumi.get(self, "nodes")

    @property
    @pulumi.getter(name="readOnlyNodeDistributionType")
    def read_only_node_distribution_type(self) -> builtins.str:
        """
        只读权重分配模式。取值：Default：标准权重分配（默认值）。Custom：自定义权重分配。
        """
        return pulumi.get(self, "read_only_node_distribution_type")

    @property
    @pulumi.getter(name="readOnlyNodeMaxDelayTime")
    def read_only_node_max_delay_time(self) -> builtins.int:
        """
        只读节点的最大延迟阈值，当只读节点延迟时间超过该值时，读取流量不发往该节点，单位：秒。取值：0~3600。默认值：30。说明支持对开通了读写分离的默认终端设置此参数。
        """
        return pulumi.get(self, "read_only_node_max_delay_time")

    @property
    @pulumi.getter(name="readOnlyNodeWeights")
    def read_only_node_weights(self) -> Sequence['outputs.GetDbEndpointReadOnlyNodeWeightResult']:
        """
        连接终端配置的节点列表及对应的只读权重。
        """
        return pulumi.get(self, "read_only_node_weights")

    @property
    @pulumi.getter(name="readWriteMode")
    def read_write_mode(self) -> builtins.str:
        """
        读写模式：ReadWrite：读写。ReadOnly：只读。
        """
        return pulumi.get(self, "read_write_mode")

    @property
    @pulumi.getter(name="readWriteProxyConnection")
    def read_write_proxy_connection(self) -> builtins.int:
        """
        终端开启读写分离后，为终端设置的代理连接数。代理连接数的取值下限为 20。代理连接数的取值上限取决于实例主节点的规格，不同规格支持的代理连接数上限不同，详细信息请参见产品规格。
        """
        return pulumi.get(self, "read_write_proxy_connection")

    @property
    @pulumi.getter(name="writeNodeHaltWriting")
    def write_node_halt_writing(self) -> builtins.bool:
        """
        终端是否将写请求发送给写节点（目前仅主节点为写节点）。取值：true：是。默认值。false：否。
        """
        return pulumi.get(self, "write_node_halt_writing")


class AwaitableGetDbEndpointResult(GetDbEndpointResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetDbEndpointResult(
            addresses=self.addresses,
            auto_add_new_nodes=self.auto_add_new_nodes,
            description=self.description,
            enable_read_only=self.enable_read_only,
            enable_read_write_splitting=self.enable_read_write_splitting,
            endpoint_id=self.endpoint_id,
            endpoint_name=self.endpoint_name,
            endpoint_type=self.endpoint_type,
            id=self.id,
            instance_id=self.instance_id,
            nodes=self.nodes,
            read_only_node_distribution_type=self.read_only_node_distribution_type,
            read_only_node_max_delay_time=self.read_only_node_max_delay_time,
            read_only_node_weights=self.read_only_node_weights,
            read_write_mode=self.read_write_mode,
            read_write_proxy_connection=self.read_write_proxy_connection,
            write_node_halt_writing=self.write_node_halt_writing)


def get_db_endpoint(id: Optional[builtins.str] = None,
                    opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetDbEndpointResult:
    """
    Data Source schema for Byteplus::RDSPostgreSQL::DBEndpoint


    :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:rdspostgresql/getDbEndpoint:getDbEndpoint', __args__, opts=opts, typ=GetDbEndpointResult).value

    return AwaitableGetDbEndpointResult(
        addresses=pulumi.get(__ret__, 'addresses'),
        auto_add_new_nodes=pulumi.get(__ret__, 'auto_add_new_nodes'),
        description=pulumi.get(__ret__, 'description'),
        enable_read_only=pulumi.get(__ret__, 'enable_read_only'),
        enable_read_write_splitting=pulumi.get(__ret__, 'enable_read_write_splitting'),
        endpoint_id=pulumi.get(__ret__, 'endpoint_id'),
        endpoint_name=pulumi.get(__ret__, 'endpoint_name'),
        endpoint_type=pulumi.get(__ret__, 'endpoint_type'),
        id=pulumi.get(__ret__, 'id'),
        instance_id=pulumi.get(__ret__, 'instance_id'),
        nodes=pulumi.get(__ret__, 'nodes'),
        read_only_node_distribution_type=pulumi.get(__ret__, 'read_only_node_distribution_type'),
        read_only_node_max_delay_time=pulumi.get(__ret__, 'read_only_node_max_delay_time'),
        read_only_node_weights=pulumi.get(__ret__, 'read_only_node_weights'),
        read_write_mode=pulumi.get(__ret__, 'read_write_mode'),
        read_write_proxy_connection=pulumi.get(__ret__, 'read_write_proxy_connection'),
        write_node_halt_writing=pulumi.get(__ret__, 'write_node_halt_writing'))
def get_db_endpoint_output(id: Optional[pulumi.Input[builtins.str]] = None,
                           opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetDbEndpointResult]:
    """
    Data Source schema for Byteplus::RDSPostgreSQL::DBEndpoint


    :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:rdspostgresql/getDbEndpoint:getDbEndpoint', __args__, opts=opts, typ=GetDbEndpointResult)
    return __ret__.apply(lambda __response__: GetDbEndpointResult(
        addresses=pulumi.get(__response__, 'addresses'),
        auto_add_new_nodes=pulumi.get(__response__, 'auto_add_new_nodes'),
        description=pulumi.get(__response__, 'description'),
        enable_read_only=pulumi.get(__response__, 'enable_read_only'),
        enable_read_write_splitting=pulumi.get(__response__, 'enable_read_write_splitting'),
        endpoint_id=pulumi.get(__response__, 'endpoint_id'),
        endpoint_name=pulumi.get(__response__, 'endpoint_name'),
        endpoint_type=pulumi.get(__response__, 'endpoint_type'),
        id=pulumi.get(__response__, 'id'),
        instance_id=pulumi.get(__response__, 'instance_id'),
        nodes=pulumi.get(__response__, 'nodes'),
        read_only_node_distribution_type=pulumi.get(__response__, 'read_only_node_distribution_type'),
        read_only_node_max_delay_time=pulumi.get(__response__, 'read_only_node_max_delay_time'),
        read_only_node_weights=pulumi.get(__response__, 'read_only_node_weights'),
        read_write_mode=pulumi.get(__response__, 'read_write_mode'),
        read_write_proxy_connection=pulumi.get(__response__, 'read_write_proxy_connection'),
        write_node_halt_writing=pulumi.get(__response__, 'write_node_halt_writing')))
