1. 接口描述
接口请求域名: clb.tencentcloudapi.com 。
DescribeListeners 接口可根据负载均衡器 ID、监听器的协议或端口作为过滤条件获取监听器列表。如果不指定任何过滤条件,则返回该负载均衡实例下的所有监听器。
默认接口请求频率限制:20次/秒。
推荐使用 API Explorer
点击调试
API Explorer 提供了在线调用、签名验证、SDK 代码生成和快速检索接口等能力。您可查看每次调用的请求内容和返回结果以及自动生成 SDK 调用示例。
2. 输入参数
以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数。
参数名称 | 必选 | 类型 | 描述 |
---|---|---|---|
Action | 是 | String | 公共参数,本接口取值:DescribeListeners。 |
Version | 是 | String | 公共参数,本接口取值:2018-03-17。 |
Region | 是 | String | 公共参数,详见产品支持的 地域列表。 |
LoadBalancerId | 是 | String | 负载均衡实例 ID。 |
ListenerIds.N | 否 | Array of String | 要查询的负载均衡监听器 ID 数组,最大为100个。 |
Protocol | 否 | String | 要查询的监听器协议类型,取值 TCP | UDP | HTTP | HTTPS | TCP_SSL。 |
Port | 否 | Integer | 要查询的监听器的端口。 |
3. 输出参数
参数名称 | 类型 | 描述 |
---|---|---|
Listeners | Array of Listener | 监听器列表。 |
TotalCount | Integer | 总的监听器个数(根据端口、协议、监听器ID过滤后)。 注意:此字段可能返回 null,表示取不到有效值。 |
RequestId | String | 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 |
4. 示例
示例1 查询负载均衡实例下的全部监听器信息
输入示例
https://clb.tencentcloudapi.com/?Action=DescribeListeners
&LoadBalancerId=lb-aniq7ewx
&<公共请求参数>
输出示例
{
"Response": {
"TotalCount": 3,
"Listeners": [
{
"ListenerId": "lbl-2ytsji1u",
"ListenerName": "555",
"CreateTime": "2020-12-31 11:36:18",
"Protocol": "HTTP",
"Port": 555,
"EndPort": 0,
"HealthCheck": null,
"Certificate": null,
"Scheduler": null,
"SessionExpireTime": null,
"SniSwitch": 0,
"Rules": [
{
"ListenerId": "lbl-2ytsji1u",
"LocationId": "loc-nq5fuotq",
"Domain": "www.123.com",
"Url": "/123",
"CreateTime": "2020-12-31 11:36:48",
"Certificate": null,
"HealthCheck": {
"HealthSwitch": 1,
"TimeOut": 5,
"IntervalTime": 5,
"HealthNum": 3,
"UnHealthNum": 3,
"HttpCode": 15,
"HttpCheckPath": "/",
"HttpCheckDomain": "www.123.com",
"HttpCheckMethod": "get",
"CheckPort": null,
"CheckType": "TCP",
"HttpVersion": null,
"ContextType": null,
"SendContext": null,
"RecvContext": null
},
"RewriteTarget": {
"TargetListenerId": null,
"TargetLocationId": null,
"RewriteCode": null,
"TakeUrl": null,
"RewriteType": null
},
"SessionExpireTime": 0,
"Scheduler": "WRR",
"HttpGzip": true,
"BeAutoCreated": false,
"DefaultServer": true,
"Http2": false,
"ForwardType": "HTTP",
"TargetType": "NODE",
"TargetGroup": null,
"WafDomainId": "",
"TrpcCallee": "",
"TrpcFunc": "",
"QuicStatus": "OFF"
}
],
"TargetType": null,
"TargetGroup": null,
"KeepaliveEnable": 0,
"SessionType": "NORMAL",
"Toa": false,
"DeregisterTargetRst": false
},
{
"ListenerId": "lbl-a459zzae",
"ListenerName": "222",
"CreateTime": "2020-12-10 20:26:54",
"Protocol": "HTTP",
"Port": 222,
"EndPort": 0,
"HealthCheck": null,
"Certificate": null,
"Scheduler": null,
"SessionExpireTime": null,
"SniSwitch": 0,
"Rules": [
{
"ListenerId": "lbl-a459zzae",
"LocationId": "loc-7pbxg3d4",
"Domain": "www.123.com",
"Url": "/",
"CreateTime": "2020-12-10 20:33:14",
"Certificate": null,
"HealthCheck": {
"HealthSwitch": 1,
"TimeOut": 5,
"IntervalTime": 5,
"HealthNum": 3,
"UnHealthNum": 3,
"HttpCode": 15,
"HttpCheckPath": "/",
"HttpCheckDomain": "www.123.com",
"HttpCheckMethod": "get",
"CheckPort": null,
"CheckType": "TCP",
"HttpVersion": null,
"ContextType": null,
"SendContext": null,
"RecvContext": null
},
"RewriteTarget": {
"TargetListenerId": null,
"TargetLocationId": null,
"RewriteCode": null,
"TakeUrl": null,
"RewriteType": null
},
"SessionExpireTime": 0,
"Scheduler": "WRR",
"HttpGzip": true,
"BeAutoCreated": false,
"DefaultServer": true,
"Http2": false,
"ForwardType": "HTTP",
"TargetType": "NODE",
"TargetGroup": null,
"WafDomainId": "",
"TrpcCallee": "",
"TrpcFunc": "",
"QuicStatus": "OFF"
}
],
"TargetType": null,
"TargetGroup": null,
"KeepaliveEnable": 0,
"SessionType": "NORMAL",
"Toa": false,
"DeregisterTargetRst": false
}
],
"RequestId": "2682e290-3f8c-4766-98fa-716610e2d351"
}
}
示例2 按照端口、协议及监听器ID查询监听器
输入示例
https://clb.tencentcloudapi.com/?Action=DescribeListeners
&LoadBalancerId=lb-aniq7ewx
&Protocol=TCP
&Port=333
&ListenerIds.0=lbl-hd9nfp6o
&<公共请求参数>
输出示例
{
"Response": {
"TotalCount": 1,
"Listeners": [
{
"ListenerId": "lbl-hd9nfp6o",
"ListenerName": "12345",
"CreateTime": "2020-12-31 12:03:36",
"Protocol": "TCP",
"Port": 333,
"EndPort": 0,
"HealthCheck": {
"HealthSwitch": 1,
"TimeOut": 2,
"IntervalTime": 5,
"HealthNum": 3,
"UnHealthNum": 3,
"CheckPort": null,
"CheckType": "TCP",
"HttpCheckDomain": null,
"HttpCheckPath": null,
"HttpCheckMethod": null,
"HttpVersion": null,
"HttpCode": null,
"ContextType": null,
"SendContext": null,
"RecvContext": null
},
"Certificate": null,
"Scheduler": "WRR",
"SessionExpireTime": 0,
"SniSwitch": 0,
"Rules": null,
"TargetType": "NODE",
"TargetGroup": null,
"KeepaliveEnable": null,
"SessionType": "NORMAL",
"Toa": false,
"DeregisterTargetRst": false
}
],
"RequestId": "3ddae670-4a89-4919-af6e-0d6bf195c92e"
}
}
5. 开发者资源
腾讯云 API 平台
腾讯云 API 平台 是综合 API 文档、错误码、API Explorer 及 SDK 等资源的统一查询平台,方便您从同一入口查询及使用腾讯云提供的所有 API 服务。
API Inspector
用户可通过 API Inspector 查看控制台每一步操作关联的 API 调用情况,并自动生成各语言版本的 API 代码,也可前往 API Explorer 进行在线调试。
SDK
云 API 3.0 提供了配套的开发工具集(SDK),支持多种编程语言,能更方便的调用 API。
- Tencent Cloud SDK 3.0 for Python
- Tencent Cloud SDK 3.0 for Java
- Tencent Cloud SDK 3.0 for PHP
- Tencent Cloud SDK 3.0 for Go
- Tencent Cloud SDK 3.0 for NodeJS
- Tencent Cloud SDK 3.0 for .NET
- Tencent Cloud SDK 3.0 for C++
- Tencent Cloud SDK 3.0 for Ruby
命令行工具
6. 错误码
以下仅列出了接口业务逻辑相关的错误码,其他错误码详见 公共错误码。
错误码 | 描述 |
---|---|
FailedOperation | 操作失败。 |
InternalError | 内部错误。 |
InvalidParameter | 参数错误。 |
InvalidParameter.FormatError | 参数格式错误。 |
InvalidParameter.LBIdNotFound | 负载均衡实例ID错误。 |
InvalidParameterValue | 参数取值错误。 |
InvalidParameterValue.InvalidFilter | Filter参数输入错误。 |
InvalidParameterValue.Length | 参数长度错误。 |
UnauthorizedOperation | 未授权操作。 |