UpdateGatewayQuotaRule
Updates a quota throttling rule on a gateway.
Operation description
Updates a quota rule on a gateway. Note that this operation takes effect only on AI gateways of a version later than 2.1.21. The update retains the historical usage of the consumers associated with the rule.
Recommended call logic:
-
Perform a dry run to check for rule conflicts.
-
Set dryRun=true.
-
The response returns a conflict preview that contains a conflictHash.
-
Formally submit the request after confirmation.
-
If no conflicts exist: Set dryRun=false and overwrite=false.
-
If conflicts exist and you confirm to overwrite: Set dryRun=false, overwrite=true, and conflictHash=
.
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 identifier 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'} |
| addIds |
array |
No |
The list of IDs of the subjects (consumers) to be bound. |
cs-001,cs-002 |
|
string |
No |
The ID of the subject. |
cs-001xxxxx |
|
| conflictHash |
string |
No |
The hash of the conflict snapshot, which is used to prevent concurrent dirty overwrites when you confirm an overwrite. You can obtain this value by first performing a dry run with dryRun=true and extracting it from the response. You do not need to specify this parameter in the following scenarios: no conflicts exist; you are only performing a dry run with dryRun=true; or overwrite=false, which means you do not confirm the overwrite. If dryRun=false and overwrite=true, but this parameter is not specified or has expired and does not match, the backend returns accepted=false along with a new conflict preview. In this case, you must perform a dry run again to confirm the new conflicts. |
f8f44dc6cf369a017d56b7197eb4fb5ac4bbb6b09a92b9b41999541f50xxxxxx |
consumerGroupIds
deprecated
|
array |
No |
[Deprecated] The list of consumer group IDs. |
group1,group2 |
deprecated
|
string |
No |
[Deprecated] The ID of the consumer group. |
consumer-group-001 |
| dryRun |
boolean |
No |
Specifies whether to perform a dry run only. A dry run does not persist data to the database or deliver actual configurations. It is used to check whether conflicting rules exist on the bound consumers. A single consumer cannot be configured with two natural period quotas of the same period. For example, if a consumer already has a natural daily quota, you cannot add another natural daily quota rule to it. |
true |
| overwrite |
boolean |
No |
Specifies whether to allow overwriting when conflicts exist. Note that if you allow overwriting, the conflicting subjects (consumers or consumer groups) are unbound from the old rule and bound to the new rule. |
|
| quotaLimit |
integer |
No |
The updated total available quota. |
1000 |
| removeIds |
array |
No |
The list of IDs of the subjects (consumers) to be unbound. |
cs003,cs-004 |
|
string |
No |
The ID of the subject. |
cs-003xxxxx |
|
| ruleName |
string |
No |
The updated name of the rule. |
team-rule |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| code |
string |
The status code or error code. |
200, 404, 500 |
| data |
object |
The response data. |
{'key': 'value'} |
| accepted |
boolean |
Indicates whether the semantics of the current write request can be accepted by the system. A value of false typically occurs in retryable scenarios, such as when an overwrite for a conflict is not confirmed. When dryRun=true, a value of true indicates only that the dry run is accepted, not that the data is saved. If a formal write request returns false, it indicates that the data is not saved due to conflicts, and you should check conflictPreview. |
true |
| conflictPreview |
object |
The conflict preview. |
|
| conflictHash |
string |
The hash of the conflict. |
f8f44dc6cf369a017d56b7197eb4fb5ac4bbb6b09a92b9b41999541f50xxxxxx |
| items |
array<object> |
The list of conflicting subjects (consumers or consumer groups). |
|
|
object |
The details of the conflicting subject (consumer or consumer group). |
||
conflictPeriodType
deprecated
|
string |
The period type of the existing conflicting rule on the consumer. This is a legacy field. Use periodType in the actual response. This field is not guaranteed to be returned. Valid values:
|
week |
| conflictType |
string |
The type of the existing conflicting rule on the consumer. Valid values:
|
calendar |
| consumerId |
string |
The ID of the consumer. You can use subjectId instead. |
cs-d82n1g6m1hkm375xxxxx |
| consumerName |
string |
The name of the consumer. You can use subjectName instead. |
consumer-a |
| periodType |
string |
The period type of the existing conflicting rule. Valid values:
|
day |
| subjectId |
string |
The ID of the conflicting subject. |
cs-xxx |
| subjectName |
string |
The name of the conflicting subject. |
consumer-a |
| subjectType |
string |
The type of the conflicting subject. Valid values:
|
consumer |
| totalConflictCount |
integer |
The total number of conflicts. |
2 |
| dryRun |
boolean |
Indicates whether a dry run is performed. |
true |
| ruleId |
string |
The ID of the rule. |
qr-xxxxxx |
| message |
string |
The message. |
Hello, world! |
| requestId |
string |
The unique identifier of the request. |
1234567890 |
Examples
Success response
JSON format
{
"code": "200, 404, 500",
"data": {
"accepted": true,
"conflictPreview": {
"conflictHash": "\t\nf8f44dc6cf369a017d56b7197eb4fb5ac4bbb6b09a92b9b41999541f50xxxxxx",
"items": [
{
"conflictPeriodType": "week",
"conflictType": "calendar",
"consumerId": "cs-d82n1g6m1hkm375xxxxx",
"consumerName": "consumer-a",
"periodType": "day",
"subjectId": "cs-xxx",
"subjectName": "consumer-a",
"subjectType": "consumer"
}
],
"totalConflictCount": 2
},
"dryRun": true,
"ruleId": "qr-xxxxxx"
},
"message": "Hello, world!",
"requestId": "1234567890"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.