# 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 json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from .. import utilities, tables

class GetListenersResult:
    """
    A collection of values returned by getListeners.
    """
    def __init__(__self__, description_regex=None, frontend_port=None, load_balancer_id=None, output_file=None, protocol=None, slb_listeners=None, id=None):
        if description_regex and not isinstance(description_regex, str):
            raise TypeError("Expected argument 'description_regex' to be a str")
        __self__.description_regex = description_regex
        if frontend_port and not isinstance(frontend_port, float):
            raise TypeError("Expected argument 'frontend_port' to be a float")
        __self__.frontend_port = frontend_port
        """
        Frontend port used to receive incoming traffic and distribute it to the backend servers.
        """
        if load_balancer_id and not isinstance(load_balancer_id, str):
            raise TypeError("Expected argument 'load_balancer_id' to be a str")
        __self__.load_balancer_id = load_balancer_id
        if output_file and not isinstance(output_file, str):
            raise TypeError("Expected argument 'output_file' to be a str")
        __self__.output_file = output_file
        if protocol and not isinstance(protocol, str):
            raise TypeError("Expected argument 'protocol' to be a str")
        __self__.protocol = protocol
        """
        Listener protocol. Possible values: `http`, `https`, `tcp` and `udp`.
        """
        if slb_listeners and not isinstance(slb_listeners, list):
            raise TypeError("Expected argument 'slb_listeners' to be a list")
        __self__.slb_listeners = slb_listeners
        """
        A list of SLB listeners. Each element contains the following attributes:
        """
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        __self__.id = id
        """
        id is the provider-assigned unique ID for this managed resource.
        """
class AwaitableGetListenersResult(GetListenersResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetListenersResult(
            description_regex=self.description_regex,
            frontend_port=self.frontend_port,
            load_balancer_id=self.load_balancer_id,
            output_file=self.output_file,
            protocol=self.protocol,
            slb_listeners=self.slb_listeners,
            id=self.id)

def get_listeners(description_regex=None,frontend_port=None,load_balancer_id=None,output_file=None,protocol=None,opts=None):
    """
    This data source provides the listeners related to a server load balancer of the current Alibaba Cloud user.
    
    :param str description_regex: A regex string to filter results by SLB listener description.
    :param float frontend_port: Filter listeners by the specified frontend port.
    :param str load_balancer_id: ID of the SLB with listeners.
    :param str protocol: Filter listeners by the specified protocol. Valid values: `http`, `https`, `tcp` and `udp`.

    > This content is derived from https://github.com/terraform-providers/terraform-provider-alicloud/blob/master/website/docs/d/slb_listeners.html.markdown.
    """
    __args__ = dict()

    __args__['descriptionRegex'] = description_regex
    __args__['frontendPort'] = frontend_port
    __args__['loadBalancerId'] = load_balancer_id
    __args__['outputFile'] = output_file
    __args__['protocol'] = protocol
    if opts is None:
        opts = pulumi.InvokeOptions()
    if opts.version is None:
        opts.version = utilities.get_version()
    __ret__ = pulumi.runtime.invoke('alicloud:slb/getListeners:getListeners', __args__, opts=opts).value

    return AwaitableGetListenersResult(
        description_regex=__ret__.get('descriptionRegex'),
        frontend_port=__ret__.get('frontendPort'),
        load_balancer_id=__ret__.get('loadBalancerId'),
        output_file=__ret__.get('outputFile'),
        protocol=__ret__.get('protocol'),
        slb_listeners=__ret__.get('slbListeners'),
        id=__ret__.get('id'))
