调用DescribeRules查询指定监听已配置的转发规则。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | DescribeRules |
要执行的操作。 取值:DescribeRules。 |
ListenerPort | Integer | 是 | 90 |
负载均衡实例前端使用的监听端口。 取值范围:1~65535。 |
LoadBalancerId | String | 是 | lb-bp1ca0zt07t934**** |
负载均衡实例ID。 |
RegionId | String | 是 | cn-hangzhou |
负载均衡实例的地域ID。 您可以通过调用DescribeRegions接口查询地域ID。 |
ListenerProtocol | String | 否 | https |
负载均衡实例前端使用的协议。 说明 相同端口存在不同协议监听时,此字段必填。
|
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
RequestId | String | 9DEC9C28-AB05-4DDF-9A78-6B08EC9CE18C |
请求ID。 |
Rules | Array of Rule |
转发规则列表。 |
|
Rule | |||
RuleId | String | rule-tybqi6**** |
转发规则ID。 |
RuleName | String | Rule2 |
转发规则名称,长度为1~80个字符,只能使用字母、数字、短划线(-)、正斜线(/)、半角句号(.)和下划线(_)这些字符。 说明 同一个监听内不同规则的名称必须唯一。
|
Domain | String | test.com |
转发规则绑定的请求域名。 |
Url | String | /cache |
转发规则绑定的请求路径。 |
VServerGroupId | String | rsp-6cejjzl**** |
转发规则绑定的目标虚拟服务器组ID。 |
Cookie | String | 23 |
服务器上配置的Cookie。 长度为1~200个字符,只能包含ASCII英文字母和数字字符,不能包含逗号(,)、半角分号(;)或空格,也不能以美元符号($)开头。 说明 当StickySession为on且StickySessionType为server时,该参数必选且有效。
|
CookieTimeout | Integer | 56 |
Cookie超时时间。取值:1~86400秒。 说明 当StickySession为on且StickySessionType为insert时,该参数有效。
|
HealthCheck | String | off |
是否开启健康检查。 取值:on或off。 说明 ListenerSync为off时有效,为on时表明与监听配置一致。
|
HealthCheckConnectPort | Integer | 45 |
健康检查的后端服务器的端口。 取值:1~65535。 说明 HealthCheck为on时该参数有效,若为空且HealthCheck为on表明默认使用监听后端端口配置。
|
HealthCheckDomain | String | www.domain.com |
用于健康检查的域名,取值:
说明 HealthCheck为on时,该参数有效。
|
HealthCheckHttpCode | String | http_3xx |
健康检查正常的HTTP状态码,多个状态码用半角逗号(,)分隔。默认值为http_2xx。 取值:http_2xx、http_3xx、http_4xx或http_5xx。 说明 HealthCheck为on时,该参数有效。
|
HealthCheckInterval | Integer | 5 |
健康检查的时间间隔。 取值:1~50秒。 说明 HealthCheck为on时,该参数有效。
|
HealthCheckTimeout | Integer | 34 |
接收来自运行状况检查的响应需要等待的时间。如果后端ECS在指定的时间内没有正确响应,则判定为健康检查失败。 取值:1~300秒。 说明 如果HealthCHeckTimeout的值小于HealthCheckInterval的值,则HealthCHeckTimeout无效,超时时间为HealthCheckInterval的值。HealthCheck为on时,该参数有效。
|
HealthCheckURI | String | /example |
用于健康检查的URI。 说明 HealthCheck为on时,该参数有效。
|
HealthyThreshold | Integer | 5 |
健康检查连续成功多少次后,将后端服务器的健康检查状态由失败判定为成功。 取值:2~10。 说明 HealthCheck为on时,该参数有效。
|
ListenerSync | String | off |
转发规则是否从监听上继承健康检查、会话保持和调度算法配置。 取值:on或off。
|
Scheduler | String | wrr |
调度算法。取值:
说明 ListenerSync为off时有效,为on时表明与监听配置一致。
|
StickySession | String | off |
是否开启会话保持。 取值:on或off。 说明 在ListenerSync为off时有效,为on时表明与监听配置一致。
|
StickySessionType | String | insert |
Cookie的处理方式。取值:
说明 当StickySession的值为on时,该参数有效。
|
UnhealthyThreshold | Integer | 2 |
健康检查连续失败多少次后,将后端服务器的健康检查状态由success判定为fail。 取值:2~10 说明 HealthCheck为on时,该参数有效。
|
示例
请求示例
http(s)://[Endpoint]/?Action=DescribeRules
&ListenerPort=90
&LoadBalancerId=lb-bp1ca0zt07t93****
&RegionId=cn-hangzhou
&<公共请求参数>
正常返回示例
XML
格式
<DescribeRulesResponse>
<RequestId>9DEC9C28-AB05-4DDF-9A78-6B08EC9CE18C</RequestId>
<Rules>
<Rule>
<Cookie>23</Cookie>
<CookieTimeout>56</CookieTimeout>
<VServerGroupId>rsp-6cejjzl******</VServerGroupId>
<HealthCheckInterval>5</HealthCheckInterval>
<UnhealthyThreshold>2</UnhealthyThreshold>
<HealthCheckURI>/example</HealthCheckURI>
<Scheduler>wrr</Scheduler>
<RuleId>rule-tybqi6******</RuleId>
<HealthCheck>off</HealthCheck>
<HealthCheckTimeout>34</HealthCheckTimeout>
<Url>/cache</Url>
<StickySession>off</StickySession>
<HealthCheckConnectPort>45</HealthCheckConnectPort>
<HealthyThreshold>5</HealthyThreshold>
<HealthCheckDomain>www.domain.com</HealthCheckDomain>
<ListenerSync>off</ListenerSync>
<StickySessionType>insert</StickySessionType>
<Domain>test.com</Domain>
<HealthCheckHttpCode>http_3xx</HealthCheckHttpCode>
<RuleName>Rule2</RuleName>
</Rule>
</Rules>
</DescribeRulesResponse>
JSON
格式
{
"DescribeRulesResponse": {
"RequestId": "9DEC9C28-AB05-4DDF-9A78-6B08EC9CE18C",
"Rules": {
"Rule": {
"Cookie": 23,
"CookieTimeout": 56,
"VServerGroupId": "rsp-6cejjzl******",
"HealthCheckInterval": 5,
"UnhealthyThreshold": 2,
"HealthCheckURI": "/example",
"Scheduler": "wrr",
"RuleId": "rule-tybqi6******",
"HealthCheck": "off",
"HealthCheckTimeout": 34,
"Url": "/cache",
"StickySession": "off",
"HealthCheckConnectPort": 45,
"HealthyThreshold": 5,
"HealthCheckDomain": "www.domain.com",
"ListenerSync": "off",
"StickySessionType": "insert",
"Domain": "test.com",
"HealthCheckHttpCode": "http_3xx",
"RuleName": "Rule2"
}
}
}
}
错误码
访问错误中心查看更多错误码。