Updated on 2022-08-15 GMT+08:00

Querying Listeners

Function

This API is used to query the listeners and display them in a list. Filter query and pagination query are supported. Unless otherwise specified, exact match is applied.

You can query listeners using information such as listener ID, protocol used by the listener, port used by the listener, or backend server private IP address.

URI

GET /v2/{project_id}/elb/listeners

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

marker

No

String

Specifies the ID of the listener from which pagination query starts, that is, the ID of the last listener on the previous page.

This parameter must be used together with limit.

limit

No

Integer

Specifies the number of listeners on each page. If this parameter is not set, all listeners are queried by default.

page_reverse

No

Boolean

Specifies the page direction. The value can be true or false, and the default value is false. The last page in the list requested with page_reverse set to false will not contain the "next" link, and the last page in the list requested with page_reverse set to true will not contain the "previous" link.

This parameter must be used together with limit.

id

No

String

Specifies the listener ID.

name

No

String

Specifies the listener name.

The value contains a maximum of 255 characters.

description

No

String

Provides supplementary information about the listener.

The value contains a maximum of 255 characters.

loadbalancer_id

No

String

Specifies the ID of the associated load balancer.

connection_limit

No

Integer

Specifies the maximum number of connections.

admin_state_up

No

Boolean

Specifies the administrative status of the listener.

This parameter is reserved, and the default value is true.

default_pool_id

No

String

Specifies the ID of the associated backend server group.

If a request does not match the forwarding policy, the request is forwarded to the default backend server group for processing.

http2_enable

No

Boolean

Specifies whether to use HTTP/2.

The value can be true or false.

  • true: HTTP/2 is used.
  • false: HTTP/2 is not used.

default_tls_container_ref

No

String

Specifies the ID of the server certificate used by the listener.

client_ca_tls_container_ref

No

String

Specifies the ID of the CA certificate used by the listener.

protocol

No

String

Specifies the protocol used by the listener.

The value can be TCP, HTTP, UDP, or TERMINATED_HTTPS.

protocol_port

No

Integer

Specifies the port used by the listener.

enterprise_project_id

No

String

Specifies the enterprise project ID. Enterprise projects are used for fine-grained authentication.

  • If default_pool_id is passed, the ID of the enterprise project to which the backend server group belongs is used for authentication.
  • If neither default_pool_id nor enterprise_project_id is passed, fine-grained authentication is performed. The elb:loadbalancers:list permissions must be assigned to the user group.

Request

None

Response

Table 3 Response parameters

Parameter

Type

Description

listeners

Array of Listeners objects

Lists the listeners. For details, see Table 4.

Table 4 listener parameter description

Parameter

Type

Description

id

String

Specifies the listener ID.

tenant_id

String

Specifies the ID of the project where the listener is used.

The value contains a maximum of 255 characters.

name

String

Specifies the listener name.

The value contains a maximum of 255 characters.

description

String

Provides supplementary information about the listener.

The value contains a maximum of 255 characters.

protocol

String

Specifies the protocol used by the listener.

The value can be TCP, HTTP, UDP, or TERMINATED_HTTPS.

protocol_port

Integer

Specifies the port used by the listener.

The port number ranges from 1 to 65535.

loadbalancers

Array of Loadbalancers objects

Specifies the ID of the associated load balancer. For details, see Table 6.

connection_limit

Integer

Specifies the maximum number of connections.

The value ranges from -1 to 2147483647. The default value is -1, indicating that there is no restriction on the maximum number of connections.

This parameter is reserved.

admin_state_up

Boolean

Specifies the administrative status of the listener.

This parameter is reserved. The value can be true or false.

  • true: Enabled
  • false: Disabled

http2_enable

Boolean

Specifies whether to use HTTP/2.

The value can be true or false.

  • true: HTTP/2 is used.
  • false: HTTP/2 is not used.

This parameter takes effect only when the protocol used by the listener is set to TERMINATED_HTTPS.

default_pool_id

String

Specifies the ID of the associated backend server group.

If a request does not match the forwarding policy, the request is forwarded to the default backend server group for processing. If the value is null, the listener has no default backend server group.

default_tls_container_ref

String

Specifies the ID of the server certificate used by the listener. For details, see Certificate.

This parameter is mandatory when protocol is set to TERMINATED_HTTPS.

The value contains a maximum of 128 characters.

client_ca_tls_container_ref

String

Specifies the ID of the CA certificate used by the listener.

The value contains a maximum of 128 characters.

For details, see Certificate.

sni_container_refs

Array

Lists the IDs of SNI certificates (server certificates with domain names) used by the listener.

If the parameter value is an empty list, the SNI feature is disabled.

tags

Array

Tags the listener.

created_at

String

Specifies the time when the listener was created. YYYY-MM-DDTHH:MM:SS

updated_at

String

Specifies the time when the listener was updated. YYYY-MM-DDTHH:MM:SS

Table 5 loadbalancers parameter description

Parameter

Mandatory

Type

Description

id

Yes

String

Specifies the ID of the associated load balancer.

Example Request

  • Example request 1: Querying all listeners
    GET https://{Endpoint}/v2/601240b9c5c94059b63d484c92cfe308/elb/listeners
  • Request example 2: Querying UDP listeners
    GET https://{Endpoint}/v2/601240b9c5c94059b63d484c92cfe308/elb/listeners?protocol=UDP

Example Response

  • Example response 1
    {
        "listeners": [
            {
                "client_ca_tls_container_ref": null,
                "protocol": "TCP",
                "description": "",
                "default_tls_container_ref": null,
                "admin_state_up": true,
                "http2_enable": false,
                "loadbalancers": [
                    {
                        "id": "bc7ba445-035a-4464-a1a3-a62cf4a14116"
                    }
                ],
                "tenant_id": "601240b9c5c94059b63d484c92cfe308",
     
                "sni_container_refs": [],       
     
                "connection_limit": -1,
                "protocol_port": 80,
                "default_pool_id": "ed75f16e-fcc6-403e-a3fb-4eae82005eab",
                "id": "75045172-70e9-480d-9443-b8b6459948f7",
                "tags": [],
                "name": "listener-cb2n",
                "created_at": "2018-07-25T01:54:13", 
                "updated_at": "2018-07-25T01:54:14"
      
            },
            {
                "client_ca_tls_container_ref": null,
                "protocol": "TCP",
                "description": "",
                "default_tls_container_ref": null,
                "admin_state_up": true,
                "http2_enable": false,
                "loadbalancers": [
                    {
                        "id": "165b6a38-5278-4569-b747-b2ee65ea84a4"
                    }
                ],
                "tenant_id": "601240b9c5c94059b63d484c92cfe308",
                "sni_container_refs": [],           
     
                "connection_limit": -1,
                "protocol_port": 8080,
                "default_pool_id": null,
                "id": "dada0003-7b0e-4de8-a4e1-1e937be2ba14",
                "tags": [],
                "name": "lsnr_name_mod",
                "created_at": "2018-07-25T01:54:13", 
                "updated_at": "2018-07-25T01:54:14"
            }
        ]
    }
  • Example response 2
    {
        "listeners": [
            {
                "insert_headers": null,
                "protocol_port": 64809,
                "protocol": "UDP",
                "description": "",
                "default_tls_container_ref": null,
                "sni_container_refs": [],
                "loadbalancers": [
                    {
                        "id": "c1127125-64a9-4394-a08a-ef3be8f7ef9c"
                    }
                ],
                "tenant_id": "601240b9c5c94059b63d484c92cfe308",
     
                "created_at": "2018-11-29T13:56:21",
                "client_ca_tls_container_ref": null,
                "connection_limit": -1,
                "updated_at": "2018-11-29T13:56:22",
                "http2_enable": false,
     
                "admin_state_up": true,
                "default_pool_id": "2f6895be-019b-4c82-9b53-c4a2ac009e20",
                "id": "5c63d176-444f-4c75-9cfe-bcb8a05a845c",
                "tags": [],
                "name": "listener-tvp8"
            }
        ]
    }

Status Code

For details, see Status Codes.