UpdateGatewayQuotaRule
Edits a quota throttling rule on a gateway.
Operation description
Edits a quota rule on a gateway. This operation applies only to AI gateways later than version 2.1.19. Editing preserves the historical usage of consumers on the rule.
Recommended call logic:
-
Step 1: Perform a dry run to check for rule conflicts.
-
-
Set dryRun to true.
-
-
-
The response contains a conflict preview with conflictHash.
-
-
Step 2: Submit the request after confirmation.
-
-
No conflicts: Set dryRun to false and overwrite to false.
-
-
-
Conflicts exist and you confirm the overwrite: Set dryRun to false, overwrite to true, and conflictHash to the value returned in the previous step.
-
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
apig:UpdateGatewayQuotaRule |
update |
*Gateway
|
None | None |
Request syntax
PUT /v1/gateways/{gatewayId}/quota-rules/{ruleId} HTTP/1.1
Path Parameters
|
Parameter |
Type |
Required |
Description |
Example |
| gatewayId |
string |
No |
The unique ID of the gateway. |
gw-123456 |
| ruleId |
string |
No |
The ID of the rule. |
qr-d8j7fpmm1hks65xxxx |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| body |
object |
No |
The request body. |
{'key': 'value'} |
| ruleName |
string |
No |
The updated rule name. |
team-rule |
| quotaLimit |
integer |
No |
The updated total available quota. |
1000 |
| addIds |
array |
No |
The list of principal (consumer) IDs to bind. |
cs-001,cs-002 |
|
string |
No |
The principal ID. |
cs-001xxxxx |
|
| removeIds |
array |
No |
The list of principal (consumer) IDs to unbind. |
cs003,cs-004 |
|
string |
No |
The principal ID. |
cs-003xxxxx |
|
| dryRun |
boolean |
No |
Whether to perform a dry run without persisting or applying the configuration. A dry run checks whether conflicting rules exist on the bound consumers. For example, a consumer that already has a calendar-day quota cannot have another calendar-day quota rule added. |
true |
| overwrite |
boolean |
No |
Whether to allow overwriting when a conflict exists. If enabled, the conflicting consumers are unbound from the old rule and bound to the new rule. |
|
| conflictHash |
string |
No |
The conflict snapshot hash that prevents concurrent dirty overwrites. Obtain this value from the response of a prior dryRun=true call. Not required if no conflicts exist, the call is a dry run (dryRun=true), or overwrite is set to false. When dryRun is set to false and overwrite is set to true, if this parameter is missing or the value has expired and no longer matches, the backend returns accepted=false with a new conflict preview. Perform the dry run again to confirm the new conflicts. |
f8f44dc6cf369a017d56b7197eb4fb5ac4bbb6b09a92b9b41999541f50xxxxxx |
consumerGroupIds
deprecated
|
array |
No |
The list of consumer group IDs. This parameter is not supported. |
group1,group2 |
|
string |
No |
The consumer group ID. |
consumer-group-001 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response structure. |
||
| requestId |
string |
The unique ID of the request. |
1234567890 |
| code |
string |
The status code or error code. |
200, 404, 500 |
| message |
string |
The message content. |
你好,世界! |
| data |
object |
The response data. |
{'key': 'value'} |
| ruleId |
string |
The ID of the rule. |
qr-xxxxxx |
| dryRun |
boolean |
Whether this is a dry run. |
true |
| accepted |
boolean |
Whether the write request is accepted. A value of false typically indicates a retryable scenario, such as an unconfirmed conflict overwrite. |
true |
| conflictPreview |
object |
The conflict preview. |
|
| totalConflictCount |
integer |
The total number of conflicts. |
2 |
| conflictHash |
string |
The conflict hash. |
f8f44dc6cf369a017d56b7197eb4fb5ac4bbb6b09a92b9b41999541f50xxxxxx |
| items |
array<object> |
The list of conflicting subjects (consumers). |
|
|
object |
The details of a conflicting subject (consumer). |
||
| consumerId |
string |
The consumer ID. |
cs-d82n1g6m1hkm375xxxxx |
| consumerName |
string |
The consumer name. |
consumer-a |
| conflictType |
string |
The type of the conflicting rule on the consumer. Valid values: calendar (calendar period) and epoch (custom period). |
calendar |
| conflictPeriodType |
string |
The period type of the conflicting rule on the consumer. Valid values: day, week, and month. |
week |
Examples
Success response
JSON format
{
"requestId": "1234567890",
"code": "200, 404, 500",
"message": "你好,世界!",
"data": {
"ruleId": "qr-xxxxxx",
"dryRun": true,
"accepted": true,
"conflictPreview": {
"totalConflictCount": 2,
"conflictHash": "\t\nf8f44dc6cf369a017d56b7197eb4fb5ac4bbb6b09a92b9b41999541f50xxxxxx",
"items": [
{
"consumerId": "cs-d82n1g6m1hkm375xxxxx",
"consumerName": "consumer-a",
"conflictType": "calendar",
"conflictPeriodType": "week"
}
]
}
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.