root / docs / quota-api-guide.rst @ 3a1bed03
History | View | Annotate | Download (9 kB)
1 |
Resources |
---|---|
2 |
--------- |
3 |
|
4 |
Get Resource List |
5 |
................. |
6 |
|
7 |
**GET** /astakos/api/resources |
8 |
|
9 |
**Normal Response Code**: 200 |
10 |
|
11 |
**Error Response Codes**: |
12 |
|
13 |
====== ===================== |
14 |
Status Description |
15 |
====== ===================== |
16 |
500 Internal Server Error |
17 |
====== ===================== |
18 |
|
19 |
**Example Successful Response**: |
20 |
|
21 |
.. code-block:: javascript |
22 |
|
23 |
{ |
24 |
"cyclades.vm": { |
25 |
"unit": null, |
26 |
"description": "Number of virtual machines", |
27 |
"service": "cyclades" |
28 |
}, |
29 |
"cyclades.ram": { |
30 |
"unit": "bytes", |
31 |
"description": "Virtual machine memory", |
32 |
"service": "cyclades" |
33 |
} |
34 |
} |
35 |
|
36 |
Quotas |
37 |
------ |
38 |
|
39 |
Get Quotas |
40 |
.......... |
41 |
|
42 |
**GET** /astakos/api/quotas |
43 |
|
44 |
==================== ========================= |
45 |
Request Header Name Value |
46 |
==================== ========================= |
47 |
X-Auth-Token User authentication token |
48 |
==================== ========================= |
49 |
|
50 |
**Normal Response Code**: 200 |
51 |
|
52 |
**Error Response Codes**: |
53 |
|
54 |
====== ============================ |
55 |
Status Description |
56 |
====== ============================ |
57 |
401 Unauthorized (Missing token) |
58 |
500 Internal Server Error |
59 |
====== ============================ |
60 |
|
61 |
**Example Successful Response**: |
62 |
|
63 |
.. code-block:: javascript |
64 |
|
65 |
{ |
66 |
"system": { |
67 |
"cyclades.ram": { |
68 |
"usage": 536870912, |
69 |
"limit": 1073741824, |
70 |
"pending": 0 |
71 |
|
72 |
}, |
73 |
"cyclades.vm": { |
74 |
"usage": 2, |
75 |
"limit": 2, |
76 |
"pending": 0 |
77 |
} |
78 |
}, |
79 |
"project:1": { |
80 |
"cyclades.ram": { |
81 |
"usage": 2147483648, |
82 |
"limit": 2147483648, |
83 |
"pending": 0 |
84 |
}, |
85 |
"cyclades.vm": { |
86 |
"usage": 2, |
87 |
"limit": 5, |
88 |
"pending": 1 |
89 |
} |
90 |
} |
91 |
} |
92 |
|
93 |
Get Quotas per Service |
94 |
...................... |
95 |
|
96 |
**GET** /astakos/api/service_quotas |
97 |
|
98 |
==================== ============================ |
99 |
Request Header Name Value |
100 |
==================== ============================ |
101 |
X-Auth-Token Service authentication token |
102 |
==================== ============================ |
103 |
|
104 |
Optional GET parameter: ?user=<uuid> |
105 |
|
106 |
**Normal Response Code**: 200 |
107 |
|
108 |
**Error Response Codes**: |
109 |
|
110 |
====== ============================ |
111 |
Status Description |
112 |
====== ============================ |
113 |
401 Unauthorized (Missing token) |
114 |
500 Internal Server Error |
115 |
====== ============================ |
116 |
|
117 |
**Example Successful Response**: |
118 |
|
119 |
.. code-block:: javascript |
120 |
|
121 |
{ |
122 |
"1a6165d0-5020-4b6d-a4ad-83476632a584": { |
123 |
"system": { |
124 |
"cyclades.ram": { |
125 |
"usage": 536870912, |
126 |
"limit": 1073741824, |
127 |
"pending": 0 |
128 |
}, |
129 |
"cyclades.vm": { |
130 |
"usage": 2, |
131 |
"limit": 2, |
132 |
"pending": 0 |
133 |
} |
134 |
}, |
135 |
"project:1": { |
136 |
"cyclades.ram": { |
137 |
"usage": 2147483648, |
138 |
"limit": 2147483648, |
139 |
"pending": 0 |
140 |
}, |
141 |
"cyclades.vm": { |
142 |
"usage": 2, |
143 |
"limit": 5, |
144 |
"pending": 1 |
145 |
} |
146 |
} |
147 |
} |
148 |
} |
149 |
|
150 |
Commissions |
151 |
----------- |
152 |
|
153 |
Issue Commission |
154 |
................ |
155 |
|
156 |
**POST** /astakos/api/commissions |
157 |
|
158 |
==================== ============================ |
159 |
Request Header Name Value |
160 |
==================== ============================ |
161 |
X-Auth-Token Service authentication token |
162 |
==================== ============================ |
163 |
|
164 |
**Normal Response Code**: 201 |
165 |
|
166 |
**Error Response Codes**: |
167 |
|
168 |
====== ======================================================= |
169 |
Status Description |
170 |
====== ======================================================= |
171 |
400 Commission failed due to invalid input data |
172 |
401 Unauthorized (Missing token) |
173 |
404 Cannot find one of the target holdings |
174 |
413 A quantity fell below zero in one of the holdings |
175 |
413 A quantity exceeded the capacity in one of the holdings |
176 |
500 Internal Server Error |
177 |
====== ======================================================= |
178 |
|
179 |
**Example Request**: |
180 |
|
181 |
.. code-block:: javascript |
182 |
|
183 |
{ |
184 |
"force": false, |
185 |
"auto_accept": false, |
186 |
"name": "an optional description", |
187 |
"provisions": [ |
188 |
{ |
189 |
"holder": "c02f315b-7d84-45bc-a383-552a3f97d2ad", |
190 |
"source": "system", |
191 |
"resource": "cyclades.vm", |
192 |
"quantity": 1 |
193 |
}, |
194 |
{ |
195 |
"holder": "c02f315b-7d84-45bc-a383-552a3f97d2ad", |
196 |
"source": "system", |
197 |
"resource": "cyclades.ram", |
198 |
"quantity": 536870912 |
199 |
} |
200 |
] |
201 |
} |
202 |
|
203 |
**Example Successful Response**: |
204 |
|
205 |
.. code-block:: javascript |
206 |
|
207 |
{ |
208 |
"serial": 57 |
209 |
} |
210 |
|
211 |
**Example Failure Response**: |
212 |
|
213 |
.. code-block:: javascript |
214 |
|
215 |
{ |
216 |
"overLimit": { |
217 |
"message": "a human-readable error message", |
218 |
"code": 413, |
219 |
"data": { |
220 |
"provision": { |
221 |
"holder": "c02f315b-7d84-45bc-a383-552a3f97d2ad", |
222 |
"source": "system", |
223 |
"resource": "cyclades.vm", |
224 |
"quantity": 1 |
225 |
}, |
226 |
"name": "NoCapacityError", |
227 |
"limit": 2, |
228 |
"usage": 2 |
229 |
} |
230 |
} |
231 |
} |
232 |
|
233 |
Get Pending Commissions |
234 |
....................... |
235 |
|
236 |
**GET** /astakos/api/commissions |
237 |
|
238 |
==================== ============================ |
239 |
Request Header Name Value |
240 |
==================== ============================ |
241 |
X-Auth-Token Service authentication token |
242 |
==================== ============================ |
243 |
|
244 |
**Normal Response Code**: 200 |
245 |
|
246 |
**Error Response Codes**: |
247 |
|
248 |
====== ============================ |
249 |
Status Description |
250 |
====== ============================ |
251 |
401 Unauthorized (Missing token) |
252 |
500 Internal Server Error |
253 |
====== ============================ |
254 |
|
255 |
**Example Successful Response**: |
256 |
|
257 |
.. code-block:: javascript |
258 |
|
259 |
[<serial>, ...] |
260 |
|
261 |
Get the Description of a Commission |
262 |
................................... |
263 |
|
264 |
**GET** /astakos/api/commissions/<serial> |
265 |
|
266 |
==================== ============================ |
267 |
Request Header Name Value |
268 |
==================== ============================ |
269 |
X-Auth-Token Service authentication token |
270 |
==================== ============================ |
271 |
|
272 |
**Normal Response Code**: 200 |
273 |
|
274 |
**Error Response Codes**: |
275 |
|
276 |
====== ============================ |
277 |
Status Description |
278 |
====== ============================ |
279 |
401 Unauthorized (Missing token) |
280 |
404 Commission Not Found |
281 |
500 Internal Server Error |
282 |
====== ============================ |
283 |
|
284 |
**Example Successful Response**: |
285 |
|
286 |
.. code-block:: javascript |
287 |
|
288 |
{ |
289 |
"serial": 57, |
290 |
"issue_time": "2013-04-08T10:19:15.0373", |
291 |
"name": "an optional description", |
292 |
"provisions": [ |
293 |
{ |
294 |
"holder": "c02f315b-7d84-45bc-a383-552a3f97d2ad", |
295 |
"source": "system", |
296 |
"resource": "cyclades.vm", |
297 |
"quantity": 1 |
298 |
}, |
299 |
{ |
300 |
"holder": "c02f315b-7d84-45bc-a383-552a3f97d2ad", |
301 |
"source": "system", |
302 |
"resource": "cyclades.ram", |
303 |
"quantity": 536870912 |
304 |
} |
305 |
] |
306 |
} |
307 |
|
308 |
Accept or Reject a Commission |
309 |
............................. |
310 |
|
311 |
**POST** /astakos/api/commissions/<serial>/action |
312 |
|
313 |
==================== ============================ |
314 |
Request Header Name Value |
315 |
==================== ============================ |
316 |
X-Auth-Token Service authentication token |
317 |
==================== ============================ |
318 |
|
319 |
**Normal Response Code**: 200 |
320 |
|
321 |
**Error Response Codes**: |
322 |
|
323 |
====== ============================ |
324 |
Status Description |
325 |
====== ============================ |
326 |
401 Unauthorized (Missing token) |
327 |
404 Commission Not Found |
328 |
500 Internal Server Error |
329 |
====== ============================ |
330 |
|
331 |
**Example Requests**: |
332 |
|
333 |
.. code-block:: javascript |
334 |
|
335 |
{ |
336 |
"accept": "" |
337 |
} |
338 |
|
339 |
{ |
340 |
"reject": "" |
341 |
} |
342 |
|
343 |
Accept or Reject Multiple Commissions |
344 |
..................................... |
345 |
|
346 |
**POST** /astakos/api/commissions/action |
347 |
|
348 |
==================== ============================ |
349 |
Request Header Name Value |
350 |
==================== ============================ |
351 |
X-Auth-Token Service authentication token |
352 |
==================== ============================ |
353 |
|
354 |
**Normal Response Code**: 200 |
355 |
|
356 |
**Error Response Codes**: |
357 |
|
358 |
====== ============================ |
359 |
Status Description |
360 |
====== ============================ |
361 |
401 Unauthorized (Missing token) |
362 |
500 Internal Server Error |
363 |
====== ============================ |
364 |
|
365 |
**Example Request**: |
366 |
|
367 |
.. code-block:: javascript |
368 |
|
369 |
{ |
370 |
"accept": [56, 57], |
371 |
"reject": [56, 58, 59] |
372 |
} |
373 |
|
374 |
**Example Successful Response**: |
375 |
|
376 |
.. code-block:: javascript |
377 |
|
378 |
{ "accepted": [57], |
379 |
"rejected": [59], |
380 |
"failed": [ |
381 |
[56, { |
382 |
"badRequest": { |
383 |
"message": "cannot both accept and reject serial 56", |
384 |
"code": 400 |
385 |
} |
386 |
} |
387 |
], |
388 |
[58, { |
389 |
"itemNotFound": { |
390 |
"message": "serial 58 does not exist", |
391 |
"code": 404 |
392 |
} |
393 |
} |
394 |
] |
395 |
] |
396 |
} |