API 名称:DescribeRules。
API 域名:open.volcengineapi.com 。
API 描述:获取指定监听器转发规则列表。
节流限制:每秒最多提交 40 个 API 请求。
在使用该部分 API 提交请求时必须包含以下 URI 参数。
除了 URI 参数,该 API 请求还需要包含签名参数。关于更多签名参数的信息,参见公共请求参数。
名称 | 类型 | 是否必选 | 格式 | 说明 |
---|---|---|---|---|
Action | String | 是 | [a-zA-Z]+ | API 名称,如 DescribeRules。 |
Version | String | 是 | YYYY-MM-DD | API 版本信息。该参数的取值是 2020-04-01 。 |
X-Expires | Integer | 否 | 900 | 表示签名的有效时间,单位是秒,默认值是900。 |
在使用该 API 提交请求时,请求参数中可以包含的参数如下。
参数 | 类型 | 是否必选 | 参数说明 | 示例值 |
---|---|---|---|---|
ListenerId | String | 是 | 监听器 ID。 | lsn-2fea4ayvu2g3k5oxruuz**** |
参数 | 类型 | 参数说明 | 示例值 |
---|---|---|---|
RequestId | String | 请求 ID。 | 20210811152539010225146063030**** |
Rules | Array | 符合条件的转发规则的详细信息。详见 Rules(基础版)和 Rules(标准版)。 | - |
参数 | 类型 | 参数说明 |
---|---|---|
RuleId | String | 转发规则 ID。 |
Domain | String | 转发条件中的域名。 |
Url | String | 转发条件中的路径。 |
RuleAction | String | 转发动作:
|
ServerGroupId | String | 转发规则关联的后端服务器组 ID。 |
TrafficLimitEnabled | String | QPS 限速功能的开启状态:
|
TrafficLimitQPS | Integer | QPS,表示每秒请求数。 |
Description | String | 转发规则的描述。 |
RewriteEnabled | String | “重写”功能的开启状态:
|
RedirectConfig | Struct | 重定向配置。具体可参见 RedirectConfig。 |
RewriteConfig | Struct | 重写配置信息。具体可参见 RewriteConfig。 |
ForwardGroupConfig | Struct | 服务器组配置,具体可参见ForwardGroupConfig。 |
RedirectConfig
参数 | 类型 | 参数说明 |
---|---|---|
RedirectDomain | String | 请求被重定向到的域名。 |
RedirectUri | String | 请求被重定向到的路径。 |
RedirectPort | Integer | 请求被重定向到的端口。 |
RedirectHttpCode | Integer | 状态码,用于表示重定向的响应。 |
RedirectProtocol | String | 重定向使用的协议。 |
RewriteConfig
参数 | 类型 | 参数说明 |
---|---|---|
RewritePath | String | 重写后的路径。 |
ForwardGroupConfig
参数 | 类型 | 参数说明 |
---|---|---|
ServerGroupTuples | Array | 请求被转发到的后端服务器组的列表。具体可参见 ServerGroupTuples。 |
StickySessionEnabled | String | 组间会话保持功能的开启状态:
|
StickySessionTimeout | Integer | 组间会话保持的超时时间。单位:秒。 |
ServerGroupTuples
参数 | 类型 | 参数说明 |
---|---|---|
ServerGroupId | String | 请求被转发到的后端服务器组的 ID。 |
Weight | Integer | 服务器组的权重。 |
参数 | 类型 | 参数说明 |
---|---|---|
RuleId | String | 转发规则 ID。 |
Description | String | 转发规则的描述。 |
Priority | Integer | 转发规则的优先级。 |
RuleConditions | Array | 转发条件。具体可参见 RuleConditions。 |
RuleActions | Array | 转发动作。具体可参见 RuleActions。 |
RuleConditions
参数 | 类型 | 参数说明 |
---|---|---|
Type | String | 转发条件的类型:
|
HostConfig | Struct | 域名配置,具体可参见 HostConfig。 |
PathConfig | Struct | 路径配置,具体可参见 PathConfig。 |
HeaderConfig | Struct | HTTP 标头配置,具体可参见 HeaderConfig。 |
HostConfig
参数 | 类型 | 参数说明 |
---|---|---|
Values | Array | 域名。 |
PathConfig
参数 | 类型 | 参数说明 |
---|---|---|
Values | Array | 路径。 |
HeaderConfig
参数 | 类型 | 参数说明 |
---|---|---|
Key | String | HTTP 标头的键。 |
Values | Array | HTTP 标头的值。 |
RuleActions
参数 | 类型 | 参数说明 |
---|---|---|
Type | String | 转发动作的类型:
|
ForwardGroupConfig | Struct | “转发至”转发动作的配置,具体可参见ForwardGroupConfig。 |
RedirectConfig | Struct | “重定向至”转发动作的配置,具体可参见RedirectConfig。 |
RewriteConfig | Struct | “重写”转发动作的配置,具体可参见RewriteConfig。 |
TrafficLimitConfig | Struct | “限速”转发动作的配置,具体可参见TrafficLimitConfig。 |
ForwardGroupConfig
参数 | 类型 | 参数说明 |
---|---|---|
ServerGroupTuples | Array | 转发至服务器组配置,具体可参见ServerGroupTuples |
ServerGroupStickySession | Struct | 转发至会话保持配置,具体可参见ServerGroupStickySession |
ServerGroupTuples
参数 | 类型 | 参数说明 |
---|---|---|
ServerGroupId | String | 请求被转发到的后端服务器组的 ID。 |
Weight | Integer | 后端服务器组的权重。 |
ServerGroupStickySession
参数 | 类型 | 参数说明 |
---|---|---|
Enabled | String | 是否已开启组间会话保持:
|
Timeout | Integer | 组间会话保持的超时时间。单位:秒。 |
RedirectConfig
参数 | 类型 | 参数说明 |
---|---|---|
Host | String | 请求被重定向到的域名。 |
HttpCode | Integer | 状态码,用于表示重定向的响应。 |
Path | String | 请求被重定向到的路径。 |
Port | Integer | 请求被重定向到的端口。 |
Protocol | String | 重定向使用的协议:
|
RewriteConfig
参数 | 类型 | 参数说明 |
---|---|---|
Path | String | 重写后的路径。 |
TrafficLimitConfig
参数 | 类型 | 参数说明 |
---|---|---|
QPS | Integer | 限速 QPS。QPS 表示每秒请求数。 |
GET /?Action=DescribeRules&ListenerId=lsn-1g0puwcxu****8ibuxxw2pmf7&Version=2020-04-01 HTTP/1.1 Host: open.volcengineapi.com Region: cn-beijing ServiceName: alb
{ "ResponseMetadata": { "RequestId": "20250415141007030DD9CCED8E1561****", "Action": "DescribeRules", "Version": "2020-04-01", "Service": "alb", "Region": "cn-beijing" }, "Result": { "RequestId": "20250415141007030DD9CCED8E1561****", "Rules": [ { "RuleId": "rule-1vymuiwz3k2rk3766qags****", "Domain": "-", "Url": "/", "Description": "", "TrafficLimitEnabled": "off", "TrafficLimitQPS": 0, "RuleAction": "", "ServerGroupId": "rsp-3vu05crn1qrcw6096ps6****", "RewriteEnabled": "off", "RedirectConfig": null, "RewriteConfig": null, "ForwardGroupConfig": null } ] } }
{ "ResponseMetadata": { "RequestId": "20250313182653****2514214204001104", "Action": "DescribeRules", "Version": "2020-04-01", "Service": "alb", "Region": "cn-beijing" }, "Result": { "RequestId": "20250313182653****2514214204001104", "Rules": [ { "RuleId": "rule-2wx8do94l2hhc7ootqnpt****", "Description": "desc", "Priority": 1, "Direction": "request", "RuleConditions": [ { "Type": "Host", "HostConfig": { "Values": [ "domain.com", "abc.cn" ] }, "PathConfig": {}, "HeaderConfig": {} }, { "Type": "Path", "HostConfig": {}, "PathConfig": { "Values": [ "/" ] }, "HeaderConfig": {} } ], "RuleActions": [ { "Type": "TrafficLimit", "ForwardGroupConfig": {}, "RedirectConfig": {}, "RewriteConfig": {}, "TrafficLimitConfig": { "QPS": 899 } }, { "Type": "Rewrite", "ForwardGroupConfig": {}, "RedirectConfig": {}, "RewriteConfig": { "Path": "/rewrite" }, "TrafficLimitConfig": {} }, { "Type": "ForwardGroup", "ForwardGroupConfig": { "ServerGroupStickySession": { "Enabled": "on", "Timeout": 8888 }, "ServerGroupTuples": [ { "ServerGroupId": "rsp-1ijdvi6fty8sg74adhfom****", "Weight": 100 }, { "ServerGroupId": "rsp-2wx88juyt4utc7ootqny****", "Weight": 100 } ] }, "RedirectConfig": {}, "RewriteConfig": {}, "TrafficLimitConfig": {} } ] }, { "RuleId": "rule-1ijdvra0wkidc74adhf2t****", "Description": "", "Direction": "request", "RuleActions": [ { "Type": "ForwardGroup", "ForwardGroupConfig": { "ServerGroupTuples": [ { "ServerGroupId": "rsp-1ijdvi6fty8sg74adhfo****", "Weight": 100 } ] } } ] } ] } }
如果响应正文包含 Error 字段,则表示 API 请求失败。此处仅展示当前 API 的错误码,更多错误码请参见公共错误码。
HTTP Code | 错误码 | 错误信息 | 错误描述 |
---|---|---|---|
404 | InvalidListener.NotFound | The specified Listener does not exist. | 指定的监听器不存在。 |