# 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 Listener(pulumi.CustomResource):
    acl_id: pulumi.Output[str]
    """
    the id of access control list to be apply on the listener, is the id of resource alicloud_slb_acl. If `acl_status` is "on", it is mandatory. Otherwise, it will be ignored.
    """
    acl_status: pulumi.Output[str]
    """
    Whether to enable "acl(access control list)", the acl is specified by `acl_id`. Valid values are `on` and `off`. Default to `off`.
    """
    acl_type: pulumi.Output[str]
    """
    Mode for handling the acl specified by acl_id. If `acl_status` is "on", it is mandatory. Otherwise, it will be ignored. Valid values are `white` and `black`. `white` means the Listener can only be accessed by client ip belongs to the acl; `black` means the Listener can not be accessed by client ip belongs to the acl.
    """
    backend_port: pulumi.Output[float]
    """
    Port used by the Server Load Balancer instance backend. Valid value range: [1-65535].
    """
    bandwidth: pulumi.Output[float]
    """
    Bandwidth peak of Listener. For the public network instance charged per traffic consumed, the Bandwidth on Listener can be set to -1, indicating the bandwidth peak is unlimited. Valid values are [-1, 1-1000] in Mbps.
    """
    cookie: pulumi.Output[str]
    """
    The cookie configured on the server. It is mandatory when `sticky_session` is "on" and `sticky_session_type` is "server". Otherwise, it will be ignored. Valid value：String in line with RFC 2965, with length being 1- 200. It only contains characters such as ASCII codes, English letters and digits instead of the comma, semicolon or spacing, and it cannot start with $.
    """
    cookie_timeout: pulumi.Output[float]
    """
    Cookie timeout. It is mandatory when `sticky_session` is "on" and `sticky_session_type` is "insert". Otherwise, it will be ignored. Valid value range: [1-86400] in seconds.
    """
    delete_protection_validation: pulumi.Output[bool]
    """
    Checking DeleteProtection of SLB instance before deleting. If true, this resource will not be deleted when its SLB instance enabled DeleteProtection. Default to false.
    """
    description: pulumi.Output[str]
    """
    The description of slb listener. This description can have a string of 1 to 80 characters. Default value: null.
    """
    enable_http2: pulumi.Output[str]
    """
    Whether to enable https listener support http2 or not. Valid values are `on` and `off`. Default to `on`.
    """
    established_timeout: pulumi.Output[float]
    """
    Timeout of tcp listener established connection idle timeout. Valid value range: [10-900] in seconds. Default to 900.
    """
    forward_port: pulumi.Output[float]
    """
    The port that http redirect to https.
    """
    frontend_port: pulumi.Output[float]
    """
    Port used by the Server Load Balancer instance frontend. Valid value range: [1-65535].
    """
    gzip: pulumi.Output[bool]
    """
    Whether to enable "Gzip Compression". If enabled, files of specific file types will be compressed, otherwise, no files will be compressed. Default to true. Available in v1.13.0+.
    """
    health_check: pulumi.Output[str]
    """
    Whether to enable health check. Valid values are`on` and `off`. TCP and UDP listener's HealthCheck is always on, so it will be ignore when launching TCP or UDP listener.
    """
    health_check_connect_port: pulumi.Output[float]
    """
    Port used for health check. Valid value range: [1-65535]. Default to "None" means the backend server port is used.
    """
    health_check_domain: pulumi.Output[str]
    """
    Domain name used for health check. When it used to launch TCP listener, `health_check_type` must be "http". Its length is limited to 1-80 and only characters such as letters, digits, ‘-‘ and ‘.’ are allowed. When it is not set or empty,  Server Load Balancer uses the private network IP address of each backend server as Domain used for health check.
    """
    health_check_http_code: pulumi.Output[str]
    """
    Regular health check HTTP status code. Multiple codes are segmented by “,”. It is required when `health_check` is on. Default to `http_2xx`.  Valid values are: `http_2xx`,  `http_3xx`, `http_4xx` and `http_5xx`.
    """
    health_check_interval: pulumi.Output[float]
    """
    Time interval of health checks. It is required when `health_check` is on. Valid value range: [1-50] in seconds. Default to 2.
    """
    health_check_method: pulumi.Output[str]
    """
    The method of health check. Valid values: ["head", "get"].
    """
    health_check_timeout: pulumi.Output[float]
    """
    Maximum timeout of each health check response. It is required when `health_check` is on. Valid value range: [1-300] in seconds. Default to 5. Note: If `health_check_timeout` < `health_check_interval`, its will be replaced by `health_check_interval`.
    """
    health_check_type: pulumi.Output[str]
    """
    Type of health check. Valid values are: `tcp` and `http`. Default to `tcp` . TCP supports TCP and HTTP health check mode, you can select the particular mode depending on your application.
    """
    health_check_uri: pulumi.Output[str]
    """
    URI used for health check. When it used to launch TCP listener, `health_check_type` must be "http". Its length is limited to 1-80 and it must start with /. Only characters such as letters, digits, ‘-’, ‘/’, ‘.’, ‘%’, ‘?’, #’ and ‘&’ are allowed.
    """
    healthy_threshold: pulumi.Output[float]
    """
    Threshold determining the result of the health check is success. It is required when `health_check` is on. Valid value range: [1-10] in seconds. Default to 3.
    """
    idle_timeout: pulumi.Output[float]
    """
    Timeout of http or https listener established connection idle timeout. Valid value range: [1-60] in seconds. Default to 15.
    """
    instance_port: pulumi.Output[float]
    lb_port: pulumi.Output[float]
    lb_protocol: pulumi.Output[str]
    listener_forward: pulumi.Output[str]
    """
    Whether to enable http redirect to https, Valid values are `on` and `off`. Default to `off`.
    """
    load_balancer_id: pulumi.Output[str]
    """
    The Load Balancer ID which is used to launch a new listener.
    """
    master_slave_server_group_id: pulumi.Output[str]
    persistence_timeout: pulumi.Output[float]
    """
    Timeout of connection persistence. Valid value range: [0-3600] in seconds. Default to 0 and means closing it.
    """
    protocol: pulumi.Output[str]
    """
    The protocol to listen on. Valid values are [`http`, `https`, `tcp`, `udp`].
    """
    request_timeout: pulumi.Output[float]
    """
    Timeout of http or https listener request (which does not get response from backend) timeout. Valid value range: [1-180] in seconds. Default to 60.
    """
    scheduler: pulumi.Output[str]
    """
    Scheduling algorithm, Valid values are `wrr`, `rr` and `wlc`.  Default to "wrr".
    """
    server_certificate_id: pulumi.Output[str]
    """
    SLB Server certificate ID. It is required when `protocol` is `https`.
    """
    server_group_id: pulumi.Output[str]
    """
    the id of server group to be apply on the listener, is the id of resource `slb.ServerGroup`.
    """
    ssl_certificate_id: pulumi.Output[str]
    """
    It has been deprecated from 1.59.0 and using `server_certificate_id` instead. 
    """
    sticky_session: pulumi.Output[str]
    """
    Whether to enable session persistence, Valid values are `on` and `off`. Default to `off`.
    """
    sticky_session_type: pulumi.Output[str]
    """
    Mode for handling the cookie. If `sticky_session` is "on", it is mandatory. Otherwise, it will be ignored. Valid values are `insert` and `server`. `insert` means it is inserted from Server Load Balancer; `server` means the Server Load Balancer learns from the backend server.
    """
    tls_cipher_policy: pulumi.Output[str]
    """
    Https listener TLS cipher policy. Valid values are `tls_cipher_policy_1_0`, `tls_cipher_policy_1_1`, `tls_cipher_policy_1_2`, `tls_cipher_policy_1_2_strict`. Default to `tls_cipher_policy_1_0`. Currently the `tls_cipher_policy` can not be updated when load balancer instance is "Shared-Performance".
    """
    unhealthy_threshold: pulumi.Output[float]
    """
    Threshold determining the result of the health check is fail. It is required when `health_check` is on. Valid value range: [1-10] in seconds. Default to 3.
    """
    x_forwarded_for: pulumi.Output[dict]
    """
    Whether to set additional HTTP Header field "X-Forwarded-For" (documented below). Available in v1.13.0+.
    
      * `retriveClientIp` (`bool`)
      * `retriveSlbId` (`bool`) - Whether to use the XForwardedFor header to obtain the ID of the SLB instance. Default to false.
      * `retriveSlbIp` (`bool`) - Whether to use the XForwardedFor_SLBIP header to obtain the public IP address of the SLB instance. Default to false.
      * `retriveSlbProto` (`bool`) - Whether to use the XForwardedFor_proto header to obtain the protocol used by the listener. Default to false.
    """
    def __init__(__self__, resource_name, opts=None, acl_id=None, acl_status=None, acl_type=None, backend_port=None, bandwidth=None, cookie=None, cookie_timeout=None, delete_protection_validation=None, description=None, enable_http2=None, established_timeout=None, forward_port=None, frontend_port=None, gzip=None, health_check=None, health_check_connect_port=None, health_check_domain=None, health_check_http_code=None, health_check_interval=None, health_check_method=None, health_check_timeout=None, health_check_type=None, health_check_uri=None, healthy_threshold=None, idle_timeout=None, instance_port=None, lb_port=None, lb_protocol=None, listener_forward=None, load_balancer_id=None, master_slave_server_group_id=None, persistence_timeout=None, protocol=None, request_timeout=None, scheduler=None, server_certificate_id=None, server_group_id=None, ssl_certificate_id=None, sticky_session=None, sticky_session_type=None, tls_cipher_policy=None, unhealthy_threshold=None, x_forwarded_for=None, __props__=None, __name__=None, __opts__=None):
        """
        Provides an Application Load Balancer Listener resource.
        
        For information about slb and how to use it, see [What is Server Load Balancer](https://www.alibabacloud.com/help/doc-detail/27539.htm).
        
        For information about listener and how to use it, to see the following:
        
        * [Configure a HTTP Listener](https://www.alibabacloud.com/help/doc-detail/27592.htm).
        * [Configure a HTTPS Listener](https://www.alibabacloud.com/help/doc-detail/27593.htm).
        * [Configure a TCP Listener](https://www.alibabacloud.com/help/doc-detail/27594.htm).
        * [Configure a UDP Listener](https://www.alibabacloud.com/help/doc-detail/27595.htm).
        
        ## Listener fields and protocol mapping
        
        load balance support 4 protocal to listen on, they are `http`,`https`,`tcp`,`udp`, the every listener support which portocal following:
        
        listener parameter | support protocol | value range |
        ------------- | ------------- | ------------- | 
        backend_port | http & https & tcp & udp | 1-65535 | 
        frontend_port | http & https & tcp & udp | 1-65535 |
        protocol | http & https & tcp & udp |
        bandwidth | http & https & tcp & udp | -1 / 1-1000 |
        scheduler | http & https & tcp & udp | wrr rr or wlc |
        sticky_session | http & https | on or off |
        sticky_session_type | http & https | insert or server | 
        cookie_timeout | http & https | 1-86400  | 
        cookie | http & https |   | 
        persistence_timeout | tcp & udp | 0-3600 | 
        health_check | http & https | on or off | 
        health_check_type | tcp | tcp or http | 
        health_check_domain | http & https & tcp | 
        health_check_method | http & https & tcp | 
        health_check_uri | http & https & tcp |  | 
        health_check_connect_port | http & https & tcp & udp | 1-65535 or -520 | 
        healthy_threshold | http & https & tcp & udp | 1-10 | 
        unhealthy_threshold | http & https & tcp & udp | 1-10 | 
        health_check_timeout | http & https & tcp & udp | 1-300 |
        health_check_interval | http & https & tcp & udp | 1-50 |
        health_check_http_code | http & https & tcp | http_2xx,http_3xx,http_4xx,http_5xx | 
        server_certificate_id | https |  |
        gzip | http & https | true or false  |
        x_forwarded_for | http & https |  |
        acl_status | http & https & tcp & udp | on or off |
        acl_type   | http & https & tcp & udp | white or black |
        acl_id     | http & https & tcp & udp | the id of resource alicloud_slb_acl|
        established_timeout | tcp       | 10-900|
        idle_timeout |http & https      | 1-60  |
        request_timeout |http & https   | 1-180 |
        enable_http2    |https          | on or off |
        tls_cipher_policy |https        |  tls_cipher_policy_1_0, tls_cipher_policy_1_1, tls_cipher_policy_1_2, tls_cipher_policy_1_2_strict |
        server_group_id    | http & https & tcp & udp | the id of resource slb.ServerGroup |
        
        The listener mapping supports the following:
        
        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] acl_id: the id of access control list to be apply on the listener, is the id of resource alicloud_slb_acl. If `acl_status` is "on", it is mandatory. Otherwise, it will be ignored.
        :param pulumi.Input[str] acl_status: Whether to enable "acl(access control list)", the acl is specified by `acl_id`. Valid values are `on` and `off`. Default to `off`.
        :param pulumi.Input[str] acl_type: Mode for handling the acl specified by acl_id. If `acl_status` is "on", it is mandatory. Otherwise, it will be ignored. Valid values are `white` and `black`. `white` means the Listener can only be accessed by client ip belongs to the acl; `black` means the Listener can not be accessed by client ip belongs to the acl.
        :param pulumi.Input[float] backend_port: Port used by the Server Load Balancer instance backend. Valid value range: [1-65535].
        :param pulumi.Input[float] bandwidth: Bandwidth peak of Listener. For the public network instance charged per traffic consumed, the Bandwidth on Listener can be set to -1, indicating the bandwidth peak is unlimited. Valid values are [-1, 1-1000] in Mbps.
        :param pulumi.Input[str] cookie: The cookie configured on the server. It is mandatory when `sticky_session` is "on" and `sticky_session_type` is "server". Otherwise, it will be ignored. Valid value：String in line with RFC 2965, with length being 1- 200. It only contains characters such as ASCII codes, English letters and digits instead of the comma, semicolon or spacing, and it cannot start with $.
        :param pulumi.Input[float] cookie_timeout: Cookie timeout. It is mandatory when `sticky_session` is "on" and `sticky_session_type` is "insert". Otherwise, it will be ignored. Valid value range: [1-86400] in seconds.
        :param pulumi.Input[bool] delete_protection_validation: Checking DeleteProtection of SLB instance before deleting. If true, this resource will not be deleted when its SLB instance enabled DeleteProtection. Default to false.
        :param pulumi.Input[str] description: The description of slb listener. This description can have a string of 1 to 80 characters. Default value: null.
        :param pulumi.Input[str] enable_http2: Whether to enable https listener support http2 or not. Valid values are `on` and `off`. Default to `on`.
        :param pulumi.Input[float] established_timeout: Timeout of tcp listener established connection idle timeout. Valid value range: [10-900] in seconds. Default to 900.
        :param pulumi.Input[float] forward_port: The port that http redirect to https.
        :param pulumi.Input[float] frontend_port: Port used by the Server Load Balancer instance frontend. Valid value range: [1-65535].
        :param pulumi.Input[bool] gzip: Whether to enable "Gzip Compression". If enabled, files of specific file types will be compressed, otherwise, no files will be compressed. Default to true. Available in v1.13.0+.
        :param pulumi.Input[str] health_check: Whether to enable health check. Valid values are`on` and `off`. TCP and UDP listener's HealthCheck is always on, so it will be ignore when launching TCP or UDP listener.
        :param pulumi.Input[float] health_check_connect_port: Port used for health check. Valid value range: [1-65535]. Default to "None" means the backend server port is used.
        :param pulumi.Input[str] health_check_domain: Domain name used for health check. When it used to launch TCP listener, `health_check_type` must be "http". Its length is limited to 1-80 and only characters such as letters, digits, ‘-‘ and ‘.’ are allowed. When it is not set or empty,  Server Load Balancer uses the private network IP address of each backend server as Domain used for health check.
        :param pulumi.Input[str] health_check_http_code: Regular health check HTTP status code. Multiple codes are segmented by “,”. It is required when `health_check` is on. Default to `http_2xx`.  Valid values are: `http_2xx`,  `http_3xx`, `http_4xx` and `http_5xx`.
        :param pulumi.Input[float] health_check_interval: Time interval of health checks. It is required when `health_check` is on. Valid value range: [1-50] in seconds. Default to 2.
        :param pulumi.Input[str] health_check_method: The method of health check. Valid values: ["head", "get"].
        :param pulumi.Input[float] health_check_timeout: Maximum timeout of each health check response. It is required when `health_check` is on. Valid value range: [1-300] in seconds. Default to 5. Note: If `health_check_timeout` < `health_check_interval`, its will be replaced by `health_check_interval`.
        :param pulumi.Input[str] health_check_type: Type of health check. Valid values are: `tcp` and `http`. Default to `tcp` . TCP supports TCP and HTTP health check mode, you can select the particular mode depending on your application.
        :param pulumi.Input[str] health_check_uri: URI used for health check. When it used to launch TCP listener, `health_check_type` must be "http". Its length is limited to 1-80 and it must start with /. Only characters such as letters, digits, ‘-’, ‘/’, ‘.’, ‘%’, ‘?’, #’ and ‘&’ are allowed.
        :param pulumi.Input[float] healthy_threshold: Threshold determining the result of the health check is success. It is required when `health_check` is on. Valid value range: [1-10] in seconds. Default to 3.
        :param pulumi.Input[float] idle_timeout: Timeout of http or https listener established connection idle timeout. Valid value range: [1-60] in seconds. Default to 15.
        :param pulumi.Input[str] listener_forward: Whether to enable http redirect to https, Valid values are `on` and `off`. Default to `off`.
        :param pulumi.Input[str] load_balancer_id: The Load Balancer ID which is used to launch a new listener.
        :param pulumi.Input[float] persistence_timeout: Timeout of connection persistence. Valid value range: [0-3600] in seconds. Default to 0 and means closing it.
        :param pulumi.Input[str] protocol: The protocol to listen on. Valid values are [`http`, `https`, `tcp`, `udp`].
        :param pulumi.Input[float] request_timeout: Timeout of http or https listener request (which does not get response from backend) timeout. Valid value range: [1-180] in seconds. Default to 60.
        :param pulumi.Input[str] scheduler: Scheduling algorithm, Valid values are `wrr`, `rr` and `wlc`.  Default to "wrr".
        :param pulumi.Input[str] server_certificate_id: SLB Server certificate ID. It is required when `protocol` is `https`.
        :param pulumi.Input[str] server_group_id: the id of server group to be apply on the listener, is the id of resource `slb.ServerGroup`.
        :param pulumi.Input[str] ssl_certificate_id: It has been deprecated from 1.59.0 and using `server_certificate_id` instead. 
        :param pulumi.Input[str] sticky_session: Whether to enable session persistence, Valid values are `on` and `off`. Default to `off`.
        :param pulumi.Input[str] sticky_session_type: Mode for handling the cookie. If `sticky_session` is "on", it is mandatory. Otherwise, it will be ignored. Valid values are `insert` and `server`. `insert` means it is inserted from Server Load Balancer; `server` means the Server Load Balancer learns from the backend server.
        :param pulumi.Input[str] tls_cipher_policy: Https listener TLS cipher policy. Valid values are `tls_cipher_policy_1_0`, `tls_cipher_policy_1_1`, `tls_cipher_policy_1_2`, `tls_cipher_policy_1_2_strict`. Default to `tls_cipher_policy_1_0`. Currently the `tls_cipher_policy` can not be updated when load balancer instance is "Shared-Performance".
        :param pulumi.Input[float] unhealthy_threshold: Threshold determining the result of the health check is fail. It is required when `health_check` is on. Valid value range: [1-10] in seconds. Default to 3.
        :param pulumi.Input[dict] x_forwarded_for: Whether to set additional HTTP Header field "X-Forwarded-For" (documented below). Available in v1.13.0+.
        
        The **x_forwarded_for** object supports the following:
        
          * `retriveClientIp` (`pulumi.Input[bool]`)
          * `retriveSlbId` (`pulumi.Input[bool]`) - Whether to use the XForwardedFor header to obtain the ID of the SLB instance. Default to false.
          * `retriveSlbIp` (`pulumi.Input[bool]`) - Whether to use the XForwardedFor_SLBIP header to obtain the public IP address of the SLB instance. Default to false.
          * `retriveSlbProto` (`pulumi.Input[bool]`) - Whether to use the XForwardedFor_proto header to obtain the protocol used by the listener. Default to false.

        > This content is derived from https://github.com/terraform-providers/terraform-provider-alicloud/blob/master/website/docs/r/slb_listener.html.markdown.
        """
        if __name__ is not None:
            warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
            resource_name = __name__
        if __opts__ is not None:
            warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
            opts = __opts__
        if opts is None:
            opts = pulumi.ResourceOptions()
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.version is None:
            opts.version = utilities.get_version()
        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__ = dict()

            __props__['acl_id'] = acl_id
            __props__['acl_status'] = acl_status
            __props__['acl_type'] = acl_type
            __props__['backend_port'] = backend_port
            __props__['bandwidth'] = bandwidth
            __props__['cookie'] = cookie
            __props__['cookie_timeout'] = cookie_timeout
            __props__['delete_protection_validation'] = delete_protection_validation
            __props__['description'] = description
            __props__['enable_http2'] = enable_http2
            __props__['established_timeout'] = established_timeout
            __props__['forward_port'] = forward_port
            if frontend_port is None:
                raise TypeError("Missing required property 'frontend_port'")
            __props__['frontend_port'] = frontend_port
            __props__['gzip'] = gzip
            __props__['health_check'] = health_check
            __props__['health_check_connect_port'] = health_check_connect_port
            __props__['health_check_domain'] = health_check_domain
            __props__['health_check_http_code'] = health_check_http_code
            __props__['health_check_interval'] = health_check_interval
            __props__['health_check_method'] = health_check_method
            __props__['health_check_timeout'] = health_check_timeout
            __props__['health_check_type'] = health_check_type
            __props__['health_check_uri'] = health_check_uri
            __props__['healthy_threshold'] = healthy_threshold
            __props__['idle_timeout'] = idle_timeout
            __props__['instance_port'] = instance_port
            __props__['lb_port'] = lb_port
            __props__['lb_protocol'] = lb_protocol
            __props__['listener_forward'] = listener_forward
            if load_balancer_id is None:
                raise TypeError("Missing required property 'load_balancer_id'")
            __props__['load_balancer_id'] = load_balancer_id
            __props__['master_slave_server_group_id'] = master_slave_server_group_id
            __props__['persistence_timeout'] = persistence_timeout
            if protocol is None:
                raise TypeError("Missing required property 'protocol'")
            __props__['protocol'] = protocol
            __props__['request_timeout'] = request_timeout
            __props__['scheduler'] = scheduler
            __props__['server_certificate_id'] = server_certificate_id
            __props__['server_group_id'] = server_group_id
            __props__['ssl_certificate_id'] = ssl_certificate_id
            __props__['sticky_session'] = sticky_session
            __props__['sticky_session_type'] = sticky_session_type
            __props__['tls_cipher_policy'] = tls_cipher_policy
            __props__['unhealthy_threshold'] = unhealthy_threshold
            __props__['x_forwarded_for'] = x_forwarded_for
        super(Listener, __self__).__init__(
            'alicloud:slb/listener:Listener',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name, id, opts=None, acl_id=None, acl_status=None, acl_type=None, backend_port=None, bandwidth=None, cookie=None, cookie_timeout=None, delete_protection_validation=None, description=None, enable_http2=None, established_timeout=None, forward_port=None, frontend_port=None, gzip=None, health_check=None, health_check_connect_port=None, health_check_domain=None, health_check_http_code=None, health_check_interval=None, health_check_method=None, health_check_timeout=None, health_check_type=None, health_check_uri=None, healthy_threshold=None, idle_timeout=None, instance_port=None, lb_port=None, lb_protocol=None, listener_forward=None, load_balancer_id=None, master_slave_server_group_id=None, persistence_timeout=None, protocol=None, request_timeout=None, scheduler=None, server_certificate_id=None, server_group_id=None, ssl_certificate_id=None, sticky_session=None, sticky_session_type=None, tls_cipher_policy=None, unhealthy_threshold=None, x_forwarded_for=None):
        """
        Get an existing Listener 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 str id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] acl_id: the id of access control list to be apply on the listener, is the id of resource alicloud_slb_acl. If `acl_status` is "on", it is mandatory. Otherwise, it will be ignored.
        :param pulumi.Input[str] acl_status: Whether to enable "acl(access control list)", the acl is specified by `acl_id`. Valid values are `on` and `off`. Default to `off`.
        :param pulumi.Input[str] acl_type: Mode for handling the acl specified by acl_id. If `acl_status` is "on", it is mandatory. Otherwise, it will be ignored. Valid values are `white` and `black`. `white` means the Listener can only be accessed by client ip belongs to the acl; `black` means the Listener can not be accessed by client ip belongs to the acl.
        :param pulumi.Input[float] backend_port: Port used by the Server Load Balancer instance backend. Valid value range: [1-65535].
        :param pulumi.Input[float] bandwidth: Bandwidth peak of Listener. For the public network instance charged per traffic consumed, the Bandwidth on Listener can be set to -1, indicating the bandwidth peak is unlimited. Valid values are [-1, 1-1000] in Mbps.
        :param pulumi.Input[str] cookie: The cookie configured on the server. It is mandatory when `sticky_session` is "on" and `sticky_session_type` is "server". Otherwise, it will be ignored. Valid value：String in line with RFC 2965, with length being 1- 200. It only contains characters such as ASCII codes, English letters and digits instead of the comma, semicolon or spacing, and it cannot start with $.
        :param pulumi.Input[float] cookie_timeout: Cookie timeout. It is mandatory when `sticky_session` is "on" and `sticky_session_type` is "insert". Otherwise, it will be ignored. Valid value range: [1-86400] in seconds.
        :param pulumi.Input[bool] delete_protection_validation: Checking DeleteProtection of SLB instance before deleting. If true, this resource will not be deleted when its SLB instance enabled DeleteProtection. Default to false.
        :param pulumi.Input[str] description: The description of slb listener. This description can have a string of 1 to 80 characters. Default value: null.
        :param pulumi.Input[str] enable_http2: Whether to enable https listener support http2 or not. Valid values are `on` and `off`. Default to `on`.
        :param pulumi.Input[float] established_timeout: Timeout of tcp listener established connection idle timeout. Valid value range: [10-900] in seconds. Default to 900.
        :param pulumi.Input[float] forward_port: The port that http redirect to https.
        :param pulumi.Input[float] frontend_port: Port used by the Server Load Balancer instance frontend. Valid value range: [1-65535].
        :param pulumi.Input[bool] gzip: Whether to enable "Gzip Compression". If enabled, files of specific file types will be compressed, otherwise, no files will be compressed. Default to true. Available in v1.13.0+.
        :param pulumi.Input[str] health_check: Whether to enable health check. Valid values are`on` and `off`. TCP and UDP listener's HealthCheck is always on, so it will be ignore when launching TCP or UDP listener.
        :param pulumi.Input[float] health_check_connect_port: Port used for health check. Valid value range: [1-65535]. Default to "None" means the backend server port is used.
        :param pulumi.Input[str] health_check_domain: Domain name used for health check. When it used to launch TCP listener, `health_check_type` must be "http". Its length is limited to 1-80 and only characters such as letters, digits, ‘-‘ and ‘.’ are allowed. When it is not set or empty,  Server Load Balancer uses the private network IP address of each backend server as Domain used for health check.
        :param pulumi.Input[str] health_check_http_code: Regular health check HTTP status code. Multiple codes are segmented by “,”. It is required when `health_check` is on. Default to `http_2xx`.  Valid values are: `http_2xx`,  `http_3xx`, `http_4xx` and `http_5xx`.
        :param pulumi.Input[float] health_check_interval: Time interval of health checks. It is required when `health_check` is on. Valid value range: [1-50] in seconds. Default to 2.
        :param pulumi.Input[str] health_check_method: The method of health check. Valid values: ["head", "get"].
        :param pulumi.Input[float] health_check_timeout: Maximum timeout of each health check response. It is required when `health_check` is on. Valid value range: [1-300] in seconds. Default to 5. Note: If `health_check_timeout` < `health_check_interval`, its will be replaced by `health_check_interval`.
        :param pulumi.Input[str] health_check_type: Type of health check. Valid values are: `tcp` and `http`. Default to `tcp` . TCP supports TCP and HTTP health check mode, you can select the particular mode depending on your application.
        :param pulumi.Input[str] health_check_uri: URI used for health check. When it used to launch TCP listener, `health_check_type` must be "http". Its length is limited to 1-80 and it must start with /. Only characters such as letters, digits, ‘-’, ‘/’, ‘.’, ‘%’, ‘?’, #’ and ‘&’ are allowed.
        :param pulumi.Input[float] healthy_threshold: Threshold determining the result of the health check is success. It is required when `health_check` is on. Valid value range: [1-10] in seconds. Default to 3.
        :param pulumi.Input[float] idle_timeout: Timeout of http or https listener established connection idle timeout. Valid value range: [1-60] in seconds. Default to 15.
        :param pulumi.Input[str] listener_forward: Whether to enable http redirect to https, Valid values are `on` and `off`. Default to `off`.
        :param pulumi.Input[str] load_balancer_id: The Load Balancer ID which is used to launch a new listener.
        :param pulumi.Input[float] persistence_timeout: Timeout of connection persistence. Valid value range: [0-3600] in seconds. Default to 0 and means closing it.
        :param pulumi.Input[str] protocol: The protocol to listen on. Valid values are [`http`, `https`, `tcp`, `udp`].
        :param pulumi.Input[float] request_timeout: Timeout of http or https listener request (which does not get response from backend) timeout. Valid value range: [1-180] in seconds. Default to 60.
        :param pulumi.Input[str] scheduler: Scheduling algorithm, Valid values are `wrr`, `rr` and `wlc`.  Default to "wrr".
        :param pulumi.Input[str] server_certificate_id: SLB Server certificate ID. It is required when `protocol` is `https`.
        :param pulumi.Input[str] server_group_id: the id of server group to be apply on the listener, is the id of resource `slb.ServerGroup`.
        :param pulumi.Input[str] ssl_certificate_id: It has been deprecated from 1.59.0 and using `server_certificate_id` instead. 
        :param pulumi.Input[str] sticky_session: Whether to enable session persistence, Valid values are `on` and `off`. Default to `off`.
        :param pulumi.Input[str] sticky_session_type: Mode for handling the cookie. If `sticky_session` is "on", it is mandatory. Otherwise, it will be ignored. Valid values are `insert` and `server`. `insert` means it is inserted from Server Load Balancer; `server` means the Server Load Balancer learns from the backend server.
        :param pulumi.Input[str] tls_cipher_policy: Https listener TLS cipher policy. Valid values are `tls_cipher_policy_1_0`, `tls_cipher_policy_1_1`, `tls_cipher_policy_1_2`, `tls_cipher_policy_1_2_strict`. Default to `tls_cipher_policy_1_0`. Currently the `tls_cipher_policy` can not be updated when load balancer instance is "Shared-Performance".
        :param pulumi.Input[float] unhealthy_threshold: Threshold determining the result of the health check is fail. It is required when `health_check` is on. Valid value range: [1-10] in seconds. Default to 3.
        :param pulumi.Input[dict] x_forwarded_for: Whether to set additional HTTP Header field "X-Forwarded-For" (documented below). Available in v1.13.0+.
        
        The **x_forwarded_for** object supports the following:
        
          * `retriveClientIp` (`pulumi.Input[bool]`)
          * `retriveSlbId` (`pulumi.Input[bool]`) - Whether to use the XForwardedFor header to obtain the ID of the SLB instance. Default to false.
          * `retriveSlbIp` (`pulumi.Input[bool]`) - Whether to use the XForwardedFor_SLBIP header to obtain the public IP address of the SLB instance. Default to false.
          * `retriveSlbProto` (`pulumi.Input[bool]`) - Whether to use the XForwardedFor_proto header to obtain the protocol used by the listener. Default to false.

        > This content is derived from https://github.com/terraform-providers/terraform-provider-alicloud/blob/master/website/docs/r/slb_listener.html.markdown.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()
        __props__["acl_id"] = acl_id
        __props__["acl_status"] = acl_status
        __props__["acl_type"] = acl_type
        __props__["backend_port"] = backend_port
        __props__["bandwidth"] = bandwidth
        __props__["cookie"] = cookie
        __props__["cookie_timeout"] = cookie_timeout
        __props__["delete_protection_validation"] = delete_protection_validation
        __props__["description"] = description
        __props__["enable_http2"] = enable_http2
        __props__["established_timeout"] = established_timeout
        __props__["forward_port"] = forward_port
        __props__["frontend_port"] = frontend_port
        __props__["gzip"] = gzip
        __props__["health_check"] = health_check
        __props__["health_check_connect_port"] = health_check_connect_port
        __props__["health_check_domain"] = health_check_domain
        __props__["health_check_http_code"] = health_check_http_code
        __props__["health_check_interval"] = health_check_interval
        __props__["health_check_method"] = health_check_method
        __props__["health_check_timeout"] = health_check_timeout
        __props__["health_check_type"] = health_check_type
        __props__["health_check_uri"] = health_check_uri
        __props__["healthy_threshold"] = healthy_threshold
        __props__["idle_timeout"] = idle_timeout
        __props__["instance_port"] = instance_port
        __props__["lb_port"] = lb_port
        __props__["lb_protocol"] = lb_protocol
        __props__["listener_forward"] = listener_forward
        __props__["load_balancer_id"] = load_balancer_id
        __props__["master_slave_server_group_id"] = master_slave_server_group_id
        __props__["persistence_timeout"] = persistence_timeout
        __props__["protocol"] = protocol
        __props__["request_timeout"] = request_timeout
        __props__["scheduler"] = scheduler
        __props__["server_certificate_id"] = server_certificate_id
        __props__["server_group_id"] = server_group_id
        __props__["ssl_certificate_id"] = ssl_certificate_id
        __props__["sticky_session"] = sticky_session
        __props__["sticky_session_type"] = sticky_session_type
        __props__["tls_cipher_policy"] = tls_cipher_policy
        __props__["unhealthy_threshold"] = unhealthy_threshold
        __props__["x_forwarded_for"] = x_forwarded_for
        return Listener(resource_name, opts=opts, __props__=__props__)
    def translate_output_property(self, prop):
        return tables._CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop

    def translate_input_property(self, prop):
        return tables._SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop

