placement/api-ref/source/usages.inc
Chris Dent 3772132579 Microversion 1.38: API support for consumer types
Update allocations, reshaper and usage APIs to accept and present
consumer_type in microversion 1.38.

ensure_consumer in placement/handlers/util.py is updated to be consumer
type aware.

allocation, usage and reshaper schema and handlers are updated

gabbits/consumer-types-1.38.yaml adds tests across the various URIs

A TODO is left in placement/handlers/allocation.py where the database
is being accessed in a way that is not ideal. This will be cleared
up in a followup patch (to add use of an AttributeCache).

Co-Authored-By: Surya Seetharaman <suryaseetharaman.9@gmail.com>
Co-Authored-By: melanie witt <melwittt@gmail.com>

Story: 2005473
Task: 36421

Change-Id: I24c2315093e07dbf25c4fb53152e6a4de7477a51
2021-08-05 23:23:47 +00:00

60 lines
1.4 KiB
PHP

======
Usages
======
Represent the consumption of resources for a project and user.
.. note:: Usages API requests are available starting from version 1.9.
List usages
===========
Return a report of usage information for resources associated with the
project identified by `project_id` and user identified by
`user_id`. The value is a dictionary of resource classes paired with
the sum of the allocations of that resource class for provided
parameters.
.. rest_method:: GET /usages
Normal Response Codes: 200
Error response codes: badRequest(400)
Request
-------
.. rest_parameters:: parameters.yaml
- project_id: project_id
- user_id: user_id
- consumer_type: consumer_type_req
Response (microversions 1.38 - )
--------------------------------
.. rest_parameters:: parameters.yaml
- usages.consumer_type: consumer_type
- usages.consumer_type.consumer_count: consumer_count
- usages.consumer_type.RESOURCE_CLASS: resources_single
Response Example (microversions 1.38 - )
----------------------------------------
.. literalinclude:: ./samples/usages/get-usages-1.38.json
:language: javascript
Response (microversions 1.9 - 1.36)
-----------------------------------
.. rest_parameters:: parameters.yaml
- usages: resources
Response Example (microversions 1.9 - 1.36)
-------------------------------------------
.. literalinclude:: ./samples/usages/get-usages.json
:language: javascript