
This patch adds active status fields in the storage state table (cloudkitty_storage_states). A boolean column called "active", which indicates if the CloudKitty scope is active for billing, and another one called "scope_activation_toggle_date" (timestamp field) to store the latest timestamp when the scope moved between the active/deactivated states. Then, during CloudKitty processing, we check the "active" column. If the resource is not active, we ignore it during the processing. Moreover, we introduce an API to allow operators to set the "active" field. The "scope_activation_toggle_date" will not be exposed for operators to change it. It is updated automatically according to the changes in the "active" field. This patch adds a new HTTP method to "/v2/scope" endpoint. We then use "patch" HTTP method to allow operators to patch a storage scope. The API will require the scope_id, and then, it takes into account some of the fields we allow operators to change, and "active" field is one of them. Change-Id: Ia02c2eeb98021c60549cb8deab6f2e964e573f1e Implements: https://review.opendev.org/c/openstack/cloudkitty-specs/+/770928/
135 lines
2.3 KiB
HTML
135 lines
2.3 KiB
HTML
====================
|
|
Scope state endpoint
|
|
====================
|
|
|
|
Get the status of several scopes
|
|
================================
|
|
|
|
Returns the status of several scopes.
|
|
|
|
.. rest_method:: GET /v2/scope
|
|
|
|
.. rest_parameters:: scope/scope_parameters.yml
|
|
|
|
- collector: collector
|
|
- fetcher: fetcher
|
|
- limit: limit
|
|
- offset: offset
|
|
- scope_id: scope_id
|
|
- scope_key: scope_key
|
|
|
|
Status codes
|
|
------------
|
|
|
|
.. rest_status_code:: success http_status.yml
|
|
|
|
- 200
|
|
|
|
.. rest_status_code:: error http_status.yml
|
|
|
|
- 400
|
|
- 403
|
|
- 404
|
|
- 405
|
|
|
|
Response
|
|
--------
|
|
|
|
.. rest_parameters:: scope/scope_parameters.yml
|
|
|
|
- collector: collector_resp
|
|
- fetcher: fetcher_resp
|
|
- state: state
|
|
- last_processed_timestamp: last_processed_timestamp
|
|
- scope_id: scope_id_resp
|
|
- scope_key: scope_key_resp
|
|
- active: active_key_resp
|
|
|
|
Response Example
|
|
----------------
|
|
|
|
.. literalinclude:: ./api_samples/scope/scope_get.json
|
|
:language: javascript
|
|
|
|
|
|
Reset the status of several scopes
|
|
==================================
|
|
|
|
Reset the status of several scopes.
|
|
|
|
.. rest_method:: PUT /v2/scope
|
|
|
|
.. rest_parameters:: scope/scope_parameters.yml
|
|
|
|
- state: state
|
|
- last_processed_timestamp: last_processed_timestamp
|
|
- collector: collector_body
|
|
- fetcher: fetcher_body
|
|
- scope_id: scope_id_body
|
|
- scope_key: scope_key_body
|
|
- all_scopes: all_scopes
|
|
|
|
Status codes
|
|
------------
|
|
|
|
.. rest_status_code:: success http_status.yml
|
|
|
|
- 202
|
|
|
|
.. rest_status_code:: error http_status.yml
|
|
|
|
- 400
|
|
- 403
|
|
- 404
|
|
- 405
|
|
|
|
Patch a scope
|
|
================================
|
|
|
|
Patches/updates a scope.
|
|
|
|
.. rest_method:: PATCH /v2/scope
|
|
|
|
.. rest_parameters:: scope/scope_parameters.yml
|
|
|
|
- collector: collector
|
|
- fetcher: fetcher
|
|
- limit: limit
|
|
- offset: offset
|
|
- scope_id: scope_id
|
|
- scope_key: scope_key
|
|
- active: active_body
|
|
|
|
Status codes
|
|
------------
|
|
|
|
.. rest_status_code:: success http_status.yml
|
|
|
|
- 200
|
|
|
|
.. rest_status_code:: error http_status.yml
|
|
|
|
- 400
|
|
- 403
|
|
- 404
|
|
- 405
|
|
|
|
Response
|
|
--------
|
|
|
|
.. rest_parameters:: scope/scope_parameters.yml
|
|
|
|
- collector: collector_resp
|
|
- fetcher: fetcher_resp
|
|
- state: state
|
|
- scope_id: scope_id_resp
|
|
- scope_key: scope_key_resp
|
|
- active: active_key_resp
|
|
|
|
|
|
Response Example
|
|
----------------
|
|
|
|
.. literalinclude:: ./api_samples/scope/scope_get.json
|
|
:language: javascript
|