summaryrefslogtreecommitdiff
path: root/api-ref
diff options
context:
space:
mode:
authorDan Smith <dansmith@redhat.com>2021-06-04 09:20:46 -0700
committerDan Smith <dansmith@redhat.com>2022-02-03 09:55:50 -0800
commitf865b8cac7fb008c870e433d22fb4216ed95e285 (patch)
treef88f7837b07c7dc5ce578d439603a976c73461f1 /api-ref
parentd7368446e484dc07b613ff5b225b1c3e47700389 (diff)
downloadglance-f865b8cac7fb008c870e433d22fb4216ed95e285.tar.gz
[APIImpact] Quota usage API
This adds a /v2/info/usage API endpoint which exposes to the user their current limits and usage. The discovery API does not (appear to) have existing tests, so this adds a module for that, although only usage tests are added currently. Implements: blueprint quota-api Change-Id: I50c98bac50f815bdb9baae024e77afd388f74554
Diffstat (limited to 'api-ref')
-rw-r--r--api-ref/source/v2/discovery.inc23
-rw-r--r--api-ref/source/v2/samples/usage-response.json20
2 files changed, 43 insertions, 0 deletions
diff --git a/api-ref/source/v2/discovery.inc b/api-ref/source/v2/discovery.inc
index dff7a7f40..134428024 100644
--- a/api-ref/source/v2/discovery.inc
+++ b/api-ref/source/v2/discovery.inc
@@ -103,3 +103,26 @@ Response Example
.. literalinclude:: samples/stores-list-response.json
:language: json
+
+Quota usage
+~~~~~~~~~~~
+
+.. rest_method:: GET /v2/info/usage
+
+The user's quota and current usage are displayed, if enabled by
+server-side configuration.
+
+Normal response codes: 200
+
+Request
+-------
+
+There are no request parameters.
+
+This call does not allow a request body.
+
+Response Example
+----------------
+
+.. literalinclude:: samples/usage-response.json
+ :language: json
diff --git a/api-ref/source/v2/samples/usage-response.json b/api-ref/source/v2/samples/usage-response.json
new file mode 100644
index 000000000..961d8153c
--- /dev/null
+++ b/api-ref/source/v2/samples/usage-response.json
@@ -0,0 +1,20 @@
+{
+ "usage": {
+ "image_size_total": {
+ "limit": 1024,
+ "usage": 256
+ },
+ "image_count_total": {
+ "limit": 10,
+ "usage": 2
+ },
+ "image_stage_total": {
+ "limit": 512,
+ "usage": 0
+ },
+ "image_count_uploading": {
+ "limit": 2,
+ "usage": 0
+ }
+ }
+}