[api-ref] update cache manage API info

Change-Id: If95fcb6beb17fd4ca337da58bc8fb03bbde25b03
Closes-bug: #1971176
This commit is contained in:
Brian Rosmaita 2022-05-02 12:20:59 -04:00
parent cb65cc8e44
commit 8271cde1e2
3 changed files with 62 additions and 4 deletions

View File

@ -0,0 +1,25 @@
cached_images:
description: |
A list of cached image JSON objects, possibly empty, where each
object contains the following fields:
``image_id``
The id of the cached image
``hits``
The number of cache hits for this image.
``last_accessed``
Epoch time when the cached image was most recently accessed.
``last_modified``
Epoch time when the cached image was installed into the cache.
``size``
Size in bytes of the cached image.
in: body
required: true
type: array
queued_images:
description: |
A list of image ids, possibly empty, of images queued to be
cached, listed in the order in which they will be processed.
in: body
required: true
type: array

View File

@ -9,7 +9,7 @@ List and manage the cache.
Query cache status
~~~~~~~~~~~~~~~~~~
.. rest_method:: GET /v2/cache/
.. rest_method:: GET /v2/cache
Lists all images in cache or queue.
*(Since Image API v2.14)*
@ -24,11 +24,25 @@ Request
No request parameters.
Response Parameters
-------------------
.. rest_parameters:: cache-manage-parameters.yaml
- cached_images: cached_images
- queued_images: queued_images
Response Example
----------------
.. literalinclude:: samples/cache-list-response.json
:language: json
Queue image
~~~~~~~~~~~
.. rest_method:: PUT /v2/cache/{image_id}/
.. rest_method:: PUT /v2/cache/{image_id}
Queues image for caching.
*(Since Image API v2.14)*
@ -41,13 +55,15 @@ Error response codes: 400, 401, 403, 404
Request
-------
.. rest_parameters:: images-parameters.yaml
- image_id: image_id-in-path
Delete image from cache
~~~~~~~~~~~~~~~~~~~~~~~
.. rest_method:: DELETE /v2/cache/{image_id}/
.. rest_method:: DELETE /v2/cache/{image_id}
Deletes a image from cache.
*(Since Image API v2.14)*
@ -60,13 +76,15 @@ Error response codes: 400, 401, 403, 404
Request
-------
.. rest_parameters:: images-parameters.yaml
- image_id: image_id-in-path
Clear images from cache
~~~~~~~~~~~~~~~~~~~~~~~
.. rest_method:: DELETE /v2/cache/
.. rest_method:: DELETE /v2/cache
Clears the cache and its queue.
*(Since Image API v2.14)*

View File

@ -0,0 +1,15 @@
{
"cached_images": [
{
"image_id": "fe05d6c9-ef02-4161-9056-81ed046f3024",
"hits": 0,
"last_accessed": 1651504844.0860524,
"last_modified": 1651504844.0860524,
"size": 987654
}
],
"queued_images": [
"e34e6e2f-fe16-420d-ad36-cebf69506106",
"6b9fbf2b-3031-429a-80b1-b509e4c44046"
]
}