调用UpdateRulesAttribute批量更新转发规则属性。
接口说明
UpdateRulesAttribute接口属于异步接口,即系统返回一个请求ID,但该转发规则属性尚未批量更新成功,系统后台的更新任务仍在进行。您可以调用ListRules查询转发规则属性的更新状态:
-
当多条转发规则属性处于Configuring状态时,表示转发规则属性正在批量更新中。
-
当多条转发规则属性处于Available状态时,表示转发规则属性批量更新成功。
-
一条转发规则最多支持添加的条件数(RuleConditions)和动作数(RuleActions)如下:
- 条件数:基础版5条,标准版10条,WAF增强版10条。
- 动作数:基础版3条,标准版5条,WAF增强版5条。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
授权信息
下表是API对应的授权信息,可以在RAM权限策略语句的Action
元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:
- 操作:是指具体的权限点。
- 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
- 资源类型:是指操作中支持授权的资源类型。具体说明如下:
- 对于必选的资源类型,用背景高亮的方式表示。
- 对于不支持资源级授权的操作,用
全部资源
表示。
- 条件关键字:是指云产品自身定义的条件关键字。
- 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
操作 | 访问级别 | 资源类型 | 条件关键字 | 关联操作 |
---|---|---|---|---|
alb:UpdateRulesAttribute | Write |
|
| 无 |
请求参数
名称 | 类型 | 必填 | 描述 | 示例值 |
---|---|---|---|---|
ClientToken | string | 否 | 客户端Token,用于保证请求的幂等性。 由客户端生成该参数值,要保证在不同请求间唯一。ClientToken只支持ASCII字符。 说明
若您未指定,则系统自动使用API请求的RequestId作为ClientToken标识。每次API请求的RequestId不一样。
| 123e4567-e89b-12d3-a456-426655440000 |
Rules | object [] | 是 | 转发规则列表。一次最多不能超过10条。 | |
Priority | integer | 否 | 规则优先级,取值范围:1~10000。值越小表示优先级越高。最多支持添加20个规则优先级 说明
同一个监听内规则优先级必须唯一。
| 10 |
RuleName | string | 否 | 转发规则名称。 长度为2~128个英文或中文字符,必须以大小字母或中文开头,可包含数字,半角句号(.),下划线(_)和短划线(-)。最多支持添加20个转发规则名称。 | rule-instance-test |
RuleActions | object [] | 否 | 转发规则动作列表。 | |
FixedResponseConfig | object | 否 | 返回固定内容动作配置。最多支持添加20个返回固定内容动作配置。 | |
Content | string | 否 | 返回的固定内容。最大1 KB,只支持ASCII字符。 | dssacav |
ContentType | string | 否 | 返回固定内容的格式。 取值:text/plain、text/css、text/html、application/javascript或application/json。 | text/plain |
HttpCode | string | 否 | 返回的HTTP响应码,仅支持HTTP_2xx、HTTP_4xx、HTTP_5xx数字型字符串,x为任意数字。 | 200 |
ForwardGroupConfig | object | 否 | 转发组动作配置。最多支持添加20个转发组动作配置。 | |
ServerGroupTuples | object [] | 否 | 转发到的目的服务器组列表。 | |
ServerGroupId | string | 否 | 转发到的目的服务器组。 | sg-atstuj3rtoptyui**** |
Weight | integer | 否 | 权重。取值越大,权重越大,表示转发的访问请求更多。取值范围:0~100。
| 30 |
ServerGroupStickySession | object | 否 | 服务器组之间会话保持。 | |
Enabled | boolean | 否 | 是否开启会话保持。取值:
| false |
Timeout | integer | 否 | 超时时间。单位:秒。取值范围:1~86400。 | 2 |
InsertHeaderConfig | object | 否 | 插入头部动作配置。最多支持添加20个插入头部动作配置。 | |
CoverEnabled | boolean | 否 | 是否覆盖请求中的值。取值:
| false |
Key | string | 否 | 插入的头字段名称,长度为1~40个字符,支持大小写字母a~z、数字、下划线(_)和短划线(-)。头字段名称不能重复用于 说明
不支持将Key设为以下字段(不区分大小写): slb-id 、slb-ip 、x-forwarded-for 、x-forwarded-proto 、x-forwarded-eip 、x-forwarded-port 、x-forwarded-client-srcport 、connection 、upgrade 、content-length 、transfer-encoding 、keep-alive 、te、host 、cookie 、remoteip 、authority 。
| test |
Value | string | 否 | 插入的头字段内容。
| UserDefined |
ValueType | string | 否 | 取值类型。取值:
| UserDefined |
Order | integer | 是 | 转发规则动作执行的顺序,取值范围:1~50000,按值从小到大执行动作。值不能为空,不能重复。最多支持添加20个转发规则动作执行的顺序。 | 1 |
RedirectConfig | object | 否 | 重定向动作配置。最多支持添加20个重定向动作配置。 | |
Host | string | 否 | 要跳转到的主机名。 命名规则:
| www.example.com |
HttpCode | string | 否 | 跳转方式。取值:301、302、303、307、308。 | 301 |
Path | string | 否 | 要跳转的路径。
| /test |
Port | string | 否 | 要跳转的端口。 取值范围:1~63335。 | 10 |
Protocol | string | 否 | 要跳转的协议。 取值:HTTP或HTTPS。 说明
HTTPS监听仅支持跳转HTTPS协议。
| HTTP |
Query | string | 否 | 要跳转的查询字符串。 长度为1~128个字符,支持小写字母和可见字符,不支持 | quert |
RewriteConfig | object | 否 | 重写配置。最多支持添加20个重写配置。 | |
Host | string | 否 | 内部跳转的目的主机地址。 命名规则:
| www.example.com |
Path | string | 否 | 内部跳转的目的路径。
| /tsdf |
Query | string | 否 | 内部跳转的查询字符串。 长度为1~128个字符,支持小写字母和可见字符,不支持 | quedsa |
Type | string | 是 | 动作类型,最多支持添加11个动作类型。取值:
转发规则中包括的动作类型:
| Host |
TrafficLimitConfig | object | 否 | 流量限速。最多支持添加20个流量限速。 | |
QPS | integer | 否 | 每秒请求次数。取值范围:1~1000000。 | 2 |
PerIpQps | integer | 否 | 单IP每秒请求次数。 取值范围:1~1000000。 说明
如果同时配置QPS参数,PerIpQps参数的取值必须小于QPS参数的取值。
| 80 |
TrafficMirrorConfig | object | 否 | 流量镜像。最多支持添加20个流量镜像。 | |
TargetType | string | 否 | 镜像的目标类型。取值:
| ForwardGroupMirror |
MirrorGroupConfig | object | 否 | 流量镜像至服务器组。 | |
ServerGroupTuples | object [] | 否 | 流量镜像至服务器组。 | |
ServerGroupId | string | 否 | 服务器组ID。 | srg-00mkgijak0w4qgz9**** |
RemoveHeaderConfig | object | 否 | 去除HTTP标头。最多支持添加20个去除HTTP标头。 | |
Key | string | 否 | 头字段键。
| Port |
CorsConfig | object | 否 | 跨域。 | |
AllowOrigin | array | 否 | 允许的访问来源。 | |
string | 否 | 允许的访问来源。支持配置为
| http://example.com | |
AllowMethods | array | 否 | 选择跨域访问时允许的HTTP方法。 | |
string | 否 | 选择跨域访问时允许的HTTP方法。取值:
| GET | |
AllowHeaders | array | 否 | 允许跨域的Header列表。 | |
string | 否 | 允许跨域的Header列表。支持配置为 | test_123 | |
ExposeHeaders | array | 否 | 允许暴露的Header列表。 | |
string | 否 | 允许暴露的 Header 列表。支持配置为 | test_123 | |
AllowCredentials | string | 否 | 是否允许携带凭证信息。取值:
| on |
MaxAge | long | 否 | 预检请求在浏览器的最大缓存时间,单位:秒。 取值范围:-1~172800。 | 1000 |
RuleConditions | object [] | 否 | 转发规则条件。 | |
CookieConfig | object | 否 | Cookie条件配置。最多支持添加20个Cookie条件配置。 | |
Values | object [] | 否 | Cookie键值对列表。 | |
Key | string | 否 | Cookie键,长度为1~100个字符,支持小写字母、可见字符、星号(*)和半角问号(?),不支持空格和 | test |
Value | string | 否 | Cookie值,长度为1~128个字符,支持小写英文字母、可见字符、星号(*)和半角问号(?),不支持空格和 | test |
HeaderConfig | object | 否 | HTTP标头条件配置。最多支持添加20个HTTP标头条件配置。 | |
Key | string | 否 | 头字段键,长度为1~40个字符。支持字母a~z、数字、短划线(-)和下划线(_)。不支持Cookie和Host。 | Port |
Values | array | 否 | HTTP标头值列表。 | |
string | 否 | 头字段值。长度为1~128个字符。支持ASCII码值 | 5006 | |
HostConfig | object | 否 | 主机名条件配置。最多支持添加20个主机名条件配置。 | |
Values | array | 否 | 主机名列表。 | |
string | 否 | 主机名。 命名规则:
| www.example.com | |
MethodConfig | object | 否 | HTTP请求方法条件配置。N的取值范围:1~20。 | |
Values | array | 否 | HTTP请求方法列表。 | |
string | 否 | 请求方法。 取值:HEAD、GET、POST、OPTIONS、PUT、PATCH、DELETE。 | PUT | |
PathConfig | object | 否 | 查询字符串条件配置。最多支持添加20个查询字符串条件配置。 | |
Values | array | 否 | 路径条件列表。 | |
string | 否 | 转发路径。
| /test | |
QueryStringConfig | object | 否 | 查询字符串条件配置。最多支持添加20个查询字符串条件配置。 | |
Values | object [] | 否 | 查询字符串条件键值对列表。 | |
Key | string | 否 | 查询字符串键。 长度为1~100个字符,支持小写字母、可见字符、星号(*)和半角问号(?),不支持空格和 | test |
Value | string | 否 | 查询字符串值。 长度为1~128个字符,支持小写字母、可见字符、星号(*)和半角问号(?),不支持空格和 | test |
ResponseHeaderConfig | object | 否 | 返回HTTP标头。最多支持添加20个返回HTTP标头。 | |
Key | string | 否 | 头字段键。
| test |
Values | array | 否 | 头字段值。 | |
string | 否 | 头字段值。
| 5006 | |
ResponseStatusCodeConfig | object | 否 | 返回状态码条件配置。当Type为ResponseStatusCode时必选且有效。最多支持添加20个返回状态码条件配置。 | |
Values | array | 否 | 返回状态码条件。 | |
string | 否 | 返回给客户端响应中的状态码,取值范围:100~599。 | 301 | |
Type | string | 否 | 转发规则类型。最多支持添加7个转发规则类型。取值:
| ForwardGroup |
SourceIpConfig | object | 否 | 基于源IP业务流量匹配。最多支持添加20个基于源IP业务流量匹配。 | |
Values | array | 否 | 基于源IP业务流量匹配。 | |
string | 否 | 添加一个或多个IP地址或者IP地址段。 一条转发规则中最多支持添加5条源IP。 | 192.168.0.1/32 | |
RuleId | string | 是 | 转发规则ID。最多支持添加20个转发规则ID。 | rule-cxjh7vazn2jpnl**** |
DryRun | boolean | 否 | 是否只预检此次请求,取值:
| false |
返回参数
示例
正常返回示例
JSON
格式
{
"RequestId": "365F4154-92F6-4AE4-92F8-7FF34B540710",
"JobId": "72dcd26b-f12d-4c27-b3af-18f6aed5****"
}
错误码
HTTP status code | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | OperationDenied.IpGroupCanNotUsedForMirrorAction | The operation is not allowed because of %s. | 操作被拒绝,原因是%s。 |
400 | IncorrectStatus.Rule | The status of %s [%s] is incorrect. | 资源%s [%s]的状态无效。 |
400 | OperationDenied.SameGroupForForwardAndMirrorAction | The operation is not allowed because of %s. | 操作被拒绝,原因是%s。 |
400 | OperationDenied.GRPCServerGroup | The operation is not allowed because of %s. | 操作被拒绝,原因是%s。 |
400 | Conflict.Priority | There is already %s having the same configuration with %s. | %s冲突,已经存在同配置的%s。 |
400 | ResourceQuotaExceeded.ServerGroupAttachedNum | The quota of %s is exceeded for resource %s, usage %s/%s. | 配额%s已超额度限制,资源是%s,目前已使用%s,配额为%s。 |
400 | ResourceQuotaExceeded.LoadBalancerServersNum | The quota of %s is exceeded for resource %s, usage %s/%s. | 配额%s已超额度限制,资源是%s,目前已使用%s,配额为%s。 |
400 | ResourceQuotaExceeded.ServerAddedNum | The quota of %s is exceeded for resource %s, usage %s/%s. | 配额%s已超额度限制,资源是%s,目前已使用%s,配额为%s。 |
400 | QuotaExceeded.RuleWildcardsNum | The quota of %s is exceeded, usage %s/%s. | 配额%s已超额度限制,目前已使用%s,配额为%s。 |
400 | QuotaExceeded.RuleMatchEvaluationsNum | The quota of %s is exceeded, usage %s/%s. | 配额%s已超额度限制,目前已使用%s,配额为%s。 |
400 | QuotaExceeded.RuleActionsNum | The quota of %s is exceeded, usage %s/%s. | 配额%s已超额度限制,目前已使用%s,配额为%s。 |
400 | Mismatch.Protocol | The %s is mismatched for %s and %s. | %s在%s和%s中不匹配。 |
400 | Mismatch.VpcId | The %s is mismatched for %s and %s. | %s在%s和%s中不匹配。 |
400 | OperationDenied.ServiceManagedResource | The operation is not allowed because the current resource of %s is managed resource. | 操作被拒绝,原因是资源%s为托管资源。 |
400 | OperationDenied.ListenerIdInconsistent | The operation is not allowed because of ListenerIdInconsistent. | 操作被拒绝,原因是当前转发规则属于不同的监听。 |
404 | ResourceNotFound.Rule | The specified resource %s is not found. | 资源%s不存在。 |
404 | ResourceNotFound.ServerGroup | The specified resource %s is not found. | 资源%s不存在。 |
访问错误中心查看更多错误码。