1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
======================
Task schedule endpoint
======================
CloudKitty has a task endpoint `/v2/task/<type_of_task>`, which allows
operators to schedule administrative tasks, such as reprocessing.
Currently, the only task available is the reprocessing one, which is avaiable
via the following endpoints.
- POST `/v2/task/reprocesses` -- to create a reprocessing task.
- GET `/v2/task/reprocesses/<path_scope_id>` -- to retrieve a reprocessing task.
- GET `/v2/task/reprocesses` -- to retrieve all reprocessing task.
Create a reprocessing task
==========================
The endpoint used to schedule a reprocessing task. The scheduled tasks are
loaded to execution once every processing cycle, as defined in the
CloudKitty `period` configuration.
.. rest_method:: POST `/v2/task/reprocesses`
.. rest_parameters:: task/reprocessing_parameters.yml
- scope_ids: scope_ids
- start_reprocess_time: start_reprocess_time
- end_reprocess_time: end_reprocess_time
- reason: reason
Status codes
------------
.. rest_status_code:: success http_status.yml
- 200
.. rest_status_code:: error http_status.yml
- 400
- 403
- 405
Response
--------
We will return an empty object as the response in case of success:
.. code-block:: javascript
{}
Example
-------
.. code-block:: shell
curl -s -X POST "https://<cloudkitty_server_and_port_here>/v2/task/reprocesses" -H "Accept: application/json" -H "User-Agent: python-keystoneclient" -H "X-Auth-Token: ${ACCESS_TOKEN_KEYSTONE}" -H "Content-Type: application/json" -d '{"reason": "Reprocessing test", "scope_ids": "<Some scope ID>", "start_reprocess_time": "2021-06-01 00:00:00+00:00", "end_reprocess_time": "2021-06-01 23:00:00+00:00"}'
The scope IDs can be retrieved via "/v2/scope" API, which is the API that one can use to list all scopes, and their status.
Retrieve a reprocessing task
============================
The endpoint used to retrieve a reprocessing task. By using this endpoint, one
can for instance check the progress of the reprocessing tasks.
.. rest_method:: GET `/v2/task/reprocesses/<path_scope_id>`
.. rest_parameters:: task/reprocessing_parameters.yml
- path_scope_id: path_scope_id
Status codes
------------
.. rest_status_code:: success http_status.yml
- 200
.. rest_status_code:: error http_status.yml
- 400
- 403
- 405
Response
--------
We will return the scope data in case of a valid scope ID:
.. code-block:: javascript
{"scope_id": "scope ID goes here",
"reason": "The reason for this reprocessing for this scope",
"start_reprocess_time": "2021-06-01 00:00:00+00:00",
"end_reprocess_time": "2021-07-01 00:00:00+00:00",
"current_reprocess_time": "2021-06-06 00:00:00+00:00"}
Example
-------
.. code-block:: shell
curl -s -X GET "https://<cloudkitty_server_and_port_here>/v2/task/reprocesses/<scope ID goes here>" -H "Accept: application/json" -H "User-Agent: python-keystoneclient" -H "X-Auth-Token: ${ACCESS_TOKEN_KEYSTONE}"
Retrieve all reprocessing tasks
===============================
The endpoint used to retrieve all reprocessing tasks. By using this endpoint,
one can retrieve all reprocessing tasks scheduled for a scope.
.. rest_method:: GET `/v2/task/reprocesses`
.. rest_parameters:: task/reprocessing_parameters.yml
- scope_ids: scope_ids_query
- order: scope_ids_order_query
Status codes
------------
.. rest_status_code:: success http_status.yml
- 200
.. rest_status_code:: error http_status.yml
- 400
- 403
- 405
Response
--------
We will return the scope data in case of a valid scope ID:
.. code-block:: javascript
[{"scope_id": "scope ID goes here",
"reason": "The reason for this reprocessing for this scope",
"start_reprocess_time": "2021-06-01 00:00:00+00:00",
"end_reprocess_time": "2021-07-01 00:00:00+00:00",
"current_reprocess_time": "2021-06-06 00:00:00+00:00"}]
Example
-------
.. code-block:: shell
curl -s -X GET "https://<cloudkitty_server_and_port_here>/v2/task/reprocesses" -H "Accept: application/json" -H "User-Agent: python-keystoneclient" -H "X-Auth-Token: ${ACCESS_TOKEN_KEYSTONE}"
|