# 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__ = [
    'GetAllowListResult',
    'AwaitableGetAllowListResult',
    'get_allow_list',
    'get_allow_list_output',
]

@pulumi.output_type
class GetAllowListResult:
    """
    A collection of values returned by getAllowList.
    """
    def __init__(__self__, allow_list_category=None, allow_list_desc=None, allow_list_id=None, allow_list_ip_num=None, allow_list_name=None, allow_list_type=None, allow_lists=None, associated_instance_num=None, associated_instances=None, id=None, ip_address=None, modify_mode=None, security_group_bind_infos=None, update_security_group=None, user_allow_list=None):
        if allow_list_category and not isinstance(allow_list_category, str):
            raise TypeError("Expected argument 'allow_list_category' to be a str")
        pulumi.set(__self__, "allow_list_category", allow_list_category)
        if allow_list_desc and not isinstance(allow_list_desc, str):
            raise TypeError("Expected argument 'allow_list_desc' to be a str")
        pulumi.set(__self__, "allow_list_desc", allow_list_desc)
        if allow_list_id and not isinstance(allow_list_id, str):
            raise TypeError("Expected argument 'allow_list_id' to be a str")
        pulumi.set(__self__, "allow_list_id", allow_list_id)
        if allow_list_ip_num and not isinstance(allow_list_ip_num, int):
            raise TypeError("Expected argument 'allow_list_ip_num' to be a int")
        pulumi.set(__self__, "allow_list_ip_num", allow_list_ip_num)
        if allow_list_name and not isinstance(allow_list_name, str):
            raise TypeError("Expected argument 'allow_list_name' to be a str")
        pulumi.set(__self__, "allow_list_name", allow_list_name)
        if allow_list_type and not isinstance(allow_list_type, str):
            raise TypeError("Expected argument 'allow_list_type' to be a str")
        pulumi.set(__self__, "allow_list_type", allow_list_type)
        if allow_lists and not isinstance(allow_lists, list):
            raise TypeError("Expected argument 'allow_lists' to be a list")
        pulumi.set(__self__, "allow_lists", allow_lists)
        if associated_instance_num and not isinstance(associated_instance_num, int):
            raise TypeError("Expected argument 'associated_instance_num' to be a int")
        pulumi.set(__self__, "associated_instance_num", associated_instance_num)
        if associated_instances and not isinstance(associated_instances, list):
            raise TypeError("Expected argument 'associated_instances' to be a list")
        pulumi.set(__self__, "associated_instances", associated_instances)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if ip_address and not isinstance(ip_address, str):
            raise TypeError("Expected argument 'ip_address' to be a str")
        pulumi.set(__self__, "ip_address", ip_address)
        if modify_mode and not isinstance(modify_mode, str):
            raise TypeError("Expected argument 'modify_mode' to be a str")
        pulumi.set(__self__, "modify_mode", modify_mode)
        if security_group_bind_infos and not isinstance(security_group_bind_infos, list):
            raise TypeError("Expected argument 'security_group_bind_infos' to be a list")
        pulumi.set(__self__, "security_group_bind_infos", security_group_bind_infos)
        if update_security_group and not isinstance(update_security_group, bool):
            raise TypeError("Expected argument 'update_security_group' to be a bool")
        pulumi.set(__self__, "update_security_group", update_security_group)
        if user_allow_list and not isinstance(user_allow_list, str):
            raise TypeError("Expected argument 'user_allow_list' to be a str")
        pulumi.set(__self__, "user_allow_list", user_allow_list)

    @property
    @pulumi.getter(name="allowListCategory")
    def allow_list_category(self) -> builtins.str:
        """
        白名单分类。取值：Ordinary：普通白名单。Default：默认白名单。说明该参数作为请求参数时无默认值，不传入时则查询所有类别的白名单。
        """
        return pulumi.get(self, "allow_list_category")

    @property
    @pulumi.getter(name="allowListDesc")
    def allow_list_desc(self) -> builtins.str:
        """
        白名单的描述信息。长度在 200 字符以内。默认值为空字符串。
        """
        return pulumi.get(self, "allow_list_desc")

    @property
    @pulumi.getter(name="allowListId")
    def allow_list_id(self) -> builtins.str:
        """
        白名单 ID。
        """
        return pulumi.get(self, "allow_list_id")

    @property
    @pulumi.getter(name="allowListIpNum")
    def allow_list_ip_num(self) -> builtins.int:
        """
        白名单中 IP 地址或 IP 地址段的数量。
        """
        return pulumi.get(self, "allow_list_ip_num")

    @property
    @pulumi.getter(name="allowListName")
    def allow_list_name(self) -> builtins.str:
        """
        白名单名称的命名规则如下：在当前地域内，白名单名称唯一。以中文、字母或下划线（*）开头。只能包含中文、字母、数字、下划线（*）和中划线（-）。长度为 1~128 个字符。
        """
        return pulumi.get(self, "allow_list_name")

    @property
    @pulumi.getter(name="allowListType")
    def allow_list_type(self) -> builtins.str:
        """
        白名单采用的网络协议类型。取值为 IPv4（默认值）。
        """
        return pulumi.get(self, "allow_list_type")

    @property
    @pulumi.getter(name="allowLists")
    def allow_lists(self) -> Sequence[builtins.str]:
        """
        白名单中包含的 IP 地址。支持以下两种格式：IP 地址格式。例如：10.23.12.24。CIDR 的 IP 地址段格式。例如：10.23.12.0/24（无类别域间路由，24 表示了地址中前缀的长度，范围为 1~32）。说明每个白名单最多可添加 300 个 IP 或 IP 地址段，当 IP 较多时，建议合并为 IP 段填入，例如10.23.12.0/24。禁止将 0.0.0.0/0 之外的形如 x.x.x.x/0 结尾的 IP 地址加入白名单。该字段不能与 UserAllowList 字段同时使用。
        """
        return pulumi.get(self, "allow_lists")

    @property
    @pulumi.getter(name="associatedInstanceNum")
    def associated_instance_num(self) -> builtins.int:
        """
        该白名单绑定的实例数量。
        """
        return pulumi.get(self, "associated_instance_num")

    @property
    @pulumi.getter(name="associatedInstances")
    def associated_instances(self) -> Sequence['outputs.GetAllowListAssociatedInstanceResult']:
        """
        该白名单绑定的实例列表，包含实例 ID 和实例名称信息。
        """
        return pulumi.get(self, "associated_instances")

    @property
    @pulumi.getter
    def id(self) -> builtins.str:
        """
        Uniquely identifies the resource.
        """
        return pulumi.get(self, "id")

    @property
    @pulumi.getter(name="ipAddress")
    def ip_address(self) -> builtins.str:
        """
        按 IP 地址查询白名单。支持传入多个 IP 地址，多个 IP 地址使用英文逗号（,）分隔。说明如果白名单包含了多个 IP 地址的任意子集，该白名单就会被返回。
        """
        return pulumi.get(self, "ip_address")

    @property
    @pulumi.getter(name="modifyMode")
    def modify_mode(self) -> builtins.str:
        """
        修改白名单的方式。取值：Cover：覆盖，即使用 AllowList 字段的值覆盖原白名单。默认值。Append：追加，即在原白名单中增加 AllowList 字段包含的 IP 地址。Delete：删除，即在原白名单中删除 AllowList 字段包含的 IP 地址。至少需要保留一个 IP 地址。注意如需修改的白名单绑定有安全组，或需要在修改白名单时为白名单绑定安全组，则 ModifyMode 只能取值为 Cover。
        """
        return pulumi.get(self, "modify_mode")

    @property
    @pulumi.getter(name="securityGroupBindInfos")
    def security_group_bind_infos(self) -> Sequence['outputs.GetAllowListSecurityGroupBindInfoResult']:
        """
        该白名单绑定的安全组列表。
        """
        return pulumi.get(self, "security_group_bind_infos")

    @property
    @pulumi.getter(name="updateSecurityGroup")
    def update_security_group(self) -> builtins.bool:
        """
        是否更新白名单所绑定的安全组。取值：true：更新。false：不更新。默认值。
        """
        return pulumi.get(self, "update_security_group")

    @property
    @pulumi.getter(name="userAllowList")
    def user_allow_list(self) -> builtins.str:
        """
        安全组之外的、需要加入白名单的 IP 地址。可输入 IP 地址或 CIDR 格式的 IP 地址段。说明该字段不能与 AllowList 字段同时使用。
        """
        return pulumi.get(self, "user_allow_list")


class AwaitableGetAllowListResult(GetAllowListResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetAllowListResult(
            allow_list_category=self.allow_list_category,
            allow_list_desc=self.allow_list_desc,
            allow_list_id=self.allow_list_id,
            allow_list_ip_num=self.allow_list_ip_num,
            allow_list_name=self.allow_list_name,
            allow_list_type=self.allow_list_type,
            allow_lists=self.allow_lists,
            associated_instance_num=self.associated_instance_num,
            associated_instances=self.associated_instances,
            id=self.id,
            ip_address=self.ip_address,
            modify_mode=self.modify_mode,
            security_group_bind_infos=self.security_group_bind_infos,
            update_security_group=self.update_security_group,
            user_allow_list=self.user_allow_list)


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


    :param builtins.str id: Uniquely identifies the resource.
    """
    __args__ = dict()
    __args__['id'] = id
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('bytepluscc:rdspostgresql/getAllowList:getAllowList', __args__, opts=opts, typ=GetAllowListResult).value

    return AwaitableGetAllowListResult(
        allow_list_category=pulumi.get(__ret__, 'allow_list_category'),
        allow_list_desc=pulumi.get(__ret__, 'allow_list_desc'),
        allow_list_id=pulumi.get(__ret__, 'allow_list_id'),
        allow_list_ip_num=pulumi.get(__ret__, 'allow_list_ip_num'),
        allow_list_name=pulumi.get(__ret__, 'allow_list_name'),
        allow_list_type=pulumi.get(__ret__, 'allow_list_type'),
        allow_lists=pulumi.get(__ret__, 'allow_lists'),
        associated_instance_num=pulumi.get(__ret__, 'associated_instance_num'),
        associated_instances=pulumi.get(__ret__, 'associated_instances'),
        id=pulumi.get(__ret__, 'id'),
        ip_address=pulumi.get(__ret__, 'ip_address'),
        modify_mode=pulumi.get(__ret__, 'modify_mode'),
        security_group_bind_infos=pulumi.get(__ret__, 'security_group_bind_infos'),
        update_security_group=pulumi.get(__ret__, 'update_security_group'),
        user_allow_list=pulumi.get(__ret__, 'user_allow_list'))
def get_allow_list_output(id: Optional[pulumi.Input[builtins.str]] = None,
                          opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetAllowListResult]:
    """
    Data Source schema for Byteplus::RDSPostgreSQL::AllowList


    :param builtins.str id: Uniquely identifies the resource.
    """
    __args__ = dict()
    __args__['id'] = id
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('bytepluscc:rdspostgresql/getAllowList:getAllowList', __args__, opts=opts, typ=GetAllowListResult)
    return __ret__.apply(lambda __response__: GetAllowListResult(
        allow_list_category=pulumi.get(__response__, 'allow_list_category'),
        allow_list_desc=pulumi.get(__response__, 'allow_list_desc'),
        allow_list_id=pulumi.get(__response__, 'allow_list_id'),
        allow_list_ip_num=pulumi.get(__response__, 'allow_list_ip_num'),
        allow_list_name=pulumi.get(__response__, 'allow_list_name'),
        allow_list_type=pulumi.get(__response__, 'allow_list_type'),
        allow_lists=pulumi.get(__response__, 'allow_lists'),
        associated_instance_num=pulumi.get(__response__, 'associated_instance_num'),
        associated_instances=pulumi.get(__response__, 'associated_instances'),
        id=pulumi.get(__response__, 'id'),
        ip_address=pulumi.get(__response__, 'ip_address'),
        modify_mode=pulumi.get(__response__, 'modify_mode'),
        security_group_bind_infos=pulumi.get(__response__, 'security_group_bind_infos'),
        update_security_group=pulumi.get(__response__, 'update_security_group'),
        user_allow_list=pulumi.get(__response__, 'user_allow_list')))
