计算
弹性云服务器 ECS
Flexus云服务
裸金属服务器 BMS
弹性伸缩 AS
镜像服务 IMS
专属主机 DeH
函数工作流 FunctionGraph
云手机服务器 CPH
Huawei Cloud EulerOS
网络
虚拟私有云 VPC
弹性公网IP EIP
虚拟专用网络 VPN
弹性负载均衡 ELB
NAT网关 NAT
云专线 DC
VPC终端节点 VPCEP
云连接 CC
企业路由器 ER
企业交换机 ESW
全球加速 GA
安全与合规
安全技术与应用
Web应用防火墙 WAF
企业主机安全 HSS
云防火墙 CFW
安全云脑 SecMaster
DDoS防护 AAD
数据加密服务 DEW
数据库安全服务 DBSS
云堡垒机 CBH
数据安全中心 DSC
云证书管理服务 CCM
边缘安全 EdgeSec
威胁检测服务 MTD
CDN与智能边缘
内容分发网络 CDN
CloudPond云服务
智能边缘云 IEC
迁移
主机迁移服务 SMS
对象存储迁移服务 OMS
云数据迁移 CDM
迁移中心 MGC
大数据
MapReduce服务 MRS
数据湖探索 DLI
表格存储服务 CloudTable
云搜索服务 CSS
数据接入服务 DIS
数据仓库服务 GaussDB(DWS)
数据治理中心 DataArts Studio
数据可视化 DLV
数据湖工厂 DLF
湖仓构建 LakeFormation
企业应用
云桌面 Workspace
应用与数据集成平台 ROMA Connect
云解析服务 DNS
专属云
专属计算集群 DCC
IoT物联网
IoT物联网
设备接入 IoTDA
智能边缘平台 IEF
用户服务
账号中心
费用中心
成本中心
资源中心
企业管理
工单管理
国际站常见问题
ICP备案
我的凭证
支持计划
客户运营能力
合作伙伴支持计划
专业服务
区块链
区块链服务 BCS
Web3节点引擎服务 NES
解决方案
SAP
高性能计算 HPC
视频
视频直播 Live
视频点播 VOD
媒体处理 MPC
实时音视频 SparkRTC
数字内容生产线 MetaStudio
存储
对象存储服务 OBS
云硬盘 EVS
云备份 CBR
存储容灾服务 SDRS
高性能弹性文件服务 SFS Turbo
弹性文件服务 SFS
云硬盘备份 VBS
云服务器备份 CSBS
数据快递服务 DES
专属分布式存储服务 DSS
容器
云容器引擎 CCE
容器镜像服务 SWR
应用服务网格 ASM
华为云UCS
云容器实例 CCI
管理与监管
云监控服务 CES
统一身份认证服务 IAM
资源编排服务 RFS
云审计服务 CTS
标签管理服务 TMS
云日志服务 LTS
配置审计 Config
资源访问管理 RAM
消息通知服务 SMN
应用运维管理 AOM
应用性能管理 APM
组织 Organizations
优化顾问 OA
IAM 身份中心
云运维中心 COC
资源治理中心 RGC
应用身份管理服务 OneAccess
数据库
云数据库 RDS
文档数据库服务 DDS
数据管理服务 DAS
数据复制服务 DRS
云数据库 GeminiDB
云数据库 GaussDB
分布式数据库中间件 DDM
数据库和应用迁移 UGO
云数据库 TaurusDB
人工智能
人脸识别服务 FRS
图引擎服务 GES
图像识别 Image
内容审核 Moderation
文字识别 OCR
AI开发平台ModelArts
图像搜索 ImageSearch
对话机器人服务 CBS
华为HiLens
视频智能分析服务 VIAS
语音交互服务 SIS
应用中间件
分布式缓存服务 DCS
API网关 APIG
微服务引擎 CSE
分布式消息服务Kafka版
分布式消息服务RabbitMQ版
分布式消息服务RocketMQ版
多活高可用服务 MAS
事件网格 EG
企业协同
华为云会议 Meeting
云通信
消息&短信 MSGSMS
云生态
合作伙伴中心
云商店
开发者工具
SDK开发指南
API签名指南
Terraform
华为云命令行工具服务 KooCLI
其他
产品价格详情
系统权限
管理控制台
客户关联华为云合作伙伴须知
消息中心
公共问题
开发与运维
应用管理与运维平台 ServiceStage
软件开发生产线 CodeArts
需求管理 CodeArts Req
部署 CodeArts Deploy
性能测试 CodeArts PerfTest
编译构建 CodeArts Build
流水线 CodeArts Pipeline
制品仓库 CodeArts Artifact
测试计划 CodeArts TestPlan
代码检查 CodeArts Check
代码托管 CodeArts Repo
云应用引擎 CAE
开天aPaaS
云消息服务 KooMessage
云手机服务 KooPhone
云空间服务 KooDrive

查询监听器列表

功能介绍

查询监听器列表。

接口约束

  • 分页查询使用的参数为marker、limit、page_reverse。

  • marker和page_reverse只有和limit一起使用时才会生效,单独使用无效。

调用方法

请参见如何调用API

URI

GET /v3/{project_id}/elb/listeners

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

参数解释:项目ID。

表2 Query参数

参数

是否必选

参数类型

描述

limit

Integer

参数解释:每页返回的个数。

取值范围:0-2000

默认取值:2000

marker

String

上一页最后一条记录的ID。

使用说明:

  • 必须与limit一起使用。

  • 不指定时表示查询第一页。

  • 该字段不允许为空或无效的ID。

page_reverse

Boolean

是否反向查询。

取值:

  • true:查询上一页。

  • false:查询下一页,默认。

使用说明:

  • 必须与limit一起使用。

  • 当page_reverse=true时,若要查询上一页,marker取值为当前页返回值的previous_marker。

protocol_port

Array of strings

监听器的前端监听端口。

支持多值查询,查询条件格式:protocol_port=xxx&protocol_port=xxx

protocol

Array of strings

监听器的监听协议。

取值:TCP、UDP、HTTP、HTTPS、TERMINATED_HTTPS、QUIC、TLS。

说明:TERMINATED_HTTPS为共享型LB上的监听器独有的协议。

支持多值查询,查询条件格式:protocol=xxx&protocol=xxx

description

Array of strings

监听器的描述信息。

支持多值查询,查询条件格式:description=xxx&description=xxx

default_tls_container_ref

Array of strings

监听器的服务器证书ID。

支持多值查询,查询条件格式:

default_tls_container_ref=xxx&default_tls_container_ref=xxx

client_ca_tls_container_ref

Array of strings

监听器的CA证书ID。

支持多值查询,查询条件格式:

client_ca_tls_container_ref=xxx&client_ca_tls_container_ref=xxx

admin_state_up

Boolean

监听器的管理状态。

connection_limit

Array of integers

​监听器的最大连接数。

取值:-1表示不限制连接数。

支持多值查询,查询条件格式:connection_limit=xxx&connection_limit=xxx

不支持该字段,请勿使用。

default_pool_id

Array of strings

监听器的默认后端服务器组ID。当请求没有匹配的转发策略时,转发到默认后端服务器上处理。

支持多值查询,查询条件格式:default_pool_id=xxx&default_pool_id=xxx

id

Array of strings

监听器ID。

支持多值查询,查询条件格式:id=xxx&id=xxx

name

Array of strings

监听器名称。

支持多值查询,查询条件格式:name=xxx&name=xxx

http2_enable

Boolean

客户端与LB之间的HTTPS请求的HTTP2功能的开启状态。

开启后,可提升客户端与LB间的访问性能,但LB与后端服务器间仍采用HTTP1.X协议。

使用说明:

  • 仅HTTPS协议监听器有效。

  • QUIC监听器不能设置该字段,固定返回为true。

  • 其他协议的监听器可设置该字段但无效,无论取值如何都不影响监听器正常运行。

loadbalancer_id

Array of strings

监听器所属的负载均衡器ID。

支持多值查询,查询条件格式:loadbalancer_id=xxx&loadbalancer_id=xxx

tls_ciphers_policy

Array of strings

监听器使用的安全策略。

支持多值查询,查询条件格式:tls_ciphers_policy=xxx&tls_ciphers_policy=xxx

member_address

Array of strings

后端服务器的IP地址。仅用于查询条件,不作为响应参数字段。

支持多值查询,查询条件格式:member_address=xxx&member_address=xxx

member_device_id

Array of strings

后端服务器对应的弹性云服务器的ID。仅用于查询条件,不作为响应参数字段。

支持多值查询,查询条件格式:member_device_id=xxx&member_device_id=xxx

enterprise_project_id

Array of strings

参数解释:所属的企业项目ID。

如果enterprise_project_id不传值,默认查询所有企业项目下的资源,鉴权按照细粒度权限鉴权,必须在用户组下分配elb:listeners:list权限。

如果enterprise_project_id传值,鉴权按照企业项目权限鉴权,分为传入具体eps_id和all_granted_eps两种场景,前者查询指定eps_id的eps下的资源,后者查询的是所有有list权限的eps下的资源。

支持多值查询,查询条件格式:

enterprise_project_id=xxx&enterprise_project_id=xxx

enable_member_retry

Boolean

是否开启后端服务器的重试。

取值:true 开启重试,false 不开启重试。

member_timeout

Array of integers

等待后端服务器响应超时时间。请求转发后端服务器后,在等待超时member_timeout时长没有响应,负载均衡将终止等待,并返回HTTP504错误码。

取值:1-300s。

支持多值查询,查询条件格式:member_timeout=xxx&member_timeout=xxx

client_timeout

Array of integers

等待客户端请求超时时间,包括两种情况:

  • 读取整个客户端请求头的超时时长:如果客户端未在超时时长内发送完整个请求头,则请求将被中断

  • 两个连续body体的数据包到达LB的时间间隔,超出client_timeout将会断开连接。

取值:1-300s。

支持多值查询,查询条件格式:client_timeout=xxx&client_timeout=xxx

keepalive_timeout

Array of integers

参数解释:客户端连接空闲超时时间。在超过keepalive_timeout时长一直没有请求,负载均衡会暂时中断当前连接,直到下一次请求时重新建立新的连接。

约束限制:共享型实例的UDP监听器不支持此字段。

取值范围:

  • TCP监听器:10-4000s,默认值为300s。

  • 若为HTTP/HTTPS/TERMINATED_HTTPS监听器,取值范围为(0-4000s)默认值为60s。

支持多值查询,查询条件格式:keepalive_timeout=xxx&keepalive_timeout=xxx

transparent_client_ip_enable

Boolean

是否透传客户端IP地址。开启后客户端IP地址将透传到后端服务器。

仅作用于共享型LB的TCP/UDP监听器。取值:true开启,false不开启。

proxy_protocol_enable

Boolean

是否开启proxy_protocol。仅TLS监听器可指定,其他协议的监听器该字段不生效,proxy_protocol不开启。

enhance_l7policy_enable

Boolean

是否开启高级转发策略功能。开启高级转发策略后,支持更灵活的转发策略和转发规则设置。

取值:true开启,false不开启。

member_instance_id

Array of strings

后端服务器ID。仅用于查询条件,不作为响应参数字段。

支持多值查询,查询条件格式:member_instance_id=xxx&member_instance_id=xxx

protection_status

Array of strings

修改保护状态, 取值:

  • nonProtection: 不保护,默认值为nonProtection

  • consoleProtection: 控制台修改保护

ssl_early_data_enable

Boolean

参数解释:监听器0-RTT能力开关。

nat64_enable

Boolean

是否开启nat64地址族转换功能。

取值:true 开启,false 不开启。

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

参数解释:IAM鉴权Token

响应参数

状态码:200

表4 响应Body参数

参数

参数类型

描述

request_id

String

参数解释:请求ID。

注:自动生成 。

page_info

PageInfo object

参数解释:监听器分页信息。

listeners

Array of Listener objects

参数解释:Listener的列表。

表5 PageInfo

参数

参数类型

描述

previous_marker

String

参数解释:分页查询结果中第一条记录的ID。通常用于配合page_reverse=true查询上一页。

next_marker

String

参数解释:分页查询结果中最后一条记录的ID。通常用于查询下一页。

current_count

Integer

参数解释:当前的记录数。

表6 Listener

参数

参数类型

描述

admin_state_up

Boolean

参数解释:监听器的管理状态。

client_ca_tls_container_ref

String

参数解释:监听器使用的CA证书ID。

约束限制:当且仅当type=client时,才会使用该字段对应的证书。

connection_limit

Integer

参数解释:监听器的最大连接数。

取值范围:-1表示不限制。

默认取值:-1。

不支持该字段,请勿使用。

created_at

String

参数解释:监听器的创建时间。

取值范围:

格式:yyyy-MM-dd'T'HH:mm:ss'Z',如:2021-07-30T12:03:44Z

default_pool_id

String

参数解释:监听器的默认后端服务器组ID。当请求没有匹配的转发策略时,转发到默认后端服务器上处理。

default_tls_container_ref

String

参数解释:监听器使用的服务器证书ID。

description

String

参数解释:监听器的描述信息。

http2_enable

Boolean

参数解释:客户端与LB之间的HTTPS请求的HTTP2功能的开启状态。

开启后,可提升客户端与LB间的访问性能,但LB与后端服务器间仍采用HTTP1.X协议。

约束限制:

  • 仅HTTPS协议监听器有效。

  • QUIC监听器不能设置该字段,固定返回为true。

  • 其他协议的监听器可设置该字段但无效,无论取值如何都不影响监听器正常运行。

id

String

参数解释:监听器ID。

insert_headers

ListenerInsertHeaders object

可选的HTTP头插入,可以将从负载均衡器到后端服务器的路径中需要被后端服务器用到的信息写入HTTP中,随报文传递到后端服务器。例如可通过X-Forwarded-ELB-IP开关,将负载均衡器的弹性公网IP传到后端服务器。

loadbalancers

Array of LoadBalancerRef objects

参数解释:监听器所属的负载均衡器的ID列表。

约束限制:一个监听器只支持关联到一个LB。

name

String

参数解释:监听器的名称。

约束限制:若名称为空,则在控制台的监听器列表无法选择并查看监听器详情。

project_id

String

参数解释:监听器所在的项目ID。

enterprise_project_id

String

参数解释:企业项目ID。

protocol

String

参数解释:监听器的监听协议。

取值范围:TCP、UDP、HTTP、HTTPS、TERMINATED_HTTPS、QUIC、TLS。

约束限制:

  • 共享型LB上的HTTPS监听器只支持设置为TERMINATED_HTTPS,

    创建时传入HTTPS将会自动转为TERMINATED_HTTPS。

  • 独享型LB上的HTTPS监听器只支持设置为HTTPS,创建时传入TERMINATED_HTTPS将会自动转为HTTPS。

protocol_port

Integer

参数解释:监听器的监听端口。

约束限制:

  • QUIC监听器端口不能是4789,且不能和UDP监听器端口重复。

  • 传0表示开启监听端口范围的能力,此时port_ranges为必填字段。

sni_container_refs

Array of strings

参数解释:监听器使用的SNI证书(带域名的服务器证书)ID列表。

约束限制:

  • 列表对应的所有SNI证书的域名不允许存在重复。

  • 列表对应的所有SNI证书的域名总数不超过50。

sni_match_algo

String

参数解释:监听器使用的SNI证书泛域名匹配方式。

取值范围:longest_suffix表示最长尾缀匹配;wildcard表示标准域名分级匹配。

默认取值:wildcard

tags

Array of Tag objects

参数解释:标签列表。

updated_at

String

参数解释:监听器的更新时间。

取值范围:

格式:yyyy-MM-dd'T'HH:mm:ss'Z',如:2021-07-30T12:03:44Z

tls_ciphers_policy

String

参数解释:监听器使用的安全策略。

取值范围:tls-1-0-inherit、tls-1-0、tls-1-1、

tls-1-2、tls-1-2-strict、tls-1-2-fs、tls-1-0-with-1-3、

tls-1-2-fs-with-1-3、

hybrid-policy-1-0、tls-1-2-strict-no-cbc,默认:tls-1-2。

约束限制:

  • 仅对HTTPS协议类型的监听器且关联LB为独享型时有效。

  • QUIC监听器不支持该字段。

  • 若同时设置了security_policy_id和tls_ciphers_policy,则仅security_policy_id生效。

  • 加密套件的优先顺序为ecc套件、rsa套件、tls1.3协议的套件(即支持ecc又支持rsa)

security_policy_id

String

参数解释:自定义安全策略的ID。

约束限制:

  • 仅对HTTPS协议类型的监听器且关联LB为独享型时有效。

  • 若同时设置了security_policy_id和tls_ciphers_policy,则仅security_policy_id生效。

  • 加密套件的优先顺序为ecc套件、rsa套件、tls1.3协议的套件(即支持ecc又支持rsa)

enable_member_retry

Boolean

参数解释:是否开启后端服务器的重试。

约束限制:

  • 若关联是共享型LB,仅在protocol为HTTP、TERMINATED_HTTPS时才能传入该字段。

  • 若关联是独享型LB,仅在protocol为HTTP、HTTPS和QUIC时才能传入该字段。

取值范围:true 开启重试,false 不开启重试。

默认取值:true。

keepalive_timeout

Integer

参数解释:客户端连接空闲超时时间。在超过keepalive_timeout时长一直没有请求,负载均衡会暂时中断当前连接,直到下一次请求时重新建立新的连接。

约束限制:共享型实例的UDP监听器不支持此字段。

取值范围:

  • TCP监听器:10-4000s,默认值为300s。

  • 若为HTTP/HTTPS/TERMINATED_HTTPS监听器,取值范围为(0-4000s)默认值为60s。

client_timeout

Integer

参数解释:等待客户端请求超时时间,包括两种情况:

  • 读取整个客户端请求头的超时时长:如果客户端未在超时时长内发送完整个请求头,则请求将被中断

  • 两个连续body体的数据包到达LB的时间间隔,超出client_timeout将会断开连接。

约束限制:仅协议为HTTP/HTTPS的监听器支持该字段。

取值范围:1-300s

默认取值:60s。

member_timeout

Integer

参数解释:等待后端服务器响应超时时间。请求转发后端服务器后,在等待超时member_timeout时长没有响应,负载均衡将终止等待,并返回HTTP504错误码。

约束限制:仅支持协议为HTTP/HTTPS的监听器。

取值范围:1-300s

默认取值:60s。

ipgroup

ListenerIpGroup object

listener对象中的ipgroup信息

transparent_client_ip_enable

Boolean

参数解释:是否透传客户端IP地址。开启后客户端IP地址将透传到后端服务器。

仅作用于共享型LB的TCP/UDP监听器。

约束限制:

  • 开启特性后,ELB和后端服务器之间直接使用真实的IP访问,需要确保已正确设置服务器的安全组以及访问控制策略。

  • 开启特性后,不支持同一台服务器既作为后端服务器又作为客户端的场景。

  • 开启特性后,不支持变更后端服务器规格。

取值范围:

  • 共享型LB的TCP/UDP监听器可设置为true或false,不传默认为false。

  • 共享型LB的HTTP/HTTPS监听器只支持设置为true,不传默认为true。

  • 独享型负载均衡器所有协议的监听器只支持设置为true,不传默认为true。

proxy_protocol_enable

Boolean

参数解释:是否开启proxy_protocol。仅TLS监听器可指定,其他协议的监听器该字段不生效,proxy_protocol不开启。

enhance_l7policy_enable

Boolean

参数解释:是否开启高级转发策略功能。开启高级转发策略后,支持更灵活的转发策略和转发规则设置。

开启后支持如下场景:

  • 转发策略的action字段支持指定为REDIRECT_TO_URL,

    FIXED_RESPONSE,即支持URL重定向和响应固定的内容给客户端。

  • 转发策略支持指定priority、redirect_url_config、fixed_response_config字段。

  • 转发规则rule的type可以指定METHOD, HEADER, QUERY_STRING, SOURCE_IP这几种取值。

  • 转发规则rule的type为HOST_NAME时,转发规则rule的value支持通配符*。

  • 转发规则支持指定conditions字段。

约束限制:

  • 开启后不支持关闭。

  • 开启高级转发策略后,监听器关联的转发策略的匹配优先级由转发策略的priority字段来决定,不再自动排序。具体说明详见转发策略的priority字段的说明。

取值范围:true开启,false不开启。

默认取值:false。

quic_config

ListenerQuicConfig object

参数解释:当前监听器关联的QUIC监听器配置信息。

约束限制:仅protocol为HTTPS时有效。对于TCP/UDP/HTTP/QUIC监听器,若该字段非空则报错。

说明:

客户端向服务端发送正常的HTTP协议请求并携带了支持QUIC协议的信息。

如果服务端监听器开启了升级QUIC,那么就会在响应头中加入服务端支持的QUIC端口和版本信息。

客户端再次请求时会同时发送TCP(HTTPS)和UDP(QUIC)请求,若QUIC请求成功,则后续继续使用QUIC交互。

protection_status

String

参数解释:修改保护状态,

取值范围:

  • nonProtection: 不保护,默认值为nonProtection

  • consoleProtection: 控制台修改保护

protection_reason

String

参数解释:设置保护的原因。作为protection_status的转态设置的原因。

约束限制:仅当protection_status为consoleProtection时有效。

取值范围:除'<'和'>'外通用Unicode字符集字符,最大255个字符。

gzip_enable

Boolean

参数解释:ELB是否开启gzip压缩。

约束限制:仅HTTP/HTTPS/QUIC类型监听器支持配置。

默认取值:false

port_ranges

Array of PortRange objects

参数解释:端口监听范围(闭区间)。

约束限制:

  • 最多指定10个端口组,每个组范围不可有重叠部分

  • 仅当protocol_port为0时可以传入。

ssl_early_data_enable

Boolean

参数解释:监听器0-RTT能力开关

约束限制:仅HTTPS类型监听器支持配置,需要依赖TLSv1.3安全策略协议。

默认取值:false。

cps

Integer

参数解释:监听器新建限速

约束限制:当该限速值大于LB的限速值时,以LB的限速值生效

取值范围:0-1000000

默认取值:0,表示不限速

connection

Integer

参数解释:监听器并发限速

约束限制:当该限速值大于LB的限速值时,以LB的限速值生效

取值范围:0-1000000

默认取值:0,表示不限速

nat64_enable

Boolean

参数解释:

监听器地址族转换能力开关,可以实现客户端通过访问LB的IPv4或者IPv6地址,来访问IPv4后端和IPv6后端。

约束限制:

仅对于TCP、UDP协议类型的监听器生效,与transparent_client_ip_enable,获取客户端ip功能开关互斥,开启地址族转换同时需要保证获取客户端ip功能关闭。

取值范围:

  • true:开启地址族转换功能

  • false:关闭地址族转换功能

默认取值:false

表7 ListenerInsertHeaders

参数

参数类型

描述

X-Forwarded-ELB-IP

Boolean

参数解释:X-Forwarded-ELB-IP设为true可以将ELB实例的eip地址从报文的http头中带到后端服务器。

X-Forwarded-Port

Boolean

参数解释:X-Forwarded-Port设为true可以将ELB实例的监听端口从报文的http头中带到后端服务器。

X-Forwarded-For-Port

Boolean

X-Forwarded-For-Port设为true可以将客户端的源端口从报文的http头中带到后端服务器。

X-Forwarded-Host

Boolean

参数解释:X-Forwarded-Host设为true可以将客户请求头的X-Forwarded-Host设置为请求头的Host带到后端服务器。

X-Forwarded-Proto

Boolean

参数解释:X-Forwarded-Proto设为true可以将负载均衡器实例的监听协议通过报文的http头带到后端服务器。

X-Real-IP

Boolean

参数解释:X-Real-IP设为true可以将客户端的IP通过报文的http头带到后端服务器。

X-Forwarded-ELB-ID

Boolean

参数解释:X-Forwarded-ELB-ID设为true可以将负载均衡器实例的ID通过报文的http头带到后端服务器。

X-Forwarded-TLS-Certificate-ID

Boolean

参数解释:X-Forwarded-TLS-Certificate-ID设为true可以将负载均衡器实例的证书ID通过报文的http头带到后端服务器。

X-Forwarded-TLS-Protocol

Boolean

参数解释:X-Forwarded-TLS-Protocol设为true可以将负载均衡器实例的算法协议通过报文的http头带到后端服务器。

X-Forwarded-TLS-Cipher

Boolean

参数解释:X-Forwarded-TLS-Cipher设为true可以将负载均衡器实例的算法套件通过报文的http头带到后端服务器。

表8 LoadBalancerRef

参数

参数类型

描述

id

String

参数解释:负载均衡器ID。

表9 Tag

参数

参数类型

描述

key

String

参数解释:标签键

value

String

参数解释:标签值

表10 ListenerIpGroup

参数

参数类型

描述

ipgroup_id

String

参数解释:监听器关联的访问控制组的id。

创建时必选,更新时非必选。

约束限制:

指定的ipgroup必须已存在,不能指定为null,否则与enable_ipgroup冲突。

enable_ipgroup

Boolean

参数解释:访问控制组的状态。

开启访问控制的监听器,允许直接删除。

取值范围:

  • true:开启访问控制。

  • false:关闭访问控制。

type

String

参数解释:访问控制组的类型。

取值范围:

  • white:白名单,只允许指定ip访问。

  • black:黑名单,不允许指定ip访问。

表11 ListenerQuicConfig

参数

参数类型

描述

quic_listener_id

String

参数解释:监听器关联的QUIC监听器ID。

约束限制:指定的listener id必须已存在,且协议类型为QUIC,不能指定为null,否则与enable_quic_upgrade冲突。

enable_quic_upgrade

Boolean

参数解释:QUIC升级的开启状态。开启HTTPS监听器升级QUIC监听器能力。

取值范围:

  • true:开启QUIC升级。

  • false:关闭QUIC升级。

表12 PortRange

参数

参数类型

描述

start_port

Integer

起始端口

end_port

Integer

结束端口,需大于等于起始端口

请求示例

分页查询监听器列表

GET https://{ELB_Endpoint}/v3/99a3fff0d03c428eac3678da6a7d0f24/elb/listeners?limit=2&marker=0r31747a-b139-492f-2749-2df0b1c87193

响应示例

状态码:200

操作正常返回。

{
  "listeners" : [ {
    "id" : "0b11747a-b139-492f-9692-2df0b1c87193",
    "name" : "My listener",
    "protocol_port" : 80,
    "protocol" : "TCP",
    "ipgroup" : null,
    "description" : "My listener update.",
    "default_tls_container_ref" : null,
    "admin_state_up" : true,
    "loadbalancers" : [ {
      "id" : "098b2f68-af1c-41a9-8efd-69958722af62"
    } ],
    "member_timeout" : null,
    "client_timeout" : null,
    "keepalive_timeout" : 300,
    "client_ca_tls_container_ref" : null,
    "project_id" : "99a3fff0d03c428eac3678da6a7d0f24",
    "sni_container_refs" : [ ],
    "connection_limit" : -1,
    "default_pool_id" : null,
    "tls_ciphers_policy" : "tls-1-2",
    "tags" : [ ],
    "created_at" : "2019-04-02T00:12:32Z",
    "updated_at" : "2019-04-02T17:43:46Z",
    "http2_enable" : true,
    "insert_headers" : {
      "X-Forwarded-ELB-IP" : true
    },
    "transparent_client_ip_enable" : false,
    "quic_config" : null,
    "nat64_enable" : false
  }, {
    "id" : "0b455839-3ea7-4bac-ad26-35bf22f96ea4",
    "name" : "listener-test",
    "protocol_port" : 86,
    "protocol" : "TERMINATED_HTTPS",
    "description" : null,
    "default_tls_container_ref" : "ad9b123e858d4652b80e89b9941e49a4",
    "admin_state_up" : true,
    "loadbalancers" : [ {
      "id" : "309a0f61-0b62-45f2-97d1-742f3434338e"
    } ],
    "member_timeout" : 60,
    "client_timeout" : 60,
    "keepalive_timeout" : 15,
    "client_ca_tls_container_ref" : "7875ccb4c6b44cdb90ab2ab89892ab71",
    "project_id" : "99a3fff0d03c428eac3678da6a7d0f24",
    "sni_container_refs" : [ "7f41c96223d34ebaa3c8e836b6625ec0" ],
    "connection_limit" : -1,
    "default_pool_id" : "5e7e0175-d5d5-4f37-bfba-88a9524ad20b",
    "tls_ciphers_policy" : "tls-1-2",
    "tags" : [ ],
    "created_at" : "2019-03-22T23:37:14Z",
    "updated_at" : "2019-03-22T23:37:14Z",
    "http2_enable" : false,
    "ipgroup" : null,
    "insert_headers" : {
      "X-Forwarded-ELB-IP" : true
    },
    "transparent_client_ip_enable" : false,
    "quic_config" : null,
    "nat64_enable" : false
  } ],
  "page_info" : {
    "next_marker" : "0b455839-3ea7-4bac-ad26-35bf22f96ea4",
    "previous_marker" : "0b11747a-b139-492f-9692-2df0b1c87193",
    "current_count" : 2
  },
  "request_id" : "774640ee-6863-4de3-8156-aff16f51a087"
}

SDK代码示例

SDK代码示例如下。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.elb.v3.region.ElbRegion;
import com.huaweicloud.sdk.elb.v3.*;
import com.huaweicloud.sdk.elb.v3.model.*;


public class ListListenersSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");
        String projectId = "{project_id}";

        ICredential auth = new BasicCredentials()
                .withProjectId(projectId)
                .withAk(ak)
                .withSk(sk);

        ElbClient client = ElbClient.newBuilder()
                .withCredential(auth)
                .withRegion(ElbRegion.valueOf("<YOUR REGION>"))
                .build();
        ListListenersRequest request = new ListListenersRequest();
        try {
            ListListenersResponse response = client.listListeners(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkelb.v3.region.elb_region import ElbRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkelb.v3 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]
    projectId = "{project_id}"

    credentials = BasicCredentials(ak, sk, projectId)

    client = ElbClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(ElbRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ListListenersRequest()
        response = client.list_listeners(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    elb "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")
    projectId := "{project_id}"

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        Build()

    client := elb.NewElbClient(
        elb.ElbClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ListListenersRequest{}
	response, err := client.ListListeners(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.elb.v3.region.ElbRegion;
import com.huaweicloud.sdk.elb.v3.*;
import com.huaweicloud.sdk.elb.v3.model.*;


public class ListListenersSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");
        String projectId = "{project_id}";

        ICredential auth = new BasicCredentials()
                .withProjectId(projectId)
                .withAk(ak)
                .withSk(sk);

        ElbClient client = ElbClient.newBuilder()
                .withCredential(auth)
                .withRegion(ElbRegion.valueOf("<YOUR REGION>"))
                .build();
        ListListenersRequest request = new ListListenersRequest();
        try {
            ListListenersResponse response = client.listListeners(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkelb.v3.region.elb_region import ElbRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkelb.v3 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]
    projectId = "{project_id}"

    credentials = BasicCredentials(ak, sk, projectId)

    client = ElbClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(ElbRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ListListenersRequest()
        response = client.list_listeners(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    elb "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")
    projectId := "{project_id}"

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        Build()

    client := elb.NewElbClient(
        elb.ElbClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ListListenersRequest{}
	response, err := client.ListListeners(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

操作正常返回。

错误码

请参见错误码

我们使用cookie来确保您的高速浏览体验。继续浏览本站,即表示您同意我们使用cookie。 详情

文档反馈

文档反馈

意见反馈

0/500

标记内容

同时提交标记内容