# 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 warnings
import pulumi
import pulumi.runtime
from typing import Any, Dict, List, Mapping, Optional, Tuple, Union
from .. import _utilities, _tables
from . import outputs

__all__ = [
    'GetForwardEntriesResult',
    'AwaitableGetForwardEntriesResult',
    'get_forward_entries',
]

@pulumi.output_type
class GetForwardEntriesResult:
    """
    A collection of values returned by getForwardEntries.
    """
    def __init__(__self__, entries=None, external_ip=None, forward_table_id=None, id=None, ids=None, internal_ip=None, name_regex=None, names=None, output_file=None):
        if entries and not isinstance(entries, list):
            raise TypeError("Expected argument 'entries' to be a list")
        pulumi.set(__self__, "entries", entries)
        if external_ip and not isinstance(external_ip, str):
            raise TypeError("Expected argument 'external_ip' to be a str")
        pulumi.set(__self__, "external_ip", external_ip)
        if forward_table_id and not isinstance(forward_table_id, str):
            raise TypeError("Expected argument 'forward_table_id' to be a str")
        pulumi.set(__self__, "forward_table_id", forward_table_id)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if ids and not isinstance(ids, list):
            raise TypeError("Expected argument 'ids' to be a list")
        pulumi.set(__self__, "ids", ids)
        if internal_ip and not isinstance(internal_ip, str):
            raise TypeError("Expected argument 'internal_ip' to be a str")
        pulumi.set(__self__, "internal_ip", internal_ip)
        if name_regex and not isinstance(name_regex, str):
            raise TypeError("Expected argument 'name_regex' to be a str")
        pulumi.set(__self__, "name_regex", name_regex)
        if names and not isinstance(names, list):
            raise TypeError("Expected argument 'names' to be a list")
        pulumi.set(__self__, "names", names)
        if output_file and not isinstance(output_file, str):
            raise TypeError("Expected argument 'output_file' to be a str")
        pulumi.set(__self__, "output_file", output_file)

    @property
    @pulumi.getter
    def entries(self) -> List['outputs.GetForwardEntriesEntryResult']:
        """
        A list of Forward Entries. Each element contains the following attributes:
        """
        return pulumi.get(self, "entries")

    @property
    @pulumi.getter(name="externalIp")
    def external_ip(self) -> Optional[str]:
        """
        The public IP address.
        """
        return pulumi.get(self, "external_ip")

    @property
    @pulumi.getter(name="forwardTableId")
    def forward_table_id(self) -> str:
        return pulumi.get(self, "forward_table_id")

    @property
    @pulumi.getter
    def id(self) -> str:
        """
        The provider-assigned unique ID for this managed resource.
        """
        return pulumi.get(self, "id")

    @property
    @pulumi.getter
    def ids(self) -> List[str]:
        """
        A list of Forward Entries IDs.
        """
        return pulumi.get(self, "ids")

    @property
    @pulumi.getter(name="internalIp")
    def internal_ip(self) -> Optional[str]:
        """
        The private IP address.
        """
        return pulumi.get(self, "internal_ip")

    @property
    @pulumi.getter(name="nameRegex")
    def name_regex(self) -> Optional[str]:
        return pulumi.get(self, "name_regex")

    @property
    @pulumi.getter
    def names(self) -> Optional[List[str]]:
        """
        A list of Forward Entries names.
        """
        return pulumi.get(self, "names")

    @property
    @pulumi.getter(name="outputFile")
    def output_file(self) -> Optional[str]:
        return pulumi.get(self, "output_file")


class AwaitableGetForwardEntriesResult(GetForwardEntriesResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetForwardEntriesResult(
            entries=self.entries,
            external_ip=self.external_ip,
            forward_table_id=self.forward_table_id,
            id=self.id,
            ids=self.ids,
            internal_ip=self.internal_ip,
            name_regex=self.name_regex,
            names=self.names,
            output_file=self.output_file)


def get_forward_entries(external_ip: Optional[str] = None,
                        forward_table_id: Optional[str] = None,
                        ids: Optional[List[str]] = None,
                        internal_ip: Optional[str] = None,
                        name_regex: Optional[str] = None,
                        names: Optional[List[str]] = None,
                        output_file: Optional[str] = None,
                        opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetForwardEntriesResult:
    """
    This data source provides a list of Forward Entries owned by an Alibaba Cloud account.

    > **NOTE:** Available in 1.37.0+.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_alicloud as alicloud

    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "forward-entry-config-example-name"
    default_zones = alicloud.get_zones(available_resource_creation="VSwitch")
    default_network = alicloud.vpc.Network("defaultNetwork", cidr_block="172.16.0.0/12")
    default_switch = alicloud.vpc.Switch("defaultSwitch",
        availability_zone=default_zones.zones[0].id,
        cidr_block="172.16.0.0/21",
        vpc_id=default_network.id)
    default_nat_gateway = alicloud.vpc.NatGateway("defaultNatGateway",
        specification="Small",
        vpc_id=default_network.id)
    default_eip = alicloud.ecs.Eip("defaultEip")
    default_eip_association = alicloud.ecs.EipAssociation("defaultEipAssociation",
        allocation_id=default_eip.id,
        instance_id=default_nat_gateway.id)
    default_forward_entry = alicloud.vpc.ForwardEntry("defaultForwardEntry",
        external_ip=default_eip.ip_address,
        external_port="80",
        forward_table_id=default_nat_gateway.forward_table_ids,
        internal_ip="172.16.0.3",
        internal_port="8080",
        ip_protocol="tcp")
    default_forward_entries = default_forward_entry.forward_table_id.apply(lambda forward_table_id: alicloud.vpc.get_forward_entries(forward_table_id=forward_table_id))
    ```


    :param str external_ip: The public IP address.
    :param str forward_table_id: The ID of the Forward table.
    :param List[str] ids: A list of Forward Entries IDs.
    :param str internal_ip: The private IP address.
    :param str name_regex: A regex string to filter results by forward entry name.
    :param List[str] names: A list of Forward Entries names.
    """
    __args__ = dict()
    __args__['externalIp'] = external_ip
    __args__['forwardTableId'] = forward_table_id
    __args__['ids'] = ids
    __args__['internalIp'] = internal_ip
    __args__['nameRegex'] = name_regex
    __args__['names'] = names
    __args__['outputFile'] = output_file
    if opts is None:
        opts = pulumi.InvokeOptions()
    if opts.version is None:
        opts.version = _utilities.get_version()
    __ret__ = pulumi.runtime.invoke('alicloud:vpc/getForwardEntries:getForwardEntries', __args__, opts=opts, typ=GetForwardEntriesResult).value

    return AwaitableGetForwardEntriesResult(
        entries=__ret__.entries,
        external_ip=__ret__.external_ip,
        forward_table_id=__ret__.forward_table_id,
        id=__ret__.id,
        ids=__ret__.ids,
        internal_ip=__ret__.internal_ip,
        name_regex=__ret__.name_regex,
        names=__ret__.names,
        output_file=__ret__.output_file)
