Modifies the attributes of forwarding rules.
Operation description
UpdateRulesAttribute is an asynchronous operation. After a request is sent, the system returns a request ID and runs the task in the background. You can call the ListRules operation to query the status of the task.
-
If a forwarding rule is in the Configuring state, the forwarding rule is being updated.
-
If a forwarding rule is in the Available state, the forwarding rule is updated.
-
You can set RuleConditions and RuleActions to add conditions and actions to a forwarding rule. Take note of the following limits on the maximum number of conditions and the maximum number of actions in each forwarding rule:
- Limits on conditions: 5 for a basic Application Load Balancer (ALB) instance, 10 for a standard ALB instance, and 10 for a WAF-enabled ALB instance.
- Limits on actions: 3 for a basic ALB instance, 5 for a standard ALB instance, and 5 for a WAF-enabled ALB instance.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
alb:UpdateRulesAttribute | update |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ClientToken | string | No | The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The client token can contain only ASCII characters. Note
If you do not specify this parameter, the system automatically uses the request ID as the client token. The request ID may be different for each request.
| 123e4567-e89b-12d3-a456-426655440000 |
Rules | array<object> | Yes | The forwarding rules. You can specify at most 10 forwarding rules in each call. | |
object | Yes | The forwarding rule. | ||
Priority | integer | No | The priority of the forwarding rule. Valid values: 1 to 10000. A smaller value specifies a higher priority. You can specify at most 20 rule priorities. Note
The priority of each forwarding rule within a listener must be unique.
| 10 |
RuleName | string | No | The name of the forwarding rule. The name must be 2 to 128 letters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter. You can specify at most 20 rule names. | rule-instance-test |
RuleActions | array<object> | No | The action of the forwarding rule. | |
object | Yes | The action of the forwarding rule. | ||
FixedResponseConfig | object | No | The configuration of the action to return a custom response. You can specify at most 20 custom responses. | |
Content | string | No | The content of the response. The content can be up to 1 KB in size, and can contain only ASCII characters. | dssacav |
ContentType | string | No | The content format of the response. Valid values: text/plain, text/css, text/html, application/javascript, and application/json. | text/plain |
HttpCode | string | No | The HTTP status code in responses. Valid values: 2xx, 4xx, 5xx. The value must be a numeric string. x must be a digit. | 200 |
ForwardGroupConfig | object | No | The configuration of the action to forward requests to server groups. You can specify at most 20 actions. | |
ServerGroupTuples | array<object> | No | The server groups to which requests are forwarded. | |
object | No | The server group to which requests are forwarded. | ||
ServerGroupId | string | No | The server group to which requests are forwarded. | sg-atstuj3rtoptyui**** |
Weight | integer | No | The weight of the server group. A larger value specifies a higher weight. A server group with a higher weight receives more requests. Valid values: 0 to 100.
| 30 |
ServerGroupStickySession | object | No | The configuration of session persistence for server groups. | |
Enabled | boolean | No | Specifies whether to enable session persistence. Valid values:
| false |
Timeout | integer | No | The timeout period of sessions. Unit: seconds Valid values: 1 to 86400. | 2 |
InsertHeaderConfig | object | No | The configuration of the action to insert a header. You can specify at most 20 actions. | |
CoverEnabled | boolean | No | Specifies whether to overwrite the header in the request. Valid values:
| false |
Key | string | No | The key of the header. The header key must be 1 to 40 characters in length, and can contain lowercase letters, digits, underscores (_), and hyphens (-). The key specified in Note
The following header keys are not supported: 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 , and authority . Header keys are not case-sensitive.
| test |
Value | string | No | The value of the header.
| UserDefined |
ValueType | string | No | The type of header. Valid values:
| UserDefined |
Order | integer | Yes | The priority of the action. Valid values: 1 to 50000. A lower value indicates a higher priority. The actions of a forwarding rule are applied in descending order of priority. This parameter cannot be left empty. The priority of each action within a forwarding rule must be unique. You can specify at most 20 forwarding rule priorities. | 1 |
RedirectConfig | object | No | The configuration of the redirect action. You can specify at most 20 redirect actions. | |
Host | string | No | The hostname to which requests are redirected. The hostname must meet the following requirements:
| www.example.com |
HttpCode | string | No | The HTTP status code that indicates the redirect type. Valid values: 301, 302, 303, 307, and 308. | 301 |
Path | string | No | The path of the destination to which requests are forwarded. Valid values:
| /test |
Port | string | No | The port to which requests are forwarded. Valid values: 1 to 63335. | 10 |
Protocol | string | No | The protocol of the destination to which requests are forwarded. Valid values: Valid values for HTTP listeners: HTTP and HTTPS. Valid values for HTTPS listeners: HTTPS. | HTTP |
Query | string | No | The query string to which requests are redirected. The query string must be 1 to 128 characters in length, and can contain printable characters, excluding uppercase letters and the following special characters: | quert |
RewriteConfig | object | No | The configuration of the rewrite action. You can specify at most 20 actions. | |
Host | string | No | The hostname of the destination to which requests are forwarded. The hostname must meet the following requirements:
| www.example.com |
Path | string | No | The path to which requests are forwarded.
| /tsdf |
Query | string | No | The query string of the URL to which requests are forwarded. The query string must be 1 to 128 characters in length, and can contain printable characters, excluding uppercase letters and the following special characters: | quedsa |
Type | string | Yes | The type of action. You can specify at most 11 types of action. Valid values:
The preceding actions can be classified into two types:
| Host |
TrafficLimitConfig | object | No | The configuration of traffic throttling. You can specify at most 20 throttling actions. | |
QPS | integer | No | The number of queries per second (QPS). Valid values: 1 to 1000000. | 2 |
PerIpQps | integer | No | The number of requests per IP address. Valid values: 1 to 1000000. Note
If both the QPS and PerIpQps properties are specified, make sure that the value of the QPS property is smaller than the value of the PerIpQps property.
| 80 |
TrafficMirrorConfig | object | No | The configuration of traffic mirroring. You can specify at most 20 traffic mirroring configurations. | |
TargetType | string | No | The type of target to which network traffic is mirrored. Valid values:
| ForwardGroupMirror |
MirrorGroupConfig | object | No | The configuration of the server group to which traffic is mirrored. | |
ServerGroupTuples | array<object> | No | The server group to which traffic is mirrored. | |
object | No | The server group to which traffic is mirrored. | ||
ServerGroupId | string | No | The server group ID. | srg-00mkgijak0w4qgz9**** |
RemoveHeaderConfig | object | No | The configuration of the HTTP header to be removed. You can remove at most 20 HTTP headers. | |
Key | string | No | The key of the response header.
| Port |
CorsConfig | object | No | The CORS configuration. | |
AllowOrigin | array | No | The trusted origins. You can specify one or more values, or only an asterisk (
| |
string | No | The trusted origin of CORS requests. | http://example.com | |
AllowMethods | array | No | The trusted HTTP methods of CORS requests. | |
string | No | The trusted HTTP method of CORS requests. Valid values:
| GET | |
AllowHeaders | array | No | The trusted headers of CORS requests. | |
string | No | The trusted request header for a cross-origin request. One or more values are supported. Asterisks ( | test_123 | |
ExposeHeaders | array | No | The headers that can be exposed. | |
string | No | The header that can be exposed. One or more values are supported. Asterisks ( | test_123 | |
AllowCredentials | string | No | Specifies whether to allow credentials to be carried in CORS requests. Valid values:
| on |
MaxAge | long | No | The maximum cache time of dry runs in the browser. Unit: seconds. Valid values: -1 to 172800. | 1000 |
RuleConditions | array<object> | No | The match conditions of the forwarding rule. | |
object | Yes | The match conditions of the forwarding rule. | ||
CookieConfig | object | No | The configuration of the cookie. You can specify at most 20 conditions. | |
Values | array<object> | No | The key-value pairs of cookies. | |
object | No | The key-value pairs of cookies. | ||
Key | string | No | The cookie key, which must be 1 to 100 characters in length, and can contain lowercase letters, asterisks (*), question marks (?), and printable characters. It cannot contain space characters or the following special characters: | test |
Value | string | No | The cookie value, which must be 1 to 128 characters in length, and can contain lowercase letters, asterisks (*), question marks (?), and printable characters. It cannot contain space characters or the following special characters: | test |
HeaderConfig | object | No | The configuration of the HTTP header. You can specify at most 20 HTTP headers. | |
Key | string | No | The key of the header. The key must be 1 to 40 characters in length. The header key can contain lowercase letters, digits, hyphens (-), and underscores (_). Cookie and Host are not supported. | Port |
Values | array | No | The HTTP header values. | |
string | No | The value of the response header. The header value must be 1 to 128 characters in length. The header value can contain printable characters whose ASCII values are | 5006 | |
HostConfig | object | No | The match conditions for hostnames. You can specify at most 20 conditions. | |
Values | array | No | The hostnames. | |
string | No | The hostname. The hostname must meet the following requirements:
| www.example.com | |
MethodConfig | object | No | The configuration of the HTTP request method. You can configure at most 20 HTTP request methods. | |
Values | array | No | The HTTP request methods. | |
string | No | The request method. Valid values: HEAD, GET, POST, OPTIONS, PUT, PATCH, and DELETE. | PUT | |
PathConfig | object | No | The match conditions for query strings. You can specify at most 20 conditions. | |
Values | array | No | The paths to which requests are forwarded. | |
string | No | The path to which requests are forwarded.
| /test | |
QueryStringConfig | object | No | The match conditions for query strings. You can specify at most 20 conditions. | |
Values | array<object> | No | The key-value pairs of query strings. | |
object | No | The key-value pairs of query strings. | ||
Key | string | No | The key of the query string. The key must be 1 to 100 characters in length, and can contain lowercase letters, printable ASCII characters, asterisks (*), and question marks (?). It cannot contain space characters or the following special characters: | test |
Value | string | No | The value of the query string. The value must be 1 to 128 characters in length, and can contain lowercase letters, printable ASCII characters, asterisks (*), and question marks (?). It cannot contain space characters or the following special characters: | test |
ResponseHeaderConfig | object | No | The HTTP response headers. You can specify at most 20 HTTP response headers. | |
Key | string | No | The key of the response header.
| test |
Values | array | No | The value of the response header. | |
string | No | The value of the response header.
| 5006 | |
ResponseStatusCodeConfig | object | No | The match conditions for response status codes. This parameter is required and valid when Type is set to ResponseStatusCode. You can specify at most 20 conditions. | |
Values | array | No | The match conditions. | |
string | No | The status code in responses. Valid values: 100 to 599. | 301 | |
Type | string | No | The condition type of the forwarding rule is invalid. You can specify at most seven condition types for inbound forwarding rules. Valid values:
You can specify at most two condition types for outbound forwarding rules. Valid values:
| ForwardGroup |
SourceIpConfig | object | No | Traffic matching based on source IP addresses. You can specify at most 20 match conditions based on IP addresses. | |
Values | array | No | Traffic matching based on source IP addresses. | |
string | No | You can specify one or more IP addresses, including CIDR blocks. Each forwarding rule supports at most five source IP addresses, including CIDR blocks. | 192.168.0.1/32 | |
RuleId | string | Yes | The IDs of the forwarding rules. You can specify at most 20 rule IDs. | rule-cxjh7vazn2jpnl**** |
DryRun | boolean | No | Specifies whether to perform only a dry run, without performing the actual request. Valid values:
| false |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "365F4154-92F6-4AE4-92F8-7FF34B540710",
"JobId": "72dcd26b-f12d-4c27-b3af-18f6aed5****"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | OperationDenied.IpGroupCanNotUsedForMirrorAction | The operation is not allowed because of %s. | The operation is not allowed because of %s. |
400 | IncorrectStatus.Rule | The status of %s [%s] is incorrect. | The status of %s [%s] is incorrect. |
400 | OperationDenied.SameGroupForForwardAndMirrorAction | The operation is not allowed because of %s. | The operation is not allowed because of %s. |
400 | OperationDenied.GRPCServerGroup | The operation is not allowed because of %s. | The operation is not allowed because of %s. |
400 | Conflict.Priority | There is already %s having the same configuration with %s. | There is already %s having the same configuration with %s. |
400 | ResourceQuotaExceeded.ServerGroupAttachedNum | The quota of %s is exceeded for resource %s, usage %s/%s. | The quota of %s is exceeded for resource %s, usage %s/%s. |
400 | ResourceQuotaExceeded.LoadBalancerServersNum | The quota of %s is exceeded for resource %s, usage %s/%s. | The quota of %s is exceeded for resource %s. Usage: %s/%s. |
400 | ResourceQuotaExceeded.ServerAddedNum | The quota of %s is exceeded for resource %s, usage %s/%s. | The quota of %s is exceeded for resource %s. Usage: %s/%s. |
400 | QuotaExceeded.RuleWildcardsNum | The quota of %s is exceeded, usage %s/%s. | The quota of %s is exceeded, usage %s/%s. |
400 | QuotaExceeded.RuleMatchEvaluationsNum | The quota of %s is exceeded, usage %s/%s. | The quota of %s is exceeded. Usage: %s/%s. |
400 | QuotaExceeded.RuleActionsNum | The quota of %s is exceeded, usage %s/%s. | The quota of %s is exceeded. Usage: %s/%s. |
400 | Mismatch.Protocol | The %s is mismatched for %s and %s. | The %s is mismatched for %s and %s. |
400 | Mismatch.VpcId | The %s is mismatched for %s and %s. | The %s is mismatched for %s and %s. |
400 | OperationDenied.ServiceManagedResource | The operation is not allowed because the current resource of %s is managed resource. | - |
400 | OperationDenied.ListenerIdInconsistent | The operation is not allowed because of ListenerIdInconsistent. | - |
400 | IllegalParam.Priority | The param of Priority is illegal. | - |
400 | OperationDenied.MirrorActionSupportHttpGroupOnly | The operation is not allowed because of MirrorActionSupportHttpGroupOnly. | - |
400 | OperationDenied.ProtocolMustSameForForwardGroupAction | The operation is not allowed because of ProtocolMustSameForForwardGroupAction. | - |
404 | ResourceNotFound.Rule | The specified resource %s is not found. | The specified resource %s is not found. |
404 | ResourceNotFound.ServerGroup | The specified resource %s is not found. | The specified resource %s is not found. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-01-18 | The Error code has changed | View Change Details |