ListRules
Queries forwarding rules in a specified region.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
alb:ListRules |
get |
*LoadBalancer
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| NextToken |
string |
No |
The pagination token that is used in the next request to retrieve a new page of results. Valid values:
|
FFmyTO70tTpLG6I3FmYAXGKPd**** |
| MaxResults |
integer |
No |
The maximum number of data records to read in this request. Valid values: 1 to 100. Default value: 20, which indicates that no value is specified. Note
This parameter is optional. |
20 |
| RuleIds |
array |
No |
The list of forwarding rules. You can query up to 20 forwarding rules at a time. |
|
|
string |
No |
The forwarding rule ID. |
rule-sada****** |
|
| ListenerIds |
array |
No |
The list of listener IDs. You can query up to 20 listeners at a time. |
|
|
string |
No |
The listener ID. |
lsn-i35udpz3pxsmnf**** |
|
| LoadBalancerIds |
array |
No |
The list of load balancing instance IDs. You can query up to 20 instances at a time. |
|
|
string |
No |
The load balancing instance ID. |
alb-x30o38azsuj0sx**** |
|
| Direction |
string |
No |
The direction of the forwarding rule. Valid values:
Note
ALB Basic Edition instances do not support the Response type. |
Request |
| Tag |
array<object> |
No |
The tags. |
|
|
object |
No |
The tag structure. |
||
| Key |
string |
No |
The tag key. The tag key can be up to 128 characters in length and cannot start with aliyun or acs:. It cannot contain http:// or https://. |
env |
| Value |
string |
No |
The tag value. The tag value can be up to 128 characters in length and cannot start with aliyun or acs:. It cannot contain http:// or https://. |
product |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The forwarding rule. |
||
| MaxResults |
integer |
The maximum number of records returned for this request. |
50 |
| NextToken |
string |
Indicates whether a next query exists. Valid values:
|
FFmyTO70tTpLG6I3FmYAXGKPd**** |
| RequestId |
string |
The request ID. |
CEF72CEB-54B6-4AE8-B225-F876F****** |
| Rules |
array<object> |
The list of forwarding rules. |
|
|
array<object> |
The forwarding rule structure. |
||
| ListenerId |
string |
The ID of the listener to which the forwarding rule belongs. |
lsn-i35udpz3pxsmnf**** |
| LoadBalancerId |
string |
The instance ID of the load balancing instance to which the forwarding rule belongs. |
alb-x30o38azsuj0sx**** |
| Priority |
integer |
The rule priority. Valid values: 1 to 10000. A smaller value indicates a higher priority. Note
Rule priorities must be unique within the same listener. |
1 |
| RuleActions |
array<object> |
The list of forwarding rule actions. |
|
|
array<object> |
The forwarding rule action structure. |
||
| FixedResponseConfig |
object |
The fixed response configuration. |
|
| Content |
string |
The fixed content to return. The content can be up to 1 KB in size and can contain only ASCII characters. |
dssacav |
| ContentType |
string |
The format of the fixed content to return. Valid values: text/plain, text/css, text/html, application/javascript, and application/json. |
text/plain |
| HttpCode |
string |
The HTTP response code to return. Only numeric strings in the format of HTTP_2xx, HTTP_4xx, and HTTP_5xx are supported, where x is any digit. |
HTTP_2xx |
| ForwardGroupConfig |
object |
The forward group configuration. |
|
| ServerGroupTuples |
array<object> |
The list of destination server groups to which requests are forwarded. |
|
|
object |
The list of destination server groups to which requests are forwarded. |
||
| ServerGroupId |
string |
The ID of the destination server group to which requests are forwarded. |
sgp-atstuj3rtoptyui**** |
| Weight |
integer |
The weight. Valid values: 0 to 100. |
2 |
| ServerGroupStickySession |
object |
The session persistence configuration across server groups. |
|
| Enabled |
boolean |
Specifies whether to enable session persistence across server groups when multiple server groups are specified. |
true |
| Timeout |
integer |
The timeout period for session persistence when Enabled is set to true. Unit: seconds. Valid values: 1 to 86400. |
100 |
| InsertHeaderConfig |
object |
The insert header field configuration. |
|
| Key |
string |
The name of the header field to insert. The name must be 1 to 40 characters in length and can contain lowercase and uppercase letters a to z, digits, underscores (_), and hyphens (-). The header field name cannot be used more than once in Note
You cannot use Cookie or Host as the header field name. |
key |
| Value |
string |
The content of the header field to insert.
|
ClientSrcPort |
| ValueType |
string |
The content type of the header field. Valid values:
|
SystemDefined |
| Order |
integer |
The order in which the forwarding rule action is executed. Valid values: 1 to 50000. Actions are executed in ascending order of value. The value cannot be empty or duplicated. |
1 |
| RedirectConfig |
object |
The redirect configuration. |
|
| Host |
string |
The host address to redirect to. Valid values:
|
www.example.com |
| HttpCode |
string |
The redirect type. Valid values: 301, 302, 303, 307, and 308. |
301 |
| Path |
string |
The path to redirect to. Valid values:
|
/test |
| Port |
string |
The port to redirect to. Valid values:
|
10 |
| Protocol |
string |
The protocol to redirect to. Valid values:
Note
HTTPS listeners support only redirects to HTTPS. |
HTTP |
| Query |
string |
The query string to redirect to. The query string must be 1 to 128 characters in length and can contain lowercase letters and visible characters. The characters |
quert |
| RemoveHeaderConfig |
object |
The remove HTTP header configuration. |
|
| Key |
string |
The name of the header field to remove. The name must be 1 to 40 characters in length and can contain lowercase and uppercase letters a to z, digits, underscores (_), and hyphens (-). The header field name cannot be used more than once in RemoveHeader.
|
key |
| RewriteConfig |
object |
The rewrite configuration. |
|
| Host |
string |
The host address to redirect to. Valid values:
|
www.example.com |
| Path |
string |
The destination path for the internal redirect. The path must be 1 to 128 characters in length, start with a forward slash (/), and can contain letters, digits, asterisks (*), question marks (?), and |
/tsdf |
| Query |
string |
The query string for the internal redirect. The query string must be 1 to 128 characters in length and can contain lowercase letters and visible characters. The characters |
quedsa |
| TrafficMirrorConfig |
object |
The traffic mirror configuration. |
|
| TargetType |
string |
The destination of traffic mirroring, which can be a server group. |
ForwardGroupMirror |
| MirrorGroupConfig |
object |
The configuration for mirroring traffic to a server group. |
|
| ServerGroupTuples |
array<object> |
The configuration for mirroring traffic to a server group. |
|
|
object |
The target server group for traffic mirroring. |
||
| ServerGroupId |
string |
The server group ID. |
sgp-00mkgijak0w4qgz9**** |
| Weight |
integer |
The weight. Valid values: 0 to 100. |
2 |
| TrafficLimitConfig |
object |
The traffic throttling configuration. |
|
| QPS |
integer |
The queries per second (QPS). Valid values: 1 to 100000. |
4 |
| PerIpQps |
integer |
The QPS for each IP address. Valid values: 1 to 100000. Note
If you configure both the QPS and PerIpQps parameters, the value of PerIpQps must be smaller than the value of QPS. |
80 |
| Type |
string |
The action type. Valid values:
|
ForwardGroup |
| CorsConfig |
object |
The CORS configuration. |
|
| AllowOrigin |
array |
The allowed origins. |
|
|
string |
The allowed origin. You can set this parameter to
|
http://test.com |
|
| AllowMethods |
array |
The HTTP methods allowed for cross-origin access. |
|
|
string |
The HTTP method allowed for cross-origin access. Valid values:
|
GET |
|
| AllowHeaders |
array |
The allowed cross-origin headers. |
|
|
string |
The allowed cross-origin headers. You can set this parameter to |
test_123 |
|
| ExposeHeaders |
array |
The headers that can be exposed. |
|
|
string |
The allowed cross-origin headers. You can set this parameter to |
test_123 |
|
| AllowCredentials |
string |
Specifies whether credentials are allowed. Valid values:
|
on |
| MaxAge |
integer |
The maximum cache time for preflight requests in the browser. Unit: seconds. Valid values: -1 to 172800. |
1000 |
| RuleConditions |
array<object> |
The list of forwarding rule conditions. |
|
|
array<object> |
The forwarding rule condition structure. |
||
| CookieConfig |
object |
The cookie configuration. |
|
| Values |
array<object> |
The cookie values. |
|
|
object |
The cookie values. |
||
| Key |
string |
The cookie key. The key must be 1 to 100 characters in length and can contain lowercase letters, printable characters, asterisks (*), and question marks (?). The key cannot contain spaces or |
test |
| Value |
string |
The cookie value. The value must be 1 to 128 characters in length and can contain lowercase letters, printable characters, asterisks (*), and question marks (?). The value cannot contain spaces or |
test |
| HeaderConfig |
object |
The header field configuration. |
|
| Key |
string |
The header field key. The key must be 1 to 40 characters in length and can contain letters a to z, digits, hyphens (-), and underscores (_). Cookie and Host are not supported. |
Port |
| Values |
array |
The header field values. |
|
|
string |
The header field value. The value must be 1 to 128 characters in length and can contain printable characters within the ASCII range |
5006 |
|
| HostConfig |
object |
The hostname configuration. |
|
| Values |
array |
The hostnames. |
|
|
string |
The hostname. Naming rules:
|
www.example.com |
|
| MethodConfig |
object |
The request method configuration. |
|
| Values |
array |
The request methods. |
|
|
string |
The request method. Valid values: HEAD, GET, POST, OPTIONS, PUT, PATCH, and DELETE. |
PUT |
|
| PathConfig |
object |
The forwarding path configuration. |
|
| Values |
array |
The forwarding paths. |
|
|
string |
The forwarding path. The path must be 1 to 128 characters in length, start with a forward slash (/), and can contain letters, digits, asterisks (*), question marks (?), and |
/test |
|
| QueryStringConfig |
object |
The query string configuration. |
|
| Values |
array<object> |
The query strings. |
|
|
object |
The query strings. |
||
| Key |
string |
The query string key. The key must be 1 to 100 characters in length and can contain lowercase letters, printable characters, asterisks (*), and question marks (?). The key cannot contain spaces or |
test |
| Value |
string |
The query string value. The value must be 1 to 128 characters in length and can contain lowercase letters, printable characters, asterisks (*), and question marks (?). The value cannot contain spaces or |
test |
| SourceIpConfig |
object |
The source IP-based service traffic matching configuration. |
|
| Values |
array |
The source IP addresses to match. |
|
|
string |
One or more IP addresses or CIDR blocks. A maximum of 5 source IP addresses can be added to a forwarding rule. |
192.168.XX.XX/32 |
|
| ResponseStatusCodeConfig |
object |
The response status code configuration. |
|
| Values |
array |
The list of response status codes. |
|
|
string |
The response status code. |
200 |
|
| ResponseHeaderConfig |
object |
The response HTTP header configuration. |
|
| Key |
string |
The key of the response HTTP header. The key must be 1 to 40 characters in length. It can contain lowercase letters, digits, hyphens (-), and underscores (_). Cookie and Host are not supported. |
key |
| Values |
array |
The list of response HTTP header values. |
|
|
string |
The value of the response HTTP header. The value must be 1 to 128 characters in length. |
value |
|
| Type |
string |
The type of the forwarding rule. Valid values:
|
Host |
| RuleId |
string |
The forwarding rule ID. |
rule-bpn0kn908w4nbw**** |
| RuleName |
string |
The name of the forwarding rule. The name must be 2 to 128 characters in length and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter. |
rule-instance-test |
| RuleStatus |
string |
The status of the forwarding rule. Valid values:
|
Available |
| Direction |
string |
The direction of the forwarding rule. Valid values:
Note
ALB Basic Edition instances do not support the Response type. |
Request |
| Tags |
array<object> |
The tags. |
|
|
object |
The tag structure. |
||
| Key |
string |
The tag key. The tag key can be up to 128 characters in length and cannot start with aliyun or acs:. It cannot contain http:// or https://. |
env |
| Value |
string |
The tag value. The tag value can be up to 128 characters in length and cannot start with aliyun or acs:. It cannot contain http:// or https://. |
product |
| TotalCount |
integer |
The total number of data records returned for the current request. |
1000 |
Examples
Success response
JSON format
{
"MaxResults": 50,
"NextToken": "FFmyTO70tTpLG6I3FmYAXGKPd****",
"RequestId": "CEF72CEB-54B6-4AE8-B225-F876F******",
"Rules": [
{
"ListenerId": "lsn-i35udpz3pxsmnf****",
"LoadBalancerId": "alb-x30o38azsuj0sx****",
"Priority": 1,
"RuleActions": [
{
"FixedResponseConfig": {
"Content": "dssacav",
"ContentType": "text/plain",
"HttpCode": "HTTP_2xx"
},
"ForwardGroupConfig": {
"ServerGroupTuples": [
{
"ServerGroupId": "sgp-atstuj3rtoptyui****",
"Weight": 2
}
],
"ServerGroupStickySession": {
"Enabled": true,
"Timeout": 100
}
},
"InsertHeaderConfig": {
"Key": "key",
"Value": "ClientSrcPort",
"ValueType": "SystemDefined"
},
"Order": 1,
"RedirectConfig": {
"Host": "www.example.com",
"HttpCode": "301",
"Path": "/test",
"Port": "10",
"Protocol": "HTTP",
"Query": "quert"
},
"RemoveHeaderConfig": {
"Key": "key"
},
"RewriteConfig": {
"Host": "www.example.com",
"Path": "/tsdf",
"Query": "quedsa"
},
"TrafficMirrorConfig": {
"TargetType": "ForwardGroupMirror",
"MirrorGroupConfig": {
"ServerGroupTuples": [
{
"ServerGroupId": "sgp-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"
]
},
"ResponseStatusCodeConfig": {
"Values": [
"200"
]
},
"ResponseHeaderConfig": {
"Key": "key",
"Values": [
"value"
]
},
"Type": "Host"
}
],
"RuleId": "rule-bpn0kn908w4nbw****",
"RuleName": "rule-instance-test",
"RuleStatus": "Available",
"Direction": "Request",
"Tags": [
{
"Key": "env",
"Value": "product"
}
]
}
],
"TotalCount": 1000
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 403 | Forbidden.LoadBalancer | Authentication is failed for %s. | Authentication is failed for %s. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.