@xen-orchestra/rest-api 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abstract-classes/base-controller.mjs +22 -0
- package/dist/alarms/alarm.controller.mjs +1 -1
- package/dist/hosts/host.controller.mjs +30 -1
- package/dist/messages/message.controller.mjs +1 -1
- package/dist/middlewares/generic-error-handler.middleware.mjs +15 -11
- package/dist/middlewares/tsoa-to-xo-error.middleware.mjs +1 -1
- package/dist/open-api/oa-examples/pool.oa-example.mjs +200 -0
- package/dist/open-api/routes/routes.js +101 -15
- package/dist/pools/pool.controller.mjs +15 -1
- package/dist/vms/vm.controller.mjs +1 -1
- package/open-api/spec/swagger.json +2350 -295
- package/package.json +2 -2
|
@@ -14,7 +14,7 @@ import { json } from 'express';
|
|
|
14
14
|
import { RestApi } from '../rest-api/rest-api.mjs';
|
|
15
15
|
import { asynchronousActionResp, createdResp, featureUnauthorized, internalServerErrorResp, noContentResp, notFoundResp, unauthorizedResp, } from '../open-api/common/response.common.mjs';
|
|
16
16
|
import { XapiXoController } from '../abstract-classes/xapi-xo-controller.mjs';
|
|
17
|
-
import { createVm, importVm, partialPools, pool, poolIds } from '../open-api/oa-examples/pool.oa-example.mjs';
|
|
17
|
+
import { createVm, importVm, partialPools, pool, poolIds, poolStats } from '../open-api/oa-examples/pool.oa-example.mjs';
|
|
18
18
|
import { taskLocation } from '../open-api/oa-examples/task.oa-example.mjs';
|
|
19
19
|
import { createNetwork } from '../open-api/oa-examples/schedule.oa-example.mjs';
|
|
20
20
|
import { BASE_URL } from '../index.mjs';
|
|
@@ -170,6 +170,12 @@ let PoolController = class PoolController extends XapiXoController {
|
|
|
170
170
|
},
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* @example id "355ee47d-ff4c-4924-3db2-fd86ae629677"
|
|
175
|
+
*/
|
|
176
|
+
getStats(id, granularity) {
|
|
177
|
+
return this.restApi.xoApp.getXapiPoolStats(id, granularity);
|
|
178
|
+
}
|
|
173
179
|
};
|
|
174
180
|
__decorate([
|
|
175
181
|
Example(poolIds),
|
|
@@ -256,6 +262,14 @@ __decorate([
|
|
|
256
262
|
__param(1, Body()),
|
|
257
263
|
__param(2, Query())
|
|
258
264
|
], PoolController.prototype, "createVm", null);
|
|
265
|
+
__decorate([
|
|
266
|
+
Example(poolStats),
|
|
267
|
+
Get('{id}/stats'),
|
|
268
|
+
Response(notFoundResp.status, notFoundResp.description),
|
|
269
|
+
Response(422, 'Invalid granularity'),
|
|
270
|
+
__param(0, Path()),
|
|
271
|
+
__param(1, Query())
|
|
272
|
+
], PoolController.prototype, "getStats", null);
|
|
259
273
|
PoolController = __decorate([
|
|
260
274
|
Route('pools'),
|
|
261
275
|
Security('*'),
|
|
@@ -52,7 +52,7 @@ let VmController = class VmController extends XapiXoController {
|
|
|
52
52
|
if (incorrectState.is(error, {
|
|
53
53
|
property: 'resident_on',
|
|
54
54
|
})) {
|
|
55
|
-
|
|
55
|
+
throw invalidParameters(`VM ${id} is halted or host could not be found.`, error);
|
|
56
56
|
}
|
|
57
57
|
throw error;
|
|
58
58
|
}
|