# 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 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__ = [
    'LoadBalancerZoneMapping',
    'LoadBalancerZoneMappingLoadBalancerAddress',
    'ServerGroupConnectionDrainConfig',
    'ServerGroupHealthCheckConfig',
    'ServerGroupServer',
]

@pulumi.output_type
class LoadBalancerZoneMapping(dict):
    @staticmethod
    def __key_warning(key: str):
        suggest = None
        if key == "vswitchId":
            suggest = "vswitch_id"
        elif key == "zoneId":
            suggest = "zone_id"
        elif key == "loadBalancerAddresses":
            suggest = "load_balancer_addresses"

        if suggest:
            pulumi.log.warn(f"Key '{key}' not found in LoadBalancerZoneMapping. Access the value via the '{suggest}' property getter instead.")

    def __getitem__(self, key: str) -> Any:
        LoadBalancerZoneMapping.__key_warning(key)
        return super().__getitem__(key)

    def get(self, key: str, default = None) -> Any:
        LoadBalancerZoneMapping.__key_warning(key)
        return super().get(key, default)

    def __init__(__self__, *,
                 vswitch_id: str,
                 zone_id: str,
                 load_balancer_addresses: Optional[Sequence['outputs.LoadBalancerZoneMappingLoadBalancerAddress']] = None):
        """
        :param str vswitch_id: The ID of the vSwitch that corresponds to the zone. Each zone can use only one vSwitch and subnet.
        :param str zone_id: The ID of the zone to which the Gateway Load Balancer instance belongs.
        :param Sequence['LoadBalancerZoneMappingLoadBalancerAddressArgs'] load_balancer_addresses: The addresses of the Gateway Load Balancer instance.
        """
        pulumi.set(__self__, "vswitch_id", vswitch_id)
        pulumi.set(__self__, "zone_id", zone_id)
        if load_balancer_addresses is not None:
            pulumi.set(__self__, "load_balancer_addresses", load_balancer_addresses)

    @property
    @pulumi.getter(name="vswitchId")
    def vswitch_id(self) -> str:
        """
        The ID of the vSwitch that corresponds to the zone. Each zone can use only one vSwitch and subnet.
        """
        return pulumi.get(self, "vswitch_id")

    @property
    @pulumi.getter(name="zoneId")
    def zone_id(self) -> str:
        """
        The ID of the zone to which the Gateway Load Balancer instance belongs.
        """
        return pulumi.get(self, "zone_id")

    @property
    @pulumi.getter(name="loadBalancerAddresses")
    def load_balancer_addresses(self) -> Optional[Sequence['outputs.LoadBalancerZoneMappingLoadBalancerAddress']]:
        """
        The addresses of the Gateway Load Balancer instance.
        """
        return pulumi.get(self, "load_balancer_addresses")


@pulumi.output_type
class LoadBalancerZoneMappingLoadBalancerAddress(dict):
    @staticmethod
    def __key_warning(key: str):
        suggest = None
        if key == "eniId":
            suggest = "eni_id"
        elif key == "privateIpv4Address":
            suggest = "private_ipv4_address"

        if suggest:
            pulumi.log.warn(f"Key '{key}' not found in LoadBalancerZoneMappingLoadBalancerAddress. Access the value via the '{suggest}' property getter instead.")

    def __getitem__(self, key: str) -> Any:
        LoadBalancerZoneMappingLoadBalancerAddress.__key_warning(key)
        return super().__getitem__(key)

    def get(self, key: str, default = None) -> Any:
        LoadBalancerZoneMappingLoadBalancerAddress.__key_warning(key)
        return super().get(key, default)

    def __init__(__self__, *,
                 eni_id: Optional[str] = None,
                 private_ipv4_address: Optional[str] = None):
        """
        :param str eni_id: The ID of the ENI.
        :param str private_ipv4_address: IPv4 private network address.
        """
        if eni_id is not None:
            pulumi.set(__self__, "eni_id", eni_id)
        if private_ipv4_address is not None:
            pulumi.set(__self__, "private_ipv4_address", private_ipv4_address)

    @property
    @pulumi.getter(name="eniId")
    def eni_id(self) -> Optional[str]:
        """
        The ID of the ENI.
        """
        return pulumi.get(self, "eni_id")

    @property
    @pulumi.getter(name="privateIpv4Address")
    def private_ipv4_address(self) -> Optional[str]:
        """
        IPv4 private network address.
        """
        return pulumi.get(self, "private_ipv4_address")


@pulumi.output_type
class ServerGroupConnectionDrainConfig(dict):
    @staticmethod
    def __key_warning(key: str):
        suggest = None
        if key == "connectionDrainEnabled":
            suggest = "connection_drain_enabled"
        elif key == "connectionDrainTimeout":
            suggest = "connection_drain_timeout"

        if suggest:
            pulumi.log.warn(f"Key '{key}' not found in ServerGroupConnectionDrainConfig. Access the value via the '{suggest}' property getter instead.")

    def __getitem__(self, key: str) -> Any:
        ServerGroupConnectionDrainConfig.__key_warning(key)
        return super().__getitem__(key)

    def get(self, key: str, default = None) -> Any:
        ServerGroupConnectionDrainConfig.__key_warning(key)
        return super().get(key, default)

    def __init__(__self__, *,
                 connection_drain_enabled: Optional[bool] = None,
                 connection_drain_timeout: Optional[int] = None):
        """
        :param bool connection_drain_enabled: Whether to open the connection graceful interrupt. Value:
        :param int connection_drain_timeout: Connection Grace interrupt timeout.
               
               Unit: seconds.
               
               Value range: 1~3600.
        """
        if connection_drain_enabled is not None:
            pulumi.set(__self__, "connection_drain_enabled", connection_drain_enabled)
        if connection_drain_timeout is not None:
            pulumi.set(__self__, "connection_drain_timeout", connection_drain_timeout)

    @property
    @pulumi.getter(name="connectionDrainEnabled")
    def connection_drain_enabled(self) -> Optional[bool]:
        """
        Whether to open the connection graceful interrupt. Value:
        """
        return pulumi.get(self, "connection_drain_enabled")

    @property
    @pulumi.getter(name="connectionDrainTimeout")
    def connection_drain_timeout(self) -> Optional[int]:
        """
        Connection Grace interrupt timeout.

        Unit: seconds.

        Value range: 1~3600.
        """
        return pulumi.get(self, "connection_drain_timeout")


@pulumi.output_type
class ServerGroupHealthCheckConfig(dict):
    @staticmethod
    def __key_warning(key: str):
        suggest = None
        if key == "healthCheckConnectPort":
            suggest = "health_check_connect_port"
        elif key == "healthCheckConnectTimeout":
            suggest = "health_check_connect_timeout"
        elif key == "healthCheckDomain":
            suggest = "health_check_domain"
        elif key == "healthCheckEnabled":
            suggest = "health_check_enabled"
        elif key == "healthCheckHttpCodes":
            suggest = "health_check_http_codes"
        elif key == "healthCheckInterval":
            suggest = "health_check_interval"
        elif key == "healthCheckPath":
            suggest = "health_check_path"
        elif key == "healthCheckProtocol":
            suggest = "health_check_protocol"
        elif key == "healthyThreshold":
            suggest = "healthy_threshold"
        elif key == "unhealthyThreshold":
            suggest = "unhealthy_threshold"

        if suggest:
            pulumi.log.warn(f"Key '{key}' not found in ServerGroupHealthCheckConfig. Access the value via the '{suggest}' property getter instead.")

    def __getitem__(self, key: str) -> Any:
        ServerGroupHealthCheckConfig.__key_warning(key)
        return super().__getitem__(key)

    def get(self, key: str, default = None) -> Any:
        ServerGroupHealthCheckConfig.__key_warning(key)
        return super().get(key, default)

    def __init__(__self__, *,
                 health_check_connect_port: Optional[int] = None,
                 health_check_connect_timeout: Optional[int] = None,
                 health_check_domain: Optional[str] = None,
                 health_check_enabled: Optional[bool] = None,
                 health_check_http_codes: Optional[Sequence[str]] = None,
                 health_check_interval: Optional[int] = None,
                 health_check_path: Optional[str] = None,
                 health_check_protocol: Optional[str] = None,
                 healthy_threshold: Optional[int] = None,
                 unhealthy_threshold: Optional[int] = None):
        """
        :param int health_check_connect_port: The port of the backend server used for health check.
               
               Value range: **1 to 65535**.
               
               Default value: `80`.
        :param int health_check_connect_timeout: The maximum timeout period for health check responses.
               
               Unit: seconds.
               
               Value range: **1 to 300**.
               
               Default value: `5`.
        :param str health_check_domain: The domain name used for health checks. Value:
               - **$SERVER_IP (default)**: Use the internal IP address of the backend server.
        :param bool health_check_enabled: Whether to enable health check. Value:
               - **true (default)**: enabled.
        :param Sequence[str] health_check_http_codes: Health status return code list.
        :param int health_check_interval: The time interval of the health check.
               
               Unit: seconds.
               
               Value range: **1~50**.
               
               Default value: `10`.
        :param str health_check_path: Health check path.
               
               It can be 1 to 80 characters in length and can only use upper and lower case letters, digits, dashes (-), forward slashes (/), half-width periods (.), percent signs (%), and half-width question marks (?), Pound sign (#) and and(&) and extended character set_;~! ()*[]@$^: ',+ =
               
               Must start with a forward slash (/).
               
               > **NOTE:**  This parameter takes effect only when the HealthCheckProtocol is HTTP.
        :param str health_check_protocol: Health check protocol, value:
               - `TCP` (default): Sends a SYN handshake packet to check whether the server port is alive.
               - `HTTP`: Sends a GET request to simulate the access behavior of the browser to check whether the server application is healthy.
        :param int healthy_threshold: After the number of consecutive successful health checks, the health check status of the backend server is determined as successful from failed.
               
               Value range: **2 to 10**.
               
               Default value: `2`.
        :param int unhealthy_threshold: The number of consecutive failed health checks that determine the health check status of the backend server from success to failure.
               
               Value range: **2 to 10**.
               
               Default value: `2`.
        """
        if health_check_connect_port is not None:
            pulumi.set(__self__, "health_check_connect_port", health_check_connect_port)
        if health_check_connect_timeout is not None:
            pulumi.set(__self__, "health_check_connect_timeout", health_check_connect_timeout)
        if health_check_domain is not None:
            pulumi.set(__self__, "health_check_domain", health_check_domain)
        if health_check_enabled is not None:
            pulumi.set(__self__, "health_check_enabled", health_check_enabled)
        if health_check_http_codes is not None:
            pulumi.set(__self__, "health_check_http_codes", health_check_http_codes)
        if health_check_interval is not None:
            pulumi.set(__self__, "health_check_interval", health_check_interval)
        if health_check_path is not None:
            pulumi.set(__self__, "health_check_path", health_check_path)
        if health_check_protocol is not None:
            pulumi.set(__self__, "health_check_protocol", health_check_protocol)
        if healthy_threshold is not None:
            pulumi.set(__self__, "healthy_threshold", healthy_threshold)
        if unhealthy_threshold is not None:
            pulumi.set(__self__, "unhealthy_threshold", unhealthy_threshold)

    @property
    @pulumi.getter(name="healthCheckConnectPort")
    def health_check_connect_port(self) -> Optional[int]:
        """
        The port of the backend server used for health check.

        Value range: **1 to 65535**.

        Default value: `80`.
        """
        return pulumi.get(self, "health_check_connect_port")

    @property
    @pulumi.getter(name="healthCheckConnectTimeout")
    def health_check_connect_timeout(self) -> Optional[int]:
        """
        The maximum timeout period for health check responses.

        Unit: seconds.

        Value range: **1 to 300**.

        Default value: `5`.
        """
        return pulumi.get(self, "health_check_connect_timeout")

    @property
    @pulumi.getter(name="healthCheckDomain")
    def health_check_domain(self) -> Optional[str]:
        """
        The domain name used for health checks. Value:
        - **$SERVER_IP (default)**: Use the internal IP address of the backend server.
        """
        return pulumi.get(self, "health_check_domain")

    @property
    @pulumi.getter(name="healthCheckEnabled")
    def health_check_enabled(self) -> Optional[bool]:
        """
        Whether to enable health check. Value:
        - **true (default)**: enabled.
        """
        return pulumi.get(self, "health_check_enabled")

    @property
    @pulumi.getter(name="healthCheckHttpCodes")
    def health_check_http_codes(self) -> Optional[Sequence[str]]:
        """
        Health status return code list.
        """
        return pulumi.get(self, "health_check_http_codes")

    @property
    @pulumi.getter(name="healthCheckInterval")
    def health_check_interval(self) -> Optional[int]:
        """
        The time interval of the health check.

        Unit: seconds.

        Value range: **1~50**.

        Default value: `10`.
        """
        return pulumi.get(self, "health_check_interval")

    @property
    @pulumi.getter(name="healthCheckPath")
    def health_check_path(self) -> Optional[str]:
        """
        Health check path.

        It can be 1 to 80 characters in length and can only use upper and lower case letters, digits, dashes (-), forward slashes (/), half-width periods (.), percent signs (%), and half-width question marks (?), Pound sign (#) and and(&) and extended character set_;~! ()*[]@$^: ',+ =

        Must start with a forward slash (/).

        > **NOTE:**  This parameter takes effect only when the HealthCheckProtocol is HTTP.
        """
        return pulumi.get(self, "health_check_path")

    @property
    @pulumi.getter(name="healthCheckProtocol")
    def health_check_protocol(self) -> Optional[str]:
        """
        Health check protocol, value:
        - `TCP` (default): Sends a SYN handshake packet to check whether the server port is alive.
        - `HTTP`: Sends a GET request to simulate the access behavior of the browser to check whether the server application is healthy.
        """
        return pulumi.get(self, "health_check_protocol")

    @property
    @pulumi.getter(name="healthyThreshold")
    def healthy_threshold(self) -> Optional[int]:
        """
        After the number of consecutive successful health checks, the health check status of the backend server is determined as successful from failed.

        Value range: **2 to 10**.

        Default value: `2`.
        """
        return pulumi.get(self, "healthy_threshold")

    @property
    @pulumi.getter(name="unhealthyThreshold")
    def unhealthy_threshold(self) -> Optional[int]:
        """
        The number of consecutive failed health checks that determine the health check status of the backend server from success to failure.

        Value range: **2 to 10**.

        Default value: `2`.
        """
        return pulumi.get(self, "unhealthy_threshold")


@pulumi.output_type
class ServerGroupServer(dict):
    @staticmethod
    def __key_warning(key: str):
        suggest = None
        if key == "serverId":
            suggest = "server_id"
        elif key == "serverType":
            suggest = "server_type"
        elif key == "serverGroupId":
            suggest = "server_group_id"
        elif key == "serverIp":
            suggest = "server_ip"

        if suggest:
            pulumi.log.warn(f"Key '{key}' not found in ServerGroupServer. Access the value via the '{suggest}' property getter instead.")

    def __getitem__(self, key: str) -> Any:
        ServerGroupServer.__key_warning(key)
        return super().__getitem__(key)

    def get(self, key: str, default = None) -> Any:
        ServerGroupServer.__key_warning(key)
        return super().get(key, default)

    def __init__(__self__, *,
                 server_id: str,
                 server_type: str,
                 port: Optional[int] = None,
                 server_group_id: Optional[str] = None,
                 server_ip: Optional[str] = None,
                 status: Optional[str] = None):
        """
        :param str server_id: The ID of the backend server.
        :param str server_type: Backend server type. Valid values:
               - `Ecs`: ECS instance.
               - `Eni`: ENI instance.
               - `Eci`: ECI elastic container.
               - `Ip`: Ip address.
        :param int port: The port used by the backend server.
        :param str server_group_id: The server group ID.
        :param str server_ip: Server ip.
        :param str status: Server group status. Value:
        """
        pulumi.set(__self__, "server_id", server_id)
        pulumi.set(__self__, "server_type", server_type)
        if port is not None:
            pulumi.set(__self__, "port", port)
        if server_group_id is not None:
            pulumi.set(__self__, "server_group_id", server_group_id)
        if server_ip is not None:
            pulumi.set(__self__, "server_ip", server_ip)
        if status is not None:
            pulumi.set(__self__, "status", status)

    @property
    @pulumi.getter(name="serverId")
    def server_id(self) -> str:
        """
        The ID of the backend server.
        """
        return pulumi.get(self, "server_id")

    @property
    @pulumi.getter(name="serverType")
    def server_type(self) -> str:
        """
        Backend server type. Valid values:
        - `Ecs`: ECS instance.
        - `Eni`: ENI instance.
        - `Eci`: ECI elastic container.
        - `Ip`: Ip address.
        """
        return pulumi.get(self, "server_type")

    @property
    @pulumi.getter
    def port(self) -> Optional[int]:
        """
        The port used by the backend server.
        """
        return pulumi.get(self, "port")

    @property
    @pulumi.getter(name="serverGroupId")
    def server_group_id(self) -> Optional[str]:
        """
        The server group ID.
        """
        return pulumi.get(self, "server_group_id")

    @property
    @pulumi.getter(name="serverIp")
    def server_ip(self) -> Optional[str]:
        """
        Server ip.
        """
        return pulumi.get(self, "server_ip")

    @property
    @pulumi.getter
    def status(self) -> Optional[str]:
        """
        Server group status. Value:
        """
        return pulumi.get(self, "status")


