Debian Codegraph @

api-ref/source/v2/task/reprocessing.inc

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