Patrick Hiesel | fc9817f | 2018-11-12 15:08:35 +0100 | [diff] [blame] | 1 | = Gerrit Code Review - Quota |
| 2 | |
| 3 | Gerrit does not provide out of the box quota enforcement. However, it does |
| 4 | support an extension mechanism for plugins to hook into to provide this |
| 5 | functionality. The most prominent plugin is the |
| 6 | link:https://gerrit.googlesource.com/plugins/quota/[Quota Plugin]. |
| 7 | |
| 8 | This documentation is intended to be read by plugin developers. It contains all |
| 9 | quota requests implemented in Gerrit-core as well as the metadata that they have |
| 10 | associated. |
| 11 | |
| 12 | == Quota Groups |
| 13 | |
| 14 | The following quota groups are defined in core Gerrit: |
| 15 | |
| 16 | === REST API |
Patrick Hiesel | c0a28ce | 2018-11-15 15:28:06 +0100 | [diff] [blame] | 17 | [[rest-api]] |
Patrick Hiesel | fc9817f | 2018-11-12 15:08:35 +0100 | [diff] [blame] | 18 | |
Patrick Hiesel | c0a28ce | 2018-11-15 15:28:06 +0100 | [diff] [blame] | 19 | The REST API enforces quota after the resource was parsed (if applicable) and before the |
| 20 | endpoint's logic is executed. This enables quota enforcer implementations to throttle calls |
| 21 | to specific endpoints while knowing the general context (user and top-level entity such as |
| 22 | change, project or account). |
| 23 | |
| 24 | If the quota enforcer wants to throttle HTTP requests, they should use |
| 25 | link:quota.html#http-requests[HTTP Requests] instead. |
| 26 | |
| 27 | The quota groups used for checking follow the exact definition of the endoint in the REST |
| 28 | API, but remove all IDs. The schema is: |
| 29 | |
| 30 | /restapi/<ENDPOINT>:<HTTP-METHOD> |
| 31 | |
| 32 | Examples: |
| 33 | |
| 34 | [options="header",cols="1,6"] |
| 35 | |======================= |
| 36 | |HTTP call |Quota Group |Metadata |
| 37 | |GET /a/changes/1/revisions/current/detail |/changes/revisions/detail:GET |CurrentUser, Change.Id, Project.NameKey |
| 38 | |POST /a/changes/ |/changes/:POST |CurrentUser |
| 39 | |GET /a/accounts/self/detail |/accounts/detail:GET |CurrentUser, Account.Id |
| 40 | |======================= |
| 41 | |
| 42 | The user provided in the check's metadata is always the calling user (having the |
| 43 | impersonation bit and real user set in case the user is impersonating another user). |
Patrick Hiesel | fc9817f | 2018-11-12 15:08:35 +0100 | [diff] [blame] | 44 | |
| 45 | GERRIT |
| 46 | ------ |
| 47 | Part of link:index.html[Gerrit Code Review] |
| 48 | |
| 49 | SEARCHBOX |
| 50 | --------- |