blob: a647e333fef7101415592e8d14b95d10f44acec2 [file] [log] [blame]
Patrick Hieselfc9817f2018-11-12 15:08:35 +01001= Gerrit Code Review - Quota
2
3Gerrit does not provide out of the box quota enforcement. However, it does
4support an extension mechanism for plugins to hook into to provide this
5functionality. The most prominent plugin is the
6link:https://gerrit.googlesource.com/plugins/quota/[Quota Plugin].
7
8This documentation is intended to be read by plugin developers. It contains all
9quota requests implemented in Gerrit-core as well as the metadata that they have
10associated.
11
12== Quota Groups
13
14The following quota groups are defined in core Gerrit:
15
16=== REST API
Patrick Hieselc0a28ce2018-11-15 15:28:06 +010017[[rest-api]]
Patrick Hieselfc9817f2018-11-12 15:08:35 +010018
Patrick Hieselc0a28ce2018-11-15 15:28:06 +010019The REST API enforces quota after the resource was parsed (if applicable) and before the
20endpoint's logic is executed. This enables quota enforcer implementations to throttle calls
21to specific endpoints while knowing the general context (user and top-level entity such as
22change, project or account).
23
24If the quota enforcer wants to throttle HTTP requests, they should use
25link:quota.html#http-requests[HTTP Requests] instead.
26
27The quota groups used for checking follow the exact definition of the endoint in the REST
28API, but remove all IDs. The schema is:
29
30/restapi/<ENDPOINT>:<HTTP-METHOD>
31
32Examples:
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
42The user provided in the check's metadata is always the calling user (having the
43impersonation bit and real user set in case the user is impersonating another user).
Patrick Hieselfc9817f2018-11-12 15:08:35 +010044
45GERRIT
46------
47Part of link:index.html[Gerrit Code Review]
48
49SEARCHBOX
50---------