# 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__ = [
    'GetEndpointResult',
    'AwaitableGetEndpointResult',
    'get_endpoint',
    'get_endpoint_output',
]

@pulumi.output_type
class GetEndpointResult:
    """
    A collection of values returned by getEndpoint.
    """
    def __init__(__self__, addresses=None, auto_add_new_nodes=None, connect_all_slave_nodes=None, connection_info_tags=None, connection_mode=None, connection_pool_type=None, custom_route_strategy=None, description=None, enable_connection_persistent=None, enable_read_only=None, endpoint_id=None, endpoint_name=None, endpoint_type=None, id=None, idle_connection_reclaim=None, implicit_trans_split=None, instance_id=None, master_node_routing=None, master_protector_timeout=None, multi_statements_mode=None, nodes=None, overload_protection=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_spliting=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, bool):
            raise TypeError("Expected argument 'auto_add_new_nodes' to be a bool")
        pulumi.set(__self__, "auto_add_new_nodes", auto_add_new_nodes)
        if connect_all_slave_nodes and not isinstance(connect_all_slave_nodes, bool):
            raise TypeError("Expected argument 'connect_all_slave_nodes' to be a bool")
        pulumi.set(__self__, "connect_all_slave_nodes", connect_all_slave_nodes)
        if connection_info_tags and not isinstance(connection_info_tags, list):
            raise TypeError("Expected argument 'connection_info_tags' to be a list")
        pulumi.set(__self__, "connection_info_tags", connection_info_tags)
        if connection_mode and not isinstance(connection_mode, str):
            raise TypeError("Expected argument 'connection_mode' to be a str")
        pulumi.set(__self__, "connection_mode", connection_mode)
        if connection_pool_type and not isinstance(connection_pool_type, str):
            raise TypeError("Expected argument 'connection_pool_type' to be a str")
        pulumi.set(__self__, "connection_pool_type", connection_pool_type)
        if custom_route_strategy and not isinstance(custom_route_strategy, dict):
            raise TypeError("Expected argument 'custom_route_strategy' to be a dict")
        pulumi.set(__self__, "custom_route_strategy", custom_route_strategy)
        if description and not isinstance(description, str):
            raise TypeError("Expected argument 'description' to be a str")
        pulumi.set(__self__, "description", description)
        if enable_connection_persistent and not isinstance(enable_connection_persistent, bool):
            raise TypeError("Expected argument 'enable_connection_persistent' to be a bool")
        pulumi.set(__self__, "enable_connection_persistent", enable_connection_persistent)
        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 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 idle_connection_reclaim and not isinstance(idle_connection_reclaim, bool):
            raise TypeError("Expected argument 'idle_connection_reclaim' to be a bool")
        pulumi.set(__self__, "idle_connection_reclaim", idle_connection_reclaim)
        if implicit_trans_split and not isinstance(implicit_trans_split, bool):
            raise TypeError("Expected argument 'implicit_trans_split' to be a bool")
        pulumi.set(__self__, "implicit_trans_split", implicit_trans_split)
        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 master_node_routing and not isinstance(master_node_routing, bool):
            raise TypeError("Expected argument 'master_node_routing' to be a bool")
        pulumi.set(__self__, "master_node_routing", master_node_routing)
        if master_protector_timeout and not isinstance(master_protector_timeout, int):
            raise TypeError("Expected argument 'master_protector_timeout' to be a int")
        pulumi.set(__self__, "master_protector_timeout", master_protector_timeout)
        if multi_statements_mode and not isinstance(multi_statements_mode, str):
            raise TypeError("Expected argument 'multi_statements_mode' to be a str")
        pulumi.set(__self__, "multi_statements_mode", multi_statements_mode)
        if nodes and not isinstance(nodes, str):
            raise TypeError("Expected argument 'nodes' to be a str")
        pulumi.set(__self__, "nodes", nodes)
        if overload_protection and not isinstance(overload_protection, bool):
            raise TypeError("Expected argument 'overload_protection' to be a bool")
        pulumi.set(__self__, "overload_protection", overload_protection)
        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_spliting and not isinstance(read_write_spliting, bool):
            raise TypeError("Expected argument 'read_write_spliting' to be a bool")
        pulumi.set(__self__, "read_write_spliting", read_write_spliting)

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

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

    @property
    @pulumi.getter(name="connectAllSlaveNodes")
    def connect_all_slave_nodes(self) -> builtins.bool:
        """
        是否关联所有的备节点。取值：true：是。默认值。false：否。说明仅多节点实例的只读终端支持该配置。仅在实例有两个或更多备节点时才能关闭此功能。
        """
        return pulumi.get(self, "connect_all_slave_nodes")

    @property
    @pulumi.getter(name="connectionInfoTags")
    def connection_info_tags(self) -> Sequence[builtins.str]:
        """
        连接终端标签。
        """
        return pulumi.get(self, "connection_info_tags")

    @property
    @pulumi.getter(name="connectionMode")
    def connection_mode(self) -> builtins.str:
        """
        连接终端类型。取值：Proxy：代理终端。Direct：直连终端。说明如实例的数据库代理功能已开启，可以取值为 Proxy 或 Direct。如实例的数据库代理功能未开启，仅可以取值为 Direct。可调用 DescribeDBInstanceDetail 接口查询实例数据库代理功能的开启状态。
        """
        return pulumi.get(self, "connection_mode")

    @property
    @pulumi.getter(name="connectionPoolType")
    def connection_pool_type(self) -> builtins.str:
        """
        代理终端的连接池类型。取值：Transaction：事务级连接池。默认值。Direct：直连模式。说明单节点实例不支持该功能。
        """
        return pulumi.get(self, "connection_pool_type")

    @property
    @pulumi.getter(name="customRouteStrategy")
    def custom_route_strategy(self) -> 'outputs.GetEndpointCustomRouteStrategyResult':
        """
        连接终端的 SQL 转发规则。
        """
        return pulumi.get(self, "custom_route_strategy")

    @property
    @pulumi.getter
    def description(self) -> builtins.str:
        """
        备注。
        """
        return pulumi.get(self, "description")

    @property
    @pulumi.getter(name="enableConnectionPersistent")
    def enable_connection_persistent(self) -> builtins.bool:
        """
        是否开启连接终端的连接保持功能。取值：true：是。false：否。说明仅代理终端支持该设置。
        """
        return pulumi.get(self, "enable_connection_persistent")

    @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="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:
        """
        终端类型。取值为 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="idleConnectionReclaim")
    def idle_connection_reclaim(self) -> builtins.bool:
        """
        空闲连接回收功能是否开启。true：开启。false：不开启。说明仅代理终端会返回该字段。
        """
        return pulumi.get(self, "idle_connection_reclaim")

    @property
    @pulumi.getter(name="implicitTransSplit")
    def implicit_trans_split(self) -> builtins.bool:
        """
        是否开启事务分离。取值：true：是。false：否。说明仅代理终端会返回该字段。
        """
        return pulumi.get(self, "implicit_trans_split")

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

    @property
    @pulumi.getter(name="masterNodeRouting")
    def master_node_routing(self) -> builtins.bool:
        """
        是否开启主节点路由。取值：true：是。false：否。说明仅代理终端会返回该字段。
        """
        return pulumi.get(self, "master_node_routing")

    @property
    @pulumi.getter(name="masterProtectorTimeout")
    def master_protector_timeout(self) -> builtins.int:
        """
        过载保护超时时间。取值范围为 60~7200 之间的整数，单位为秒。说明仅代理终端会返回该字段。
        """
        return pulumi.get(self, "master_protector_timeout")

    @property
    @pulumi.getter(name="multiStatementsMode")
    def multi_statements_mode(self) -> builtins.str:
        """
        代理终端的 Multi-Statements 模式。取值：Strict：Strict 模式。默认值。Loose：Loose 模式。
        """
        return pulumi.get(self, "multi_statements_mode")

    @property
    @pulumi.getter
    def nodes(self) -> builtins.str:
        """
        连接终端配置的节点 ID 列表。当 EndpointType 为 Custom 时必选。说明如需将主节点加入终端，不需填写主节点 ID，只需填写 Primary。多个节点 ID 之间用英文逗号（,）分隔。
        """
        return pulumi.get(self, "nodes")

    @property
    @pulumi.getter(name="overloadProtection")
    def overload_protection(self) -> builtins.bool:
        """
        是否开启过载保护。取值：true：是。false：否。说明仅代理终端会返回该字段。
        """
        return pulumi.get(self, "overload_protection")

    @property
    @pulumi.getter(name="readOnlyNodeDistributionType")
    def read_only_node_distribution_type(self) -> builtins.str:
        """
        读权重分配模式。当开通读写分离设置为 true 时需要传入此参数。在 CreateDBEndpoint 和 ModifyDBEndpoint 接口中做请求参数时，取值范围如下：LoadSchedule：负载调度。RoundRobinCustom：自定义权重的轮询调度。RoundRobinAuto：自动分配权重的轮询调度。在 DescribeDBInstanceDetail 接口中做返回参数时，取值范围如下：Default：按规格权重自动分配。Custom：自定义分配权重。RoundRobin：轮询调度。LoadSchedule：负载调度。RoundRobinCustom：自定义权重的轮询调度。RoundRobinAuto：自动分配权重的轮询调度。
        """
        return pulumi.get(self, "read_only_node_distribution_type")

    @property
    @pulumi.getter(name="readOnlyNodeMaxDelayTime")
    def read_only_node_max_delay_time(self) -> builtins.int:
        """
        只读节点延迟阈值。取值范围为 1~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.GetEndpointReadOnlyNodeWeightResult']:
        """
        连接终端配置的节点列表及对应的只读权重。
        """
        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="readWriteSpliting")
    def read_write_spliting(self) -> builtins.bool:
        """
        是否开启读写分离。取值：true：是。默认值。false：否。
        """
        return pulumi.get(self, "read_write_spliting")


class AwaitableGetEndpointResult(GetEndpointResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetEndpointResult(
            addresses=self.addresses,
            auto_add_new_nodes=self.auto_add_new_nodes,
            connect_all_slave_nodes=self.connect_all_slave_nodes,
            connection_info_tags=self.connection_info_tags,
            connection_mode=self.connection_mode,
            connection_pool_type=self.connection_pool_type,
            custom_route_strategy=self.custom_route_strategy,
            description=self.description,
            enable_connection_persistent=self.enable_connection_persistent,
            enable_read_only=self.enable_read_only,
            endpoint_id=self.endpoint_id,
            endpoint_name=self.endpoint_name,
            endpoint_type=self.endpoint_type,
            id=self.id,
            idle_connection_reclaim=self.idle_connection_reclaim,
            implicit_trans_split=self.implicit_trans_split,
            instance_id=self.instance_id,
            master_node_routing=self.master_node_routing,
            master_protector_timeout=self.master_protector_timeout,
            multi_statements_mode=self.multi_statements_mode,
            nodes=self.nodes,
            overload_protection=self.overload_protection,
            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_spliting=self.read_write_spliting)


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


    :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/getEndpoint:getEndpoint', __args__, opts=opts, typ=GetEndpointResult).value

    return AwaitableGetEndpointResult(
        addresses=pulumi.get(__ret__, 'addresses'),
        auto_add_new_nodes=pulumi.get(__ret__, 'auto_add_new_nodes'),
        connect_all_slave_nodes=pulumi.get(__ret__, 'connect_all_slave_nodes'),
        connection_info_tags=pulumi.get(__ret__, 'connection_info_tags'),
        connection_mode=pulumi.get(__ret__, 'connection_mode'),
        connection_pool_type=pulumi.get(__ret__, 'connection_pool_type'),
        custom_route_strategy=pulumi.get(__ret__, 'custom_route_strategy'),
        description=pulumi.get(__ret__, 'description'),
        enable_connection_persistent=pulumi.get(__ret__, 'enable_connection_persistent'),
        enable_read_only=pulumi.get(__ret__, 'enable_read_only'),
        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'),
        idle_connection_reclaim=pulumi.get(__ret__, 'idle_connection_reclaim'),
        implicit_trans_split=pulumi.get(__ret__, 'implicit_trans_split'),
        instance_id=pulumi.get(__ret__, 'instance_id'),
        master_node_routing=pulumi.get(__ret__, 'master_node_routing'),
        master_protector_timeout=pulumi.get(__ret__, 'master_protector_timeout'),
        multi_statements_mode=pulumi.get(__ret__, 'multi_statements_mode'),
        nodes=pulumi.get(__ret__, 'nodes'),
        overload_protection=pulumi.get(__ret__, 'overload_protection'),
        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_spliting=pulumi.get(__ret__, 'read_write_spliting'))
def get_endpoint_output(id: Optional[pulumi.Input[builtins.str]] = None,
                        opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetEndpointResult]:
    """
    Data Source schema for Byteplus::RDSMySQL::Endpoint


    :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/getEndpoint:getEndpoint', __args__, opts=opts, typ=GetEndpointResult)
    return __ret__.apply(lambda __response__: GetEndpointResult(
        addresses=pulumi.get(__response__, 'addresses'),
        auto_add_new_nodes=pulumi.get(__response__, 'auto_add_new_nodes'),
        connect_all_slave_nodes=pulumi.get(__response__, 'connect_all_slave_nodes'),
        connection_info_tags=pulumi.get(__response__, 'connection_info_tags'),
        connection_mode=pulumi.get(__response__, 'connection_mode'),
        connection_pool_type=pulumi.get(__response__, 'connection_pool_type'),
        custom_route_strategy=pulumi.get(__response__, 'custom_route_strategy'),
        description=pulumi.get(__response__, 'description'),
        enable_connection_persistent=pulumi.get(__response__, 'enable_connection_persistent'),
        enable_read_only=pulumi.get(__response__, 'enable_read_only'),
        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'),
        idle_connection_reclaim=pulumi.get(__response__, 'idle_connection_reclaim'),
        implicit_trans_split=pulumi.get(__response__, 'implicit_trans_split'),
        instance_id=pulumi.get(__response__, 'instance_id'),
        master_node_routing=pulumi.get(__response__, 'master_node_routing'),
        master_protector_timeout=pulumi.get(__response__, 'master_protector_timeout'),
        multi_statements_mode=pulumi.get(__response__, 'multi_statements_mode'),
        nodes=pulumi.get(__response__, 'nodes'),
        overload_protection=pulumi.get(__response__, 'overload_protection'),
        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_spliting=pulumi.get(__response__, 'read_write_spliting')))
