调用ListRules接口查询指定地域的转发规则。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | ListRules |
要执行的操作。 取值:ListRules。 |
NextToken | String | 否 | FFmyTO70tTpLG6I3FmYAXGKPd**** |
用来标记当前开始读取的位置,设置为空表示从头开始。 |
MaxResults | Integer | 否 | 20 |
本次读取的最大数据记录数。 取值:1~100。 默认值:20,表示用户没有传入数据。 说明 此参数为可选。
|
RuleIds.N | String | 否 | rule-sada |
转发规则ID列表,一次最多支持查询20个转发规则。 |
ListenerIds.N | String | 否 | lsn-i35udpz3pxsmnf**** |
监听ID列表,一次最多支持查询20个监听。 |
LoadBalancerIds.N | String | 否 | alb-x30o38azsuj0sx**** |
负载均衡实例ID列表,一次最多支持查询20个实例。 |
Direction | String | 否 | Request |
转发规则的方向。取值:
说明 基础版的ALB实例不支持Response类型.
|
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
MaxResults | Integer | 50 |
本次请求所返回的最大记录条数。 |
NextToken | String | FFmyTO70tTpLG6I3FmYAXGKPd**** |
是否拥有下一次查询的令牌(Token)。取值:
|
RequestId | String | CEF72CEB-54B6-4AE8-B225-F876FF7BA984 |
请求ID。 |
Rules | Array of Rule |
转发规则列表。 |
|
ListenerId | String | lsn-i35udpz3pxsmnf**** |
转发规则所属监听ID。 |
LoadBalancerId | String | alb-x30o38azsuj0sx**** |
转发规则所属负载均衡实例ID。 |
Priority | Integer | 1 |
规则优先级,取值为1~10000。值越小表示优先级越高。 说明 同一个监听内规则优先级必须唯一。
|
RuleActions | Array of Action |
转发规则动作列表。 |
|
FixedResponseConfig | Object |
固定响应内容配置。 |
|
Content | String | dssacav |
返回的固定内容。最大1 KB字节,只支持ASCII字符。 |
ContentType | String | text/plain |
返回固定内容的格式。 取值:text/plain、text/css、text/html、application/javascript或application/json。 |
HttpCode | String | HTTP_2xx |
返回的HTTP响应码,仅支持HTTP_2xx、HTTP_4xx、HTTP_5xx数字型字符串,x为任意数字。 |
ForwardGroupConfig | Object |
转发组配置。 |
|
ServerGroupTuples | Array of ServerGroupTuple |
转发到的目的服务器组列表。 |
|
ServerGroupId | String | sg-atstuj3rtoptyui**** |
转发到的目的服务器组。 |
Weight | Integer | 2 |
权重。取值范围:0~100。 |
InsertHeaderConfig | Object |
写入头字段配置。 |
|
Key | String | key |
插入的头字段名称,长度为1~40个字符,支持大小写字母a~z、数字、下划线(_)和短划线(-)。头字段名称不能重复用于 说明 不允许用户在头字段名称中使用Cookie和Host。
|
Value | String | ClientSrcPort |
插入的头字段内容。
|
ValueType | String | SystemDefined |
头字段内容类型。取值:
|
Order | Integer | 1 |
转发规则动作执行的顺序,取值为1~50000,按值从小到大执行动作。值不能为空,不能重复。 |
RedirectConfig | Object |
重定向配置。 |
|
Host | String | www.example.com |
要跳转的主机地址。取值:
|
HttpCode | String | 301 |
跳转方式,取值为301、302、303、307或308。 |
Path | String | /test |
要跳转的路径。取值:
|
Port | String | 10 |
要跳转的端口。取值:
|
Protocol | String | HTTP |
要跳转的协议。取值:
说明 HTTPS监听仅支持跳转HTTPS协议。
|
Query | String | quert |
要跳转的查询字符串。长度为1~128个字符,支持小写字母和可见字符,不支持 |
RewriteConfig | Object |
重写配置。 |
|
Host | String | www.example.com |
要跳转的主机地址。取值:
|
Path | String | /tsdf |
内部跳转的目的路径。长度为1~128个字符,以正斜线(/)开头,支持字母、数字、星号(*)、半角问号(?)和 |
Query | String | quedsa |
内部跳转的查询字符串。长度为1~128个字符,支持小写字母和可见字符,不支持 |
TrafficMirrorConfig | Object |
流量镜像。 |
|
MirrorGroupConfig | Object |
流量镜像至服务器组。 |
|
ServerGroupTuples | Array of ServerGroupTuple |
流量镜像至服务器组。 |
|
ServerGroupId | String | srg-00mkgijak0w4qgz9**** |
服务器组ID。 |
Weight | Integer | 2 |
权重。取值范围:0~100。 |
TrafficLimitConfig | Object |
流量限速。 |
|
QPS | Integer | 4 |
每秒请求次数。取值范围:1~100000。 |
PerIpQps | Integer | 80 |
单IP每秒请求次数。 取值范围:1 ~ 100000。 说明 如果同时配置QPS参数,PerIpQps参数的取值必须小于QPS参数的取值。
|
Type | String | ForwardGroup |
动作类型。取值:
转发规则中包括的动作类型:
|
CorsConfig | Object |
跨域。 |
|
AllowOrigin | Array of String | http://test.com |
允许访问的来源。支持配置为
|
AllowMethods | Array of String | GET |
选择跨域访问时允许的HTTP方法。取值:
|
AllowHeaders | Array of String | test_123 |
允许跨域的Header列表。支持配置为 |
ExposeHeaders | Array of String | test_123 |
允许跨域的Header列表。支持配置为 |
AllowCredentials | String | on |
是否允许携带凭证信息。取值:
|
MaxAge | Long | 1000 |
预检请求在浏览器的最大缓存时间,单位:秒。 取值范围:-1~172800。 |
RuleConditions | Array of Condition |
转发规则条件列表。 |
|
CookieConfig | Object |
Cookie配置。 |
|
Values | Array of Value |
Cookie值。 |
|
Key | String | test |
Cookie键。长度为1~100个字符,支持小写字母、可见字符、星号(*)和半角问号(?),不支持空格和 |
Value | String | test |
Cookie值。长度为1~128个字符,支持小写字母、可见字符、星号(*)和半角问号(?),不支持空格和 |
HeaderConfig | Object |
头字段配置。 |
|
Key | String | Port |
头字段键。长度为1~40个字符。支持字母a~z、数字、短划线(-)和下划线(_)。不支持Cookie和Host。 |
Values | Array of String | 5006 |
头字段值。长度为1~128个字符。支持ASCII码值 |
HostConfig | Object |
主机配置。 |
|
Values | Array of String | www.example.com |
主机名。命名规则:
|
MethodConfig | Object |
请求方法配置。 |
|
Values | Array of String | PUT |
请求方法。 取值:HEAD、GET、POST、OPTIONS、PUT、PATCH或DELETE。 |
PathConfig | Object |
转发路径配置。 |
|
Values | Array of String | /test |
转发路径。长度为1~128个字符,以正斜线(/)开头,支持字母、数字、星号(*)、半角问号(?)和 |
QueryStringConfig | Object |
查询字符串配置。 |
|
Values | Array of Value |
查询字符串。 |
|
Key | String | test |
查询字符串键。长度为1~100个字符,支持小写字母、可见字符、星号(*)和半角问号(?),不支持空格和 |
Value | String | test |
查询字符串值。长度为1~128个字符,支持小写字母、可见字符、星号(*)和半角问号(?),不支持空格和 |
SourceIpConfig | Object |
基于源IP业务流量匹配。 |
|
Values | Array of String | 192.168.XX.XX/32 |
添加一个或多个IP地址或者IP地址段。 一条转发规则中最多支持添加5条源IP。 |
Type | String | Host |
转发规则类型。取值:
|
RuleId | String | rule-bpn0kn908w4nbw**** |
转发规则ID。 |
RuleName | String | rule-instance-test |
转发规则名称。 长度为2~128个英文或中文字符,必须以大小字母或中文开头,可包含数字,半角句号(.),下划线(_)和短划线(-)。 |
RuleStatus | String | Available |
转发规则状态。取值:
|
TotalCount | Integer | 1000 |
本次请求条件下返回的总数据记录数。 |
示例
请求示例
http(s)://[Endpoint]/?Action=ListRules
&NextToken=FFmyTO70tTpLG6I3FmYAXGKPd****
&MaxResults=20
&RuleIds=["rule-sada"]
&ListenerIds=["lsn-i35udpz3pxsmnf****"]
&LoadBalancerIds=["alb-x30o38azsuj0sx****"]
&Direction=Request
&公共请求参数
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<ListRulesResponse>
<MaxResults>50</MaxResults>
<NextToken>FFmyTO70tTpLG6I3FmYAXGKPd****</NextToken>
<RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>
<Rules>
<ListenerId>lsn-i35udpz3pxsmnf****</ListenerId>
<LoadBalancerId>alb-x30o38azsuj0sx****</LoadBalancerId>
<Priority>1</Priority>
<RuleActions>
<FixedResponseConfig>
<Content>dssacav</Content>
<ContentType>text/plain</ContentType>
<HttpCode>HTTP_2xx</HttpCode>
</FixedResponseConfig>
<ForwardGroupConfig>
<ServerGroupTuples>
<ServerGroupId>sg-atstuj3rtoptyui****</ServerGroupId>
<Weight>2</Weight>
</ServerGroupTuples>
</ForwardGroupConfig>
<InsertHeaderConfig>
<Key>key</Key>
<Value>ClientSrcPort</Value>
<ValueType>SystemDefined</ValueType>
</InsertHeaderConfig>
<Order>1</Order>
<RedirectConfig>
<Host>www.example.com</Host>
<HttpCode>301</HttpCode>
<Path>/test</Path>
<Port>10</Port>
<Protocol>HTTP</Protocol>
<Query>quert</Query>
</RedirectConfig>
<RewriteConfig>
<Host>www.example.com</Host>
<Path>/tsdf</Path>
<Query>quedsa</Query>
</RewriteConfig>
<TrafficMirrorConfig>
<MirrorGroupConfig>
<ServerGroupTuples>
<ServerGroupId>srg-00mkgijak0w4qgz9****</ServerGroupId>
<Weight>2</Weight>
</ServerGroupTuples>
</MirrorGroupConfig>
</TrafficMirrorConfig>
<TrafficLimitConfig>
<QPS>4</QPS>
<PerIpQps>80</PerIpQps>
</TrafficLimitConfig>
<Type>ForwardGroup</Type>
<CorsConfig>
<AllowOrigin>http://test.com</AllowOrigin>
<AllowMethods>GET</AllowMethods>
<AllowHeaders>test_123</AllowHeaders>
<ExposeHeaders>test_123</ExposeHeaders>
<AllowCredentials>on</AllowCredentials>
<MaxAge>1000</MaxAge>
</CorsConfig>
</RuleActions>
<RuleConditions>
<CookieConfig>
<Values>
<Key>test</Key>
<Value>test</Value>
</Values>
</CookieConfig>
<HeaderConfig>
<Key>Port</Key>
<Values>5006</Values>
</HeaderConfig>
<HostConfig>
<Values>www.example.com</Values>
</HostConfig>
<MethodConfig>
<Values>PUT</Values>
</MethodConfig>
<PathConfig>
<Values>/test</Values>
</PathConfig>
<QueryStringConfig>
<Values>
<Key>test</Key>
<Value>test</Value>
</Values>
</QueryStringConfig>
<SourceIpConfig>
<Values>192.168.XX.XX/32</Values>
</SourceIpConfig>
<Type>Host</Type>
</RuleConditions>
<RuleId>rule-bpn0kn908w4nbw****</RuleId>
<RuleName>rule-instance-test</RuleName>
<RuleStatus>Available</RuleStatus>
</Rules>
<TotalCount>1000</TotalCount>
</ListRulesResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"MaxResults" : 50,
"NextToken" : "FFmyTO70tTpLG6I3FmYAXGKPd****",
"RequestId" : "CEF72CEB-54B6-4AE8-B225-F876FF7BA984",
"Rules" : [ {
"ListenerId" : "lsn-i35udpz3pxsmnf****",
"LoadBalancerId" : "alb-x30o38azsuj0sx****",
"Priority" : 1,
"RuleActions" : [ {
"FixedResponseConfig" : {
"Content" : "dssacav",
"ContentType" : "text/plain",
"HttpCode" : "HTTP_2xx"
},
"ForwardGroupConfig" : {
"ServerGroupTuples" : [ {
"ServerGroupId" : "sg-atstuj3rtoptyui****",
"Weight" : 2
} ]
},
"InsertHeaderConfig" : {
"Key" : "key",
"Value" : "ClientSrcPort",
"ValueType" : "SystemDefined"
},
"Order" : 1,
"RedirectConfig" : {
"Host" : "www.example.com",
"HttpCode" : "301",
"Path" : "/test",
"Port" : "10",
"Protocol" : "HTTP",
"Query" : "quert"
},
"RewriteConfig" : {
"Host" : "www.example.com",
"Path" : "/tsdf",
"Query" : "quedsa"
},
"TrafficMirrorConfig" : {
"MirrorGroupConfig" : {
"ServerGroupTuples" : [ {
"ServerGroupId" : "srg-00mkgijak0w4qgz9****",
"Weight" : 2
} ]
}
},
"TrafficLimitConfig" : {
"QPS" : 4,
"PerIpQps" : 80
},
"Type" : "ForwardGroup",
"CorsConfig" : {
"AllowOrigin" : [ "http://test.com" ],
"AllowMethods" : [ "GET" ],
"AllowHeaders" : [ "test_123" ],
"ExposeHeaders" : [ "test_123" ],
"AllowCredentials" : "on",
"MaxAge" : 1000
}
} ],
"RuleConditions" : [ {
"CookieConfig" : {
"Values" : [ {
"Key" : "test",
"Value" : "test"
} ]
},
"HeaderConfig" : {
"Key" : "Port",
"Values" : [ "5006" ]
},
"HostConfig" : {
"Values" : [ "www.example.com" ]
},
"MethodConfig" : {
"Values" : [ "PUT" ]
},
"PathConfig" : {
"Values" : [ "/test" ]
},
"QueryStringConfig" : {
"Values" : [ {
"Key" : "test",
"Value" : "test"
} ]
},
"SourceIpConfig" : {
"Values" : [ "192.168.XX.XX/32" ]
},
"Type" : "Host"
} ],
"RuleId" : "rule-bpn0kn908w4nbw****",
"RuleName" : "rule-instance-test",
"RuleStatus" : "Available"
} ],
"TotalCount" : 1000
}
错误码
访问错误中心查看更多错误码。