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

__all__ = ['ServerGroupArgs', 'ServerGroup']

@pulumi.input_type
class ServerGroupArgs:
    def __init__(__self__, *,
                 server_group_name: pulumi.Input[str],
                 vpc_id: pulumi.Input[str],
                 address_ip_version: Optional[pulumi.Input[str]] = None,
                 any_port_enabled: Optional[pulumi.Input[bool]] = None,
                 connection_drain: Optional[pulumi.Input[bool]] = None,
                 connection_drain_enabled: Optional[pulumi.Input[bool]] = None,
                 connection_drain_timeout: Optional[pulumi.Input[int]] = None,
                 health_check: Optional[pulumi.Input['ServerGroupHealthCheckArgs']] = None,
                 preserve_client_ip_enabled: Optional[pulumi.Input[bool]] = None,
                 protocol: Optional[pulumi.Input[str]] = None,
                 resource_group_id: Optional[pulumi.Input[str]] = None,
                 scheduler: Optional[pulumi.Input[str]] = None,
                 server_group_type: Optional[pulumi.Input[str]] = None,
                 tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None):
        """
        The set of arguments for constructing a ServerGroup resource.
        :param pulumi.Input[str] server_group_name: The new name of the server group.
               
               The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (\\_), and hyphens (-). The name must start with a letter.
        :param pulumi.Input[str] vpc_id: The ID of the virtual private cloud (VPC) to which the server group belongs.
               
               > **NOTE:**  If `ServerGroupType` is set to `Instance`, only servers in the specified VPC can be added to the server group.
               
               
               The following arguments will be discarded. Please use new fields as soon as possible:
        :param pulumi.Input[str] address_ip_version: The protocol version. Valid values:
        :param pulumi.Input[bool] any_port_enabled: Specifies whether to enable all-port forwarding. Valid values:
        :param pulumi.Input[bool] connection_drain: . Field 'connection_drain' has been deprecated from provider version 1.231.0. New field 'connection_drain_enabled' instead.
        :param pulumi.Input[bool] connection_drain_enabled: Specifies whether to enable connection draining. Valid values:
        :param pulumi.Input[int] connection_drain_timeout: The timeout period of connection draining. Unit: seconds. Valid values: `10` to `900`.
        :param pulumi.Input['ServerGroupHealthCheckArgs'] health_check: Health check configuration information. See `health_check` below.
        :param pulumi.Input[bool] preserve_client_ip_enabled: Specifies whether to enable client IP preservation. Valid values:
        :param pulumi.Input[str] protocol: The protocol used to forward requests to the backend servers. Valid values:
               - `TCP` (default)
               - `UDP`
               - `TCPSSL`
        :param pulumi.Input[str] resource_group_id: The ID of the new resource group.
               
               You can log on to the [Resource Management console](https://resourcemanager.console.aliyun.com/resource-groups) to view resource group IDs.
        :param pulumi.Input[str] scheduler: The scheduling algorithm. Valid values:
               - **Wrr:** The weighted round-robin algorithm is used. Backend servers with higher weights receive more requests than backend servers with lower weights. This is the default value.
               - **rr:** The round-robin algorithm is used. Requests are forwarded to backend servers in sequence.
               - **sch:** Source IP hashing is used. Requests from the same source IP address are forwarded to the same backend server.
               - **tch:** Four-element hashing is used. It specifies consistent hashing that is based on four factors: source IP address, destination IP address, source port, and destination port. Requests that contain the same information based on the four factors are forwarded to the same backend server.
        :param pulumi.Input[str] server_group_type: The type of server group. Valid values:
               - `Instance`: allows you to add servers of the `Ecs`, `Eni`, or `Eci` type. This is the default value.
               - `Ip`: allows you to add servers by specifying IP addresses.
        :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Label.
        """
        pulumi.set(__self__, "server_group_name", server_group_name)
        pulumi.set(__self__, "vpc_id", vpc_id)
        if address_ip_version is not None:
            pulumi.set(__self__, "address_ip_version", address_ip_version)
        if any_port_enabled is not None:
            pulumi.set(__self__, "any_port_enabled", any_port_enabled)
        if connection_drain is not None:
            warnings.warn("""Field 'connection_drain' has been deprecated since provider version 1.214.0. New field 'connection_drain_enabled' instead.""", DeprecationWarning)
            pulumi.log.warn("""connection_drain is deprecated: Field 'connection_drain' has been deprecated since provider version 1.214.0. New field 'connection_drain_enabled' instead.""")
        if connection_drain is not None:
            pulumi.set(__self__, "connection_drain", connection_drain)
        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)
        if health_check is not None:
            pulumi.set(__self__, "health_check", health_check)
        if preserve_client_ip_enabled is not None:
            pulumi.set(__self__, "preserve_client_ip_enabled", preserve_client_ip_enabled)
        if protocol is not None:
            pulumi.set(__self__, "protocol", protocol)
        if resource_group_id is not None:
            pulumi.set(__self__, "resource_group_id", resource_group_id)
        if scheduler is not None:
            pulumi.set(__self__, "scheduler", scheduler)
        if server_group_type is not None:
            pulumi.set(__self__, "server_group_type", server_group_type)
        if tags is not None:
            pulumi.set(__self__, "tags", tags)

    @property
    @pulumi.getter(name="serverGroupName")
    def server_group_name(self) -> pulumi.Input[str]:
        """
        The new name of the server group.

        The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (\\_), and hyphens (-). The name must start with a letter.
        """
        return pulumi.get(self, "server_group_name")

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

    @property
    @pulumi.getter(name="vpcId")
    def vpc_id(self) -> pulumi.Input[str]:
        """
        The ID of the virtual private cloud (VPC) to which the server group belongs.

        > **NOTE:**  If `ServerGroupType` is set to `Instance`, only servers in the specified VPC can be added to the server group.


        The following arguments will be discarded. Please use new fields as soon as possible:
        """
        return pulumi.get(self, "vpc_id")

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

    @property
    @pulumi.getter(name="addressIpVersion")
    def address_ip_version(self) -> Optional[pulumi.Input[str]]:
        """
        The protocol version. Valid values:
        """
        return pulumi.get(self, "address_ip_version")

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

    @property
    @pulumi.getter(name="anyPortEnabled")
    def any_port_enabled(self) -> Optional[pulumi.Input[bool]]:
        """
        Specifies whether to enable all-port forwarding. Valid values:
        """
        return pulumi.get(self, "any_port_enabled")

    @any_port_enabled.setter
    def any_port_enabled(self, value: Optional[pulumi.Input[bool]]):
        pulumi.set(self, "any_port_enabled", value)

    @property
    @pulumi.getter(name="connectionDrain")
    @_utilities.deprecated("""Field 'connection_drain' has been deprecated since provider version 1.214.0. New field 'connection_drain_enabled' instead.""")
    def connection_drain(self) -> Optional[pulumi.Input[bool]]:
        """
        . Field 'connection_drain' has been deprecated from provider version 1.231.0. New field 'connection_drain_enabled' instead.
        """
        return pulumi.get(self, "connection_drain")

    @connection_drain.setter
    def connection_drain(self, value: Optional[pulumi.Input[bool]]):
        pulumi.set(self, "connection_drain", value)

    @property
    @pulumi.getter(name="connectionDrainEnabled")
    def connection_drain_enabled(self) -> Optional[pulumi.Input[bool]]:
        """
        Specifies whether to enable connection draining. Valid values:
        """
        return pulumi.get(self, "connection_drain_enabled")

    @connection_drain_enabled.setter
    def connection_drain_enabled(self, value: Optional[pulumi.Input[bool]]):
        pulumi.set(self, "connection_drain_enabled", value)

    @property
    @pulumi.getter(name="connectionDrainTimeout")
    def connection_drain_timeout(self) -> Optional[pulumi.Input[int]]:
        """
        The timeout period of connection draining. Unit: seconds. Valid values: `10` to `900`.
        """
        return pulumi.get(self, "connection_drain_timeout")

    @connection_drain_timeout.setter
    def connection_drain_timeout(self, value: Optional[pulumi.Input[int]]):
        pulumi.set(self, "connection_drain_timeout", value)

    @property
    @pulumi.getter(name="healthCheck")
    def health_check(self) -> Optional[pulumi.Input['ServerGroupHealthCheckArgs']]:
        """
        Health check configuration information. See `health_check` below.
        """
        return pulumi.get(self, "health_check")

    @health_check.setter
    def health_check(self, value: Optional[pulumi.Input['ServerGroupHealthCheckArgs']]):
        pulumi.set(self, "health_check", value)

    @property
    @pulumi.getter(name="preserveClientIpEnabled")
    def preserve_client_ip_enabled(self) -> Optional[pulumi.Input[bool]]:
        """
        Specifies whether to enable client IP preservation. Valid values:
        """
        return pulumi.get(self, "preserve_client_ip_enabled")

    @preserve_client_ip_enabled.setter
    def preserve_client_ip_enabled(self, value: Optional[pulumi.Input[bool]]):
        pulumi.set(self, "preserve_client_ip_enabled", value)

    @property
    @pulumi.getter
    def protocol(self) -> Optional[pulumi.Input[str]]:
        """
        The protocol used to forward requests to the backend servers. Valid values:
        - `TCP` (default)
        - `UDP`
        - `TCPSSL`
        """
        return pulumi.get(self, "protocol")

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

    @property
    @pulumi.getter(name="resourceGroupId")
    def resource_group_id(self) -> Optional[pulumi.Input[str]]:
        """
        The ID of the new resource group.

        You can log on to the [Resource Management console](https://resourcemanager.console.aliyun.com/resource-groups) to view resource group IDs.
        """
        return pulumi.get(self, "resource_group_id")

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

    @property
    @pulumi.getter
    def scheduler(self) -> Optional[pulumi.Input[str]]:
        """
        The scheduling algorithm. Valid values:
        - **Wrr:** The weighted round-robin algorithm is used. Backend servers with higher weights receive more requests than backend servers with lower weights. This is the default value.
        - **rr:** The round-robin algorithm is used. Requests are forwarded to backend servers in sequence.
        - **sch:** Source IP hashing is used. Requests from the same source IP address are forwarded to the same backend server.
        - **tch:** Four-element hashing is used. It specifies consistent hashing that is based on four factors: source IP address, destination IP address, source port, and destination port. Requests that contain the same information based on the four factors are forwarded to the same backend server.
        """
        return pulumi.get(self, "scheduler")

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

    @property
    @pulumi.getter(name="serverGroupType")
    def server_group_type(self) -> Optional[pulumi.Input[str]]:
        """
        The type of server group. Valid values:
        - `Instance`: allows you to add servers of the `Ecs`, `Eni`, or `Eci` type. This is the default value.
        - `Ip`: allows you to add servers by specifying IP addresses.
        """
        return pulumi.get(self, "server_group_type")

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

    @property
    @pulumi.getter
    def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
        """
        Label.
        """
        return pulumi.get(self, "tags")

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


@pulumi.input_type
class _ServerGroupState:
    def __init__(__self__, *,
                 address_ip_version: Optional[pulumi.Input[str]] = None,
                 any_port_enabled: Optional[pulumi.Input[bool]] = None,
                 connection_drain: Optional[pulumi.Input[bool]] = None,
                 connection_drain_enabled: Optional[pulumi.Input[bool]] = None,
                 connection_drain_timeout: Optional[pulumi.Input[int]] = None,
                 health_check: Optional[pulumi.Input['ServerGroupHealthCheckArgs']] = None,
                 preserve_client_ip_enabled: Optional[pulumi.Input[bool]] = None,
                 protocol: Optional[pulumi.Input[str]] = None,
                 resource_group_id: Optional[pulumi.Input[str]] = None,
                 scheduler: Optional[pulumi.Input[str]] = None,
                 server_group_name: Optional[pulumi.Input[str]] = None,
                 server_group_type: Optional[pulumi.Input[str]] = None,
                 status: Optional[pulumi.Input[str]] = None,
                 tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                 vpc_id: Optional[pulumi.Input[str]] = None):
        """
        Input properties used for looking up and filtering ServerGroup resources.
        :param pulumi.Input[str] address_ip_version: The protocol version. Valid values:
        :param pulumi.Input[bool] any_port_enabled: Specifies whether to enable all-port forwarding. Valid values:
        :param pulumi.Input[bool] connection_drain: . Field 'connection_drain' has been deprecated from provider version 1.231.0. New field 'connection_drain_enabled' instead.
        :param pulumi.Input[bool] connection_drain_enabled: Specifies whether to enable connection draining. Valid values:
        :param pulumi.Input[int] connection_drain_timeout: The timeout period of connection draining. Unit: seconds. Valid values: `10` to `900`.
        :param pulumi.Input['ServerGroupHealthCheckArgs'] health_check: Health check configuration information. See `health_check` below.
        :param pulumi.Input[bool] preserve_client_ip_enabled: Specifies whether to enable client IP preservation. Valid values:
        :param pulumi.Input[str] protocol: The protocol used to forward requests to the backend servers. Valid values:
               - `TCP` (default)
               - `UDP`
               - `TCPSSL`
        :param pulumi.Input[str] resource_group_id: The ID of the new resource group.
               
               You can log on to the [Resource Management console](https://resourcemanager.console.aliyun.com/resource-groups) to view resource group IDs.
        :param pulumi.Input[str] scheduler: The scheduling algorithm. Valid values:
               - **Wrr:** The weighted round-robin algorithm is used. Backend servers with higher weights receive more requests than backend servers with lower weights. This is the default value.
               - **rr:** The round-robin algorithm is used. Requests are forwarded to backend servers in sequence.
               - **sch:** Source IP hashing is used. Requests from the same source IP address are forwarded to the same backend server.
               - **tch:** Four-element hashing is used. It specifies consistent hashing that is based on four factors: source IP address, destination IP address, source port, and destination port. Requests that contain the same information based on the four factors are forwarded to the same backend server.
        :param pulumi.Input[str] server_group_name: The new name of the server group.
               
               The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (\\_), and hyphens (-). The name must start with a letter.
        :param pulumi.Input[str] server_group_type: The type of server group. Valid values:
               - `Instance`: allows you to add servers of the `Ecs`, `Eni`, or `Eci` type. This is the default value.
               - `Ip`: allows you to add servers by specifying IP addresses.
        :param pulumi.Input[str] status: Server group status. Value:
        :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Label.
        :param pulumi.Input[str] vpc_id: The ID of the virtual private cloud (VPC) to which the server group belongs.
               
               > **NOTE:**  If `ServerGroupType` is set to `Instance`, only servers in the specified VPC can be added to the server group.
               
               
               The following arguments will be discarded. Please use new fields as soon as possible:
        """
        if address_ip_version is not None:
            pulumi.set(__self__, "address_ip_version", address_ip_version)
        if any_port_enabled is not None:
            pulumi.set(__self__, "any_port_enabled", any_port_enabled)
        if connection_drain is not None:
            warnings.warn("""Field 'connection_drain' has been deprecated since provider version 1.214.0. New field 'connection_drain_enabled' instead.""", DeprecationWarning)
            pulumi.log.warn("""connection_drain is deprecated: Field 'connection_drain' has been deprecated since provider version 1.214.0. New field 'connection_drain_enabled' instead.""")
        if connection_drain is not None:
            pulumi.set(__self__, "connection_drain", connection_drain)
        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)
        if health_check is not None:
            pulumi.set(__self__, "health_check", health_check)
        if preserve_client_ip_enabled is not None:
            pulumi.set(__self__, "preserve_client_ip_enabled", preserve_client_ip_enabled)
        if protocol is not None:
            pulumi.set(__self__, "protocol", protocol)
        if resource_group_id is not None:
            pulumi.set(__self__, "resource_group_id", resource_group_id)
        if scheduler is not None:
            pulumi.set(__self__, "scheduler", scheduler)
        if server_group_name is not None:
            pulumi.set(__self__, "server_group_name", server_group_name)
        if server_group_type is not None:
            pulumi.set(__self__, "server_group_type", server_group_type)
        if status is not None:
            pulumi.set(__self__, "status", status)
        if tags is not None:
            pulumi.set(__self__, "tags", tags)
        if vpc_id is not None:
            pulumi.set(__self__, "vpc_id", vpc_id)

    @property
    @pulumi.getter(name="addressIpVersion")
    def address_ip_version(self) -> Optional[pulumi.Input[str]]:
        """
        The protocol version. Valid values:
        """
        return pulumi.get(self, "address_ip_version")

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

    @property
    @pulumi.getter(name="anyPortEnabled")
    def any_port_enabled(self) -> Optional[pulumi.Input[bool]]:
        """
        Specifies whether to enable all-port forwarding. Valid values:
        """
        return pulumi.get(self, "any_port_enabled")

    @any_port_enabled.setter
    def any_port_enabled(self, value: Optional[pulumi.Input[bool]]):
        pulumi.set(self, "any_port_enabled", value)

    @property
    @pulumi.getter(name="connectionDrain")
    @_utilities.deprecated("""Field 'connection_drain' has been deprecated since provider version 1.214.0. New field 'connection_drain_enabled' instead.""")
    def connection_drain(self) -> Optional[pulumi.Input[bool]]:
        """
        . Field 'connection_drain' has been deprecated from provider version 1.231.0. New field 'connection_drain_enabled' instead.
        """
        return pulumi.get(self, "connection_drain")

    @connection_drain.setter
    def connection_drain(self, value: Optional[pulumi.Input[bool]]):
        pulumi.set(self, "connection_drain", value)

    @property
    @pulumi.getter(name="connectionDrainEnabled")
    def connection_drain_enabled(self) -> Optional[pulumi.Input[bool]]:
        """
        Specifies whether to enable connection draining. Valid values:
        """
        return pulumi.get(self, "connection_drain_enabled")

    @connection_drain_enabled.setter
    def connection_drain_enabled(self, value: Optional[pulumi.Input[bool]]):
        pulumi.set(self, "connection_drain_enabled", value)

    @property
    @pulumi.getter(name="connectionDrainTimeout")
    def connection_drain_timeout(self) -> Optional[pulumi.Input[int]]:
        """
        The timeout period of connection draining. Unit: seconds. Valid values: `10` to `900`.
        """
        return pulumi.get(self, "connection_drain_timeout")

    @connection_drain_timeout.setter
    def connection_drain_timeout(self, value: Optional[pulumi.Input[int]]):
        pulumi.set(self, "connection_drain_timeout", value)

    @property
    @pulumi.getter(name="healthCheck")
    def health_check(self) -> Optional[pulumi.Input['ServerGroupHealthCheckArgs']]:
        """
        Health check configuration information. See `health_check` below.
        """
        return pulumi.get(self, "health_check")

    @health_check.setter
    def health_check(self, value: Optional[pulumi.Input['ServerGroupHealthCheckArgs']]):
        pulumi.set(self, "health_check", value)

    @property
    @pulumi.getter(name="preserveClientIpEnabled")
    def preserve_client_ip_enabled(self) -> Optional[pulumi.Input[bool]]:
        """
        Specifies whether to enable client IP preservation. Valid values:
        """
        return pulumi.get(self, "preserve_client_ip_enabled")

    @preserve_client_ip_enabled.setter
    def preserve_client_ip_enabled(self, value: Optional[pulumi.Input[bool]]):
        pulumi.set(self, "preserve_client_ip_enabled", value)

    @property
    @pulumi.getter
    def protocol(self) -> Optional[pulumi.Input[str]]:
        """
        The protocol used to forward requests to the backend servers. Valid values:
        - `TCP` (default)
        - `UDP`
        - `TCPSSL`
        """
        return pulumi.get(self, "protocol")

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

    @property
    @pulumi.getter(name="resourceGroupId")
    def resource_group_id(self) -> Optional[pulumi.Input[str]]:
        """
        The ID of the new resource group.

        You can log on to the [Resource Management console](https://resourcemanager.console.aliyun.com/resource-groups) to view resource group IDs.
        """
        return pulumi.get(self, "resource_group_id")

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

    @property
    @pulumi.getter
    def scheduler(self) -> Optional[pulumi.Input[str]]:
        """
        The scheduling algorithm. Valid values:
        - **Wrr:** The weighted round-robin algorithm is used. Backend servers with higher weights receive more requests than backend servers with lower weights. This is the default value.
        - **rr:** The round-robin algorithm is used. Requests are forwarded to backend servers in sequence.
        - **sch:** Source IP hashing is used. Requests from the same source IP address are forwarded to the same backend server.
        - **tch:** Four-element hashing is used. It specifies consistent hashing that is based on four factors: source IP address, destination IP address, source port, and destination port. Requests that contain the same information based on the four factors are forwarded to the same backend server.
        """
        return pulumi.get(self, "scheduler")

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

    @property
    @pulumi.getter(name="serverGroupName")
    def server_group_name(self) -> Optional[pulumi.Input[str]]:
        """
        The new name of the server group.

        The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (\\_), and hyphens (-). The name must start with a letter.
        """
        return pulumi.get(self, "server_group_name")

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

    @property
    @pulumi.getter(name="serverGroupType")
    def server_group_type(self) -> Optional[pulumi.Input[str]]:
        """
        The type of server group. Valid values:
        - `Instance`: allows you to add servers of the `Ecs`, `Eni`, or `Eci` type. This is the default value.
        - `Ip`: allows you to add servers by specifying IP addresses.
        """
        return pulumi.get(self, "server_group_type")

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

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

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

    @property
    @pulumi.getter
    def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
        """
        Label.
        """
        return pulumi.get(self, "tags")

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

    @property
    @pulumi.getter(name="vpcId")
    def vpc_id(self) -> Optional[pulumi.Input[str]]:
        """
        The ID of the virtual private cloud (VPC) to which the server group belongs.

        > **NOTE:**  If `ServerGroupType` is set to `Instance`, only servers in the specified VPC can be added to the server group.


        The following arguments will be discarded. Please use new fields as soon as possible:
        """
        return pulumi.get(self, "vpc_id")

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


class ServerGroup(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 address_ip_version: Optional[pulumi.Input[str]] = None,
                 any_port_enabled: Optional[pulumi.Input[bool]] = None,
                 connection_drain: Optional[pulumi.Input[bool]] = None,
                 connection_drain_enabled: Optional[pulumi.Input[bool]] = None,
                 connection_drain_timeout: Optional[pulumi.Input[int]] = None,
                 health_check: Optional[pulumi.Input[Union['ServerGroupHealthCheckArgs', 'ServerGroupHealthCheckArgsDict']]] = None,
                 preserve_client_ip_enabled: Optional[pulumi.Input[bool]] = None,
                 protocol: Optional[pulumi.Input[str]] = None,
                 resource_group_id: Optional[pulumi.Input[str]] = None,
                 scheduler: Optional[pulumi.Input[str]] = None,
                 server_group_name: Optional[pulumi.Input[str]] = None,
                 server_group_type: Optional[pulumi.Input[str]] = None,
                 tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                 vpc_id: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        """
        Provides a NLB Server Group resource.

        For information about NLB Server Group and how to use it, see [What is Server Group](https://www.alibabacloud.com/help/en/server-load-balancer/latest/createservergroup-nlb).

        > **NOTE:** Available since v1.186.0.

        ## Example Usage

        Basic Usage

        ```python
        import pulumi
        import pulumi_alicloud as alicloud

        config = pulumi.Config()
        name = config.get("name")
        if name is None:
            name = "tf-example"
        default = alicloud.resourcemanager.get_resource_groups()
        default_network = alicloud.vpc.Network("default",
            vpc_name=name,
            cidr_block="10.4.0.0/16")
        default_server_group = alicloud.nlb.ServerGroup("default",
            resource_group_id=default.ids[0],
            server_group_name=name,
            server_group_type="Instance",
            vpc_id=default_network.id,
            scheduler="Wrr",
            protocol="TCP",
            connection_drain_enabled=True,
            connection_drain_timeout=60,
            address_ip_version="Ipv4",
            health_check={
                "health_check_enabled": True,
                "health_check_type": "TCP",
                "health_check_connect_port": 0,
                "healthy_threshold": 2,
                "unhealthy_threshold": 2,
                "health_check_connect_timeout": 5,
                "health_check_interval": 10,
                "http_check_method": "GET",
                "health_check_http_codes": [
                    "http_2xx",
                    "http_3xx",
                    "http_4xx",
                ],
            },
            tags={
                "Created": "TF",
                "For": "example",
            })
        ```

        ## Import

        NLB Server Group can be imported using the id, e.g.

        ```sh
        $ pulumi import alicloud:nlb/serverGroup:ServerGroup example <id>
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] address_ip_version: The protocol version. Valid values:
        :param pulumi.Input[bool] any_port_enabled: Specifies whether to enable all-port forwarding. Valid values:
        :param pulumi.Input[bool] connection_drain: . Field 'connection_drain' has been deprecated from provider version 1.231.0. New field 'connection_drain_enabled' instead.
        :param pulumi.Input[bool] connection_drain_enabled: Specifies whether to enable connection draining. Valid values:
        :param pulumi.Input[int] connection_drain_timeout: The timeout period of connection draining. Unit: seconds. Valid values: `10` to `900`.
        :param pulumi.Input[Union['ServerGroupHealthCheckArgs', 'ServerGroupHealthCheckArgsDict']] health_check: Health check configuration information. See `health_check` below.
        :param pulumi.Input[bool] preserve_client_ip_enabled: Specifies whether to enable client IP preservation. Valid values:
        :param pulumi.Input[str] protocol: The protocol used to forward requests to the backend servers. Valid values:
               - `TCP` (default)
               - `UDP`
               - `TCPSSL`
        :param pulumi.Input[str] resource_group_id: The ID of the new resource group.
               
               You can log on to the [Resource Management console](https://resourcemanager.console.aliyun.com/resource-groups) to view resource group IDs.
        :param pulumi.Input[str] scheduler: The scheduling algorithm. Valid values:
               - **Wrr:** The weighted round-robin algorithm is used. Backend servers with higher weights receive more requests than backend servers with lower weights. This is the default value.
               - **rr:** The round-robin algorithm is used. Requests are forwarded to backend servers in sequence.
               - **sch:** Source IP hashing is used. Requests from the same source IP address are forwarded to the same backend server.
               - **tch:** Four-element hashing is used. It specifies consistent hashing that is based on four factors: source IP address, destination IP address, source port, and destination port. Requests that contain the same information based on the four factors are forwarded to the same backend server.
        :param pulumi.Input[str] server_group_name: The new name of the server group.
               
               The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (\\_), and hyphens (-). The name must start with a letter.
        :param pulumi.Input[str] server_group_type: The type of server group. Valid values:
               - `Instance`: allows you to add servers of the `Ecs`, `Eni`, or `Eci` type. This is the default value.
               - `Ip`: allows you to add servers by specifying IP addresses.
        :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Label.
        :param pulumi.Input[str] vpc_id: The ID of the virtual private cloud (VPC) to which the server group belongs.
               
               > **NOTE:**  If `ServerGroupType` is set to `Instance`, only servers in the specified VPC can be added to the server group.
               
               
               The following arguments will be discarded. Please use new fields as soon as possible:
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: ServerGroupArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Provides a NLB Server Group resource.

        For information about NLB Server Group and how to use it, see [What is Server Group](https://www.alibabacloud.com/help/en/server-load-balancer/latest/createservergroup-nlb).

        > **NOTE:** Available since v1.186.0.

        ## Example Usage

        Basic Usage

        ```python
        import pulumi
        import pulumi_alicloud as alicloud

        config = pulumi.Config()
        name = config.get("name")
        if name is None:
            name = "tf-example"
        default = alicloud.resourcemanager.get_resource_groups()
        default_network = alicloud.vpc.Network("default",
            vpc_name=name,
            cidr_block="10.4.0.0/16")
        default_server_group = alicloud.nlb.ServerGroup("default",
            resource_group_id=default.ids[0],
            server_group_name=name,
            server_group_type="Instance",
            vpc_id=default_network.id,
            scheduler="Wrr",
            protocol="TCP",
            connection_drain_enabled=True,
            connection_drain_timeout=60,
            address_ip_version="Ipv4",
            health_check={
                "health_check_enabled": True,
                "health_check_type": "TCP",
                "health_check_connect_port": 0,
                "healthy_threshold": 2,
                "unhealthy_threshold": 2,
                "health_check_connect_timeout": 5,
                "health_check_interval": 10,
                "http_check_method": "GET",
                "health_check_http_codes": [
                    "http_2xx",
                    "http_3xx",
                    "http_4xx",
                ],
            },
            tags={
                "Created": "TF",
                "For": "example",
            })
        ```

        ## Import

        NLB Server Group can be imported using the id, e.g.

        ```sh
        $ pulumi import alicloud:nlb/serverGroup:ServerGroup example <id>
        ```

        :param str resource_name: The name of the resource.
        :param ServerGroupArgs 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(ServerGroupArgs, 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,
                 address_ip_version: Optional[pulumi.Input[str]] = None,
                 any_port_enabled: Optional[pulumi.Input[bool]] = None,
                 connection_drain: Optional[pulumi.Input[bool]] = None,
                 connection_drain_enabled: Optional[pulumi.Input[bool]] = None,
                 connection_drain_timeout: Optional[pulumi.Input[int]] = None,
                 health_check: Optional[pulumi.Input[Union['ServerGroupHealthCheckArgs', 'ServerGroupHealthCheckArgsDict']]] = None,
                 preserve_client_ip_enabled: Optional[pulumi.Input[bool]] = None,
                 protocol: Optional[pulumi.Input[str]] = None,
                 resource_group_id: Optional[pulumi.Input[str]] = None,
                 scheduler: Optional[pulumi.Input[str]] = None,
                 server_group_name: Optional[pulumi.Input[str]] = None,
                 server_group_type: Optional[pulumi.Input[str]] = None,
                 tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                 vpc_id: Optional[pulumi.Input[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__ = ServerGroupArgs.__new__(ServerGroupArgs)

            __props__.__dict__["address_ip_version"] = address_ip_version
            __props__.__dict__["any_port_enabled"] = any_port_enabled
            __props__.__dict__["connection_drain"] = connection_drain
            __props__.__dict__["connection_drain_enabled"] = connection_drain_enabled
            __props__.__dict__["connection_drain_timeout"] = connection_drain_timeout
            __props__.__dict__["health_check"] = health_check
            __props__.__dict__["preserve_client_ip_enabled"] = preserve_client_ip_enabled
            __props__.__dict__["protocol"] = protocol
            __props__.__dict__["resource_group_id"] = resource_group_id
            __props__.__dict__["scheduler"] = scheduler
            if server_group_name is None and not opts.urn:
                raise TypeError("Missing required property 'server_group_name'")
            __props__.__dict__["server_group_name"] = server_group_name
            __props__.__dict__["server_group_type"] = server_group_type
            __props__.__dict__["tags"] = tags
            if vpc_id is None and not opts.urn:
                raise TypeError("Missing required property 'vpc_id'")
            __props__.__dict__["vpc_id"] = vpc_id
            __props__.__dict__["status"] = None
        super(ServerGroup, __self__).__init__(
            'alicloud:nlb/serverGroup:ServerGroup',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            address_ip_version: Optional[pulumi.Input[str]] = None,
            any_port_enabled: Optional[pulumi.Input[bool]] = None,
            connection_drain: Optional[pulumi.Input[bool]] = None,
            connection_drain_enabled: Optional[pulumi.Input[bool]] = None,
            connection_drain_timeout: Optional[pulumi.Input[int]] = None,
            health_check: Optional[pulumi.Input[Union['ServerGroupHealthCheckArgs', 'ServerGroupHealthCheckArgsDict']]] = None,
            preserve_client_ip_enabled: Optional[pulumi.Input[bool]] = None,
            protocol: Optional[pulumi.Input[str]] = None,
            resource_group_id: Optional[pulumi.Input[str]] = None,
            scheduler: Optional[pulumi.Input[str]] = None,
            server_group_name: Optional[pulumi.Input[str]] = None,
            server_group_type: Optional[pulumi.Input[str]] = None,
            status: Optional[pulumi.Input[str]] = None,
            tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
            vpc_id: Optional[pulumi.Input[str]] = None) -> 'ServerGroup':
        """
        Get an existing ServerGroup 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[str] address_ip_version: The protocol version. Valid values:
        :param pulumi.Input[bool] any_port_enabled: Specifies whether to enable all-port forwarding. Valid values:
        :param pulumi.Input[bool] connection_drain: . Field 'connection_drain' has been deprecated from provider version 1.231.0. New field 'connection_drain_enabled' instead.
        :param pulumi.Input[bool] connection_drain_enabled: Specifies whether to enable connection draining. Valid values:
        :param pulumi.Input[int] connection_drain_timeout: The timeout period of connection draining. Unit: seconds. Valid values: `10` to `900`.
        :param pulumi.Input[Union['ServerGroupHealthCheckArgs', 'ServerGroupHealthCheckArgsDict']] health_check: Health check configuration information. See `health_check` below.
        :param pulumi.Input[bool] preserve_client_ip_enabled: Specifies whether to enable client IP preservation. Valid values:
        :param pulumi.Input[str] protocol: The protocol used to forward requests to the backend servers. Valid values:
               - `TCP` (default)
               - `UDP`
               - `TCPSSL`
        :param pulumi.Input[str] resource_group_id: The ID of the new resource group.
               
               You can log on to the [Resource Management console](https://resourcemanager.console.aliyun.com/resource-groups) to view resource group IDs.
        :param pulumi.Input[str] scheduler: The scheduling algorithm. Valid values:
               - **Wrr:** The weighted round-robin algorithm is used. Backend servers with higher weights receive more requests than backend servers with lower weights. This is the default value.
               - **rr:** The round-robin algorithm is used. Requests are forwarded to backend servers in sequence.
               - **sch:** Source IP hashing is used. Requests from the same source IP address are forwarded to the same backend server.
               - **tch:** Four-element hashing is used. It specifies consistent hashing that is based on four factors: source IP address, destination IP address, source port, and destination port. Requests that contain the same information based on the four factors are forwarded to the same backend server.
        :param pulumi.Input[str] server_group_name: The new name of the server group.
               
               The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (\\_), and hyphens (-). The name must start with a letter.
        :param pulumi.Input[str] server_group_type: The type of server group. Valid values:
               - `Instance`: allows you to add servers of the `Ecs`, `Eni`, or `Eci` type. This is the default value.
               - `Ip`: allows you to add servers by specifying IP addresses.
        :param pulumi.Input[str] status: Server group status. Value:
        :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Label.
        :param pulumi.Input[str] vpc_id: The ID of the virtual private cloud (VPC) to which the server group belongs.
               
               > **NOTE:**  If `ServerGroupType` is set to `Instance`, only servers in the specified VPC can be added to the server group.
               
               
               The following arguments will be discarded. Please use new fields as soon as possible:
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _ServerGroupState.__new__(_ServerGroupState)

        __props__.__dict__["address_ip_version"] = address_ip_version
        __props__.__dict__["any_port_enabled"] = any_port_enabled
        __props__.__dict__["connection_drain"] = connection_drain
        __props__.__dict__["connection_drain_enabled"] = connection_drain_enabled
        __props__.__dict__["connection_drain_timeout"] = connection_drain_timeout
        __props__.__dict__["health_check"] = health_check
        __props__.__dict__["preserve_client_ip_enabled"] = preserve_client_ip_enabled
        __props__.__dict__["protocol"] = protocol
        __props__.__dict__["resource_group_id"] = resource_group_id
        __props__.__dict__["scheduler"] = scheduler
        __props__.__dict__["server_group_name"] = server_group_name
        __props__.__dict__["server_group_type"] = server_group_type
        __props__.__dict__["status"] = status
        __props__.__dict__["tags"] = tags
        __props__.__dict__["vpc_id"] = vpc_id
        return ServerGroup(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="addressIpVersion")
    def address_ip_version(self) -> pulumi.Output[str]:
        """
        The protocol version. Valid values:
        """
        return pulumi.get(self, "address_ip_version")

    @property
    @pulumi.getter(name="anyPortEnabled")
    def any_port_enabled(self) -> pulumi.Output[bool]:
        """
        Specifies whether to enable all-port forwarding. Valid values:
        """
        return pulumi.get(self, "any_port_enabled")

    @property
    @pulumi.getter(name="connectionDrain")
    @_utilities.deprecated("""Field 'connection_drain' has been deprecated since provider version 1.214.0. New field 'connection_drain_enabled' instead.""")
    def connection_drain(self) -> pulumi.Output[bool]:
        """
        . Field 'connection_drain' has been deprecated from provider version 1.231.0. New field 'connection_drain_enabled' instead.
        """
        return pulumi.get(self, "connection_drain")

    @property
    @pulumi.getter(name="connectionDrainEnabled")
    def connection_drain_enabled(self) -> pulumi.Output[bool]:
        """
        Specifies whether to enable connection draining. Valid values:
        """
        return pulumi.get(self, "connection_drain_enabled")

    @property
    @pulumi.getter(name="connectionDrainTimeout")
    def connection_drain_timeout(self) -> pulumi.Output[int]:
        """
        The timeout period of connection draining. Unit: seconds. Valid values: `10` to `900`.
        """
        return pulumi.get(self, "connection_drain_timeout")

    @property
    @pulumi.getter(name="healthCheck")
    def health_check(self) -> pulumi.Output['outputs.ServerGroupHealthCheck']:
        """
        Health check configuration information. See `health_check` below.
        """
        return pulumi.get(self, "health_check")

    @property
    @pulumi.getter(name="preserveClientIpEnabled")
    def preserve_client_ip_enabled(self) -> pulumi.Output[bool]:
        """
        Specifies whether to enable client IP preservation. Valid values:
        """
        return pulumi.get(self, "preserve_client_ip_enabled")

    @property
    @pulumi.getter
    def protocol(self) -> pulumi.Output[str]:
        """
        The protocol used to forward requests to the backend servers. Valid values:
        - `TCP` (default)
        - `UDP`
        - `TCPSSL`
        """
        return pulumi.get(self, "protocol")

    @property
    @pulumi.getter(name="resourceGroupId")
    def resource_group_id(self) -> pulumi.Output[str]:
        """
        The ID of the new resource group.

        You can log on to the [Resource Management console](https://resourcemanager.console.aliyun.com/resource-groups) to view resource group IDs.
        """
        return pulumi.get(self, "resource_group_id")

    @property
    @pulumi.getter
    def scheduler(self) -> pulumi.Output[str]:
        """
        The scheduling algorithm. Valid values:
        - **Wrr:** The weighted round-robin algorithm is used. Backend servers with higher weights receive more requests than backend servers with lower weights. This is the default value.
        - **rr:** The round-robin algorithm is used. Requests are forwarded to backend servers in sequence.
        - **sch:** Source IP hashing is used. Requests from the same source IP address are forwarded to the same backend server.
        - **tch:** Four-element hashing is used. It specifies consistent hashing that is based on four factors: source IP address, destination IP address, source port, and destination port. Requests that contain the same information based on the four factors are forwarded to the same backend server.
        """
        return pulumi.get(self, "scheduler")

    @property
    @pulumi.getter(name="serverGroupName")
    def server_group_name(self) -> pulumi.Output[str]:
        """
        The new name of the server group.

        The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (\\_), and hyphens (-). The name must start with a letter.
        """
        return pulumi.get(self, "server_group_name")

    @property
    @pulumi.getter(name="serverGroupType")
    def server_group_type(self) -> pulumi.Output[str]:
        """
        The type of server group. Valid values:
        - `Instance`: allows you to add servers of the `Ecs`, `Eni`, or `Eci` type. This is the default value.
        - `Ip`: allows you to add servers by specifying IP addresses.
        """
        return pulumi.get(self, "server_group_type")

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

    @property
    @pulumi.getter
    def tags(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
        """
        Label.
        """
        return pulumi.get(self, "tags")

    @property
    @pulumi.getter(name="vpcId")
    def vpc_id(self) -> pulumi.Output[str]:
        """
        The ID of the virtual private cloud (VPC) to which the server group belongs.

        > **NOTE:**  If `ServerGroupType` is set to `Instance`, only servers in the specified VPC can be added to the server group.


        The following arguments will be discarded. Please use new fields as soon as possible:
        """
        return pulumi.get(self, "vpc_id")

