Add support for custom quota-exceeded messages
Extend the quota configuration with a new
`sizeLimitExceededUnknownRequestSizeMsg` and
`sizeLimitExceededKnownRequestSizeMsg` allowing administrators to define
custom error messages when a repository exceeds its size quota, for the
case when the size requested was unknown or known upfront, respectively.
The message supports the placeholders `${project}`, `${available}`,
`${maximum}` and `${requested}` (when available) which are expanded at
runtime using the new QuotaSizeMessageInterpolator.
MaxRepositorySizeQuota is updated to return an AvailableSizeResponse
instead of a raw Long so that both the available space and the
corresponding maximum limit can be propagated.
The most restrictive quota (the smallest available size) is selected,
and its custom message is used when constructing a client-facing
QuotaResponse objects.
A default message template is provided for quota sections that do not
define their own message:
When requested size quota is unknown:
"Project ${project} exceeds quota: max=${maximum} bytes,
available=${available} bytes."
When requested size quota is known (as it was before this change):
"Requested space [${requested}] is bigger then available [${available}]
for repository ${project}"
Bug: Issue 459520484
Depends-On: I0e9e58734d6ebf9d669c1e70cf51b16aaa5a3bf0
Change-Id: Iecb608b85d6c4547d219bf00b7186ca0c3c3eaec
8 files changed