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