有奖捉虫:云通信与企业服务文档专题,速来> HOT

接口描述

DescribeForwardLBListeners 接口可根据负载均衡器 ID,监听器的协议或者端口作为过滤条件获取监听器列表。如果不指定任何过滤条件,默认返回该负载均衡器下的默认数据长度(20 个)的监听器。

接口访问域名:lb.api.qcloud.com

请求参数

以下请求参数列表仅列出了接口请求参数,正式调用时需要加上公共请求参数,详情请参见 公共请求参数 页面。其中,此接口的 Action 字段为 DescribeForwardLBListeners。

参数名称 必选 类型 描述
loadBalancerId String 负载均衡实例 ID,可通过 DescribeLoadBalancers 接口同时入参 forward 字段为1或者-1来查询。
listenerIds.n String 负载均衡监听器 ID。
protocol Int 监听器协议类型
1:HTTP,2:TCP,3:UDP,4:HTTPS。
loadBalancerPort Int 负载均衡监听器端口。

返回参数

参数名称 类型 描述
code Int 公共错误码,0表示成功,其他值表示失败。详见错误码页面的 公共错误码
message String 模块错误信息描述,与接口相关。
codeDesc String 英文错误码,成功返回 Success,失败有相应的英文说明。
listenerSet Array 返回的监听器数组。

listenerSet 数组结构:

包括两种结构,四层监听器的结构如下:

参数名称 类型 描述
listenerId String 负载均衡监听器 ID。
protocol Int 负载均衡监听器协议
1:HTTP,4:HTTPS。
protocolType String 负载均衡监听器的协议类型。
loadBalancerPort Int 负载均衡监听器的监听端口。

包括两种结构,七层监听器的结构如下:

参数名称 类型 描述
listenerId String 负载均衡监听器 ID。
protocol Int 负载均衡监听器协议,1:HTTP,2:TCP,3:UDP,4:HTTPS。
protocolType String 负载均衡监听器的协议类型。
loadBalancerPort Int 负载均衡监听器的监听端口。
SSLMode String HTTPS 协议监听器的认证方式。
certId String HTTPS 协议监听器服务端证书 ID。
certCaId String HTTPS 协议监听器客户端证书 ID。
rules Array 负载均衡监听器的转发规则组(四层监听器为空数组)。

rules 数组结构:

参数名称 类型 描述
locationId String 转发规则的 ID。
domain String 转发规则的域名。
url String 转发规则的路径。
sessionExpire Int 转发规则的会话保持时间。
healthSwitch Int 转发规则的健康检查,1:开启、0:关闭。
intervalTime Int 转发规则的检查间隔。
healthNum Int 转发规则的健康阈值。
timeOut Int 响应超时时间,暂时无意义。
unhealthNum Int 转发规则的不健康阈值。
httpHash String 负载均衡转发规则的转发方式,可能值:wrr、ip_hash、least_conn
分别表示按权重轮询、根据源 IP 哈希,最小连接数。
scheduler String 负载均衡四层监听器转发的方式。可能值:wrr、least_conn
分别表示按权重轮询、最小连接数。
httpCode Int 健康检查状态码。具体可参考 创建监听器 中对该字段的解释。
httpCheckPath String 转发规则的健康检查路径。

示例

请求

https://lb.api.qcloud.com/v2/index.php?Action=DescribeForwardLBListeners
&<公共请求参数>
&loadBalancerId=lb-6efswuxa
返回
{
    "code": 0,
    "message": "",
    "codeDesc": "Success",
    "listenerSet": [
        {
            "loadBalancerPort": 7,
            "protocol": 1,
            "protocolType": "http",
            "listenerId": "lbl-20cxbf40",
            "rules": [
                {
                    "locationId": "loc-mpoupana",
                    "domain": "www.tencent.com",
                    "url": "/good",
                    "httpHash": "wrr",
                    "sessionExpire": 982,
                    "healthSwitch": 0,
                    "timeOut": 2,
                    "intervalTime": 35,
                    "healthNum": 3,
                    "unhealthNum": 3,
                    "httpCode": 31,
                    "httpCheckPath": "/"
                },
                {
                    "locationId": "loc-fcr98aw2",
                    "domain": "www.tencent.com",
                    "url": "/first",
                    "httpHash": "ip_hash",
                    "sessionExpire": 211,
                    "healthSwitch": 1,
                    "timeOut": 2,
                    "intervalTime": 5,
                    "healthNum": 3,
                    "unhealthNum": 3,
                    "httpCode": 31,
                    "httpCheckPath": "/"
                },
                {
                    "locationId": "loc-hvzwsyqq",
                    "domain": "www.tencent.com",
                    "url": "/third",
                    "httpHash": "ip_hash",
                    "sessionExpire": 211,
                    "healthSwitch": 1,
                    "timeOut": 2,
                    "intervalTime": 5,
                    "healthNum": 3,
                    "unhealthNum": 3,
                    "httpCode": 31,
                    "httpCheckPath": "/"
                },
                {
                    "locationId": "loc-lertoiuk",
                    "domain": "www.zhifubao.com",
                    "url": "/first",
                    "httpHash": "ip_hash",
                    "sessionExpire": 321,
                    "healthSwitch": 1,
                    "timeOut": 2,
                    "intervalTime": 5,
                    "healthNum": 3,
                    "unhealthNum": 3,
                    "httpCode": 31,
                    "httpCheckPath": "/"
                },
                {
                    "locationId": "loc-5mr4zzym",
                    "domain": "www.tencent.com",
                    "url": "/fourth",
                    "httpHash": "ip_hash",
                    "sessionExpire": 211,
                    "healthSwitch": 0,
                    "timeOut": 2,
                    "intervalTime": 5,
                    "healthNum": 3,
                    "unhealthNum": 3,
                    "httpCode": 31,
                    "httpCheckPath": "/"
                },
                {
                    "locationId": "loc-fi5or8js",
                    "domain": "www.zhifubao.com",
                    "url": "/second",
                    "httpHash": "ip_hash",
                    "sessionExpire": 321,
                    "healthSwitch": 1,
                    "timeOut": 2,
                    "intervalTime": 5,
                    "healthNum": 3,
                    "unhealthNum": 3,
                    "httpCode": 31,
                    "httpCheckPath": "/"
                },
                {
                    "locationId": "loc-buq7xfa8",
                    "domain": "www.aws.com",
                    "url": "/second",
                    "httpHash": "ip_hash",
                    "sessionExpire": 321,
                    "healthSwitch": 1,
                    "timeOut": 2,
                    "intervalTime": 5,
                    "healthNum": 3,
                    "unhealthNum": 3,
                    "httpCode": 31,
                    "httpCheckPath": "/"
                }
            ]
        },
        {
            "loadBalancerPort": 9999,
            "protocol": 4,
            "protocolType": "https",
            "listenerId": "lbl-7honivdy",
            "SSLMode": "unidirectional",
            "certId": "cb5fb6cd"
        },
        {
            "loadBalancerPort": 80,
            "protocol": 4,
            "protocolType": "https",
            "listenerId": "lbl-qbmhv8a4",
            "SSLMode": "unidirectional",
            "certId": "c5db1460"
        },
        {
            "loadBalancerPort": 90,
            "protocol": 4,
            "protocolType": "https",
            "listenerId": "lbl-gdbnbl5a",
            "SSLMode": "unidirectional",
            "certId": "c5db1460"
        },
        {
            "loadBalancerPort": 100,
            "protocol": 4,
            "protocolType": "https",
            "listenerId": "lbl-3m99yc3u",
            "SSLMode": "unidirectional",
            "certId": "c5db1460"
        }
    ]
}