root / docs / quota-api-guide.rst @ 5afce44d
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 |
"available": 0 |
226 |
} |
227 |
} |
228 |
} |
229 |
|
230 |
Get Pending Commissions |
231 |
....................... |
232 |
|
233 |
**GET** /astakos/api/commissions |
234 |
|
235 |
==================== ============================ |
236 |
Request Header Name Value |
237 |
==================== ============================ |
238 |
X-Auth-Token Service authentication token |
239 |
==================== ============================ |
240 |
|
241 |
**Normal Response Code**: 200 |
242 |
|
243 |
**Error Response Codes**: |
244 |
|
245 |
====== ============================ |
246 |
Status Description |
247 |
====== ============================ |
248 |
401 Unauthorized (Missing token) |
249 |
500 Internal Server Error |
250 |
====== ============================ |
251 |
|
252 |
**Example Successful Response**: |
253 |
|
254 |
.. code-block:: javascript |
255 |
|
256 |
[<serial>, ...] |
257 |
|
258 |
Get the Description of a Commission |
259 |
................................... |
260 |
|
261 |
**GET** /astakos/api/commissions/<serial> |
262 |
|
263 |
==================== ============================ |
264 |
Request Header Name Value |
265 |
==================== ============================ |
266 |
X-Auth-Token Service authentication token |
267 |
==================== ============================ |
268 |
|
269 |
**Normal Response Code**: 200 |
270 |
|
271 |
**Error Response Codes**: |
272 |
|
273 |
====== ============================ |
274 |
Status Description |
275 |
====== ============================ |
276 |
401 Unauthorized (Missing token) |
277 |
404 Commission Not Found |
278 |
500 Internal Server Error |
279 |
====== ============================ |
280 |
|
281 |
**Example Successful Response**: |
282 |
|
283 |
.. code-block:: javascript |
284 |
|
285 |
{ |
286 |
"serial": 57, |
287 |
"issue_time": "2013-04-08T10:19:15.0373", |
288 |
"provisions": [ |
289 |
{ |
290 |
"holder": "c02f315b-7d84-45bc-a383-552a3f97d2ad", |
291 |
"source": "system", |
292 |
"resource": "cyclades.vm", |
293 |
"quantity": 1 |
294 |
}, |
295 |
{ |
296 |
"holder": "c02f315b-7d84-45bc-a383-552a3f97d2ad", |
297 |
"source": "system", |
298 |
"resource": "cyclades.ram", |
299 |
"quantity": 536870912 |
300 |
} |
301 |
] |
302 |
} |
303 |
|
304 |
Accept or Reject a Commission |
305 |
............................. |
306 |
|
307 |
**POST** /astakos/api/commissions/<serial>/action |
308 |
|
309 |
==================== ============================ |
310 |
Request Header Name Value |
311 |
==================== ============================ |
312 |
X-Auth-Token Service authentication token |
313 |
==================== ============================ |
314 |
|
315 |
**Normal Response Code**: 200 |
316 |
|
317 |
**Error Response Codes**: |
318 |
|
319 |
====== ============================ |
320 |
Status Description |
321 |
====== ============================ |
322 |
401 Unauthorized (Missing token) |
323 |
404 Commission Not Found |
324 |
500 Internal Server Error |
325 |
====== ============================ |
326 |
|
327 |
**Example Requests**: |
328 |
|
329 |
.. code-block:: javascript |
330 |
|
331 |
{ |
332 |
"accept": "" |
333 |
} |
334 |
|
335 |
{ |
336 |
"reject": "" |
337 |
} |
338 |
|
339 |
Accept or Reject Multiple Commissions |
340 |
..................................... |
341 |
|
342 |
**POST** /astakos/api/commissions/action |
343 |
|
344 |
==================== ============================ |
345 |
Request Header Name Value |
346 |
==================== ============================ |
347 |
X-Auth-Token Service authentication token |
348 |
==================== ============================ |
349 |
|
350 |
**Normal Response Code**: 200 |
351 |
|
352 |
**Error Response Codes**: |
353 |
|
354 |
====== ============================ |
355 |
Status Description |
356 |
====== ============================ |
357 |
401 Unauthorized (Missing token) |
358 |
500 Internal Server Error |
359 |
====== ============================ |
360 |
|
361 |
**Example Request**: |
362 |
|
363 |
.. code-block:: javascript |
364 |
|
365 |
{ |
366 |
"accept": [56, 57], |
367 |
"reject": [56, 58, 59] |
368 |
} |
369 |
|
370 |
**Example Successful Response**: |
371 |
|
372 |
.. code-block:: javascript |
373 |
|
374 |
{ "accepted": [57], |
375 |
"rejected": [59], |
376 |
"failed": [ |
377 |
[56, { |
378 |
"badRequest": { |
379 |
"message": "cannot both accept and reject serial 56", |
380 |
"code": 400 |
381 |
} |
382 |
} |
383 |
], |
384 |
[58, { |
385 |
"itemNotFound": { |
386 |
"message": "serial 58 does not exist", |
387 |
"code": 404 |
388 |
} |
389 |
} |
390 |
] |
391 |
] |
392 |
} |