@xen-orchestra/rest-api 0.2.0 → 0.3.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/open-api/oa-examples/vm-controller.oa-example.mjs +71 -0
- package/dist/open-api/oa-examples/vm-snapshot.oa-example.mjs +178 -0
- package/dist/open-api/oa-examples/vm-template.oa-example.mjs +91 -0
- package/dist/open-api/routes/routes.js +249 -27
- package/dist/vm-controller/vm-controller.controller.mjs +60 -0
- package/dist/vm-snapshots/vm-snapshot.controller.mjs +60 -0
- package/dist/vm-templates/vm-template.controller.mjs +59 -0
- package/open-api/spec/swagger.json +4489 -1422
- package/package.json +2 -2
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
};
|
|
10
|
+
import { inject } from 'inversify';
|
|
11
|
+
import { XapiXoController } from '../abstract-classes/xapi-xo-controller.mjs';
|
|
12
|
+
import { RestApi } from '../rest-api/rest-api.mjs';
|
|
13
|
+
import { Example, Get, Path, Query, Request, Response, Route, Security, Tags } from 'tsoa';
|
|
14
|
+
import { notFoundResp, unauthorizedResp } from '../open-api/common/response.common.mjs';
|
|
15
|
+
import { provide } from 'inversify-binding-decorators';
|
|
16
|
+
import { partialVmControllers, vmController, vmControllerIds, } from '../open-api/oa-examples/vm-controller.oa-example.mjs';
|
|
17
|
+
let VmControllerController = class VmControllerController extends XapiXoController {
|
|
18
|
+
constructor(restApi) {
|
|
19
|
+
super('VM-controller', restApi);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @example fields "type,uuid"
|
|
24
|
+
* @example filter "power_state:Running"
|
|
25
|
+
* @example limit 42
|
|
26
|
+
*/
|
|
27
|
+
getVmControllers(req, fields, filter, limit) {
|
|
28
|
+
return this.sendObjects(Object.values(this.getObjects({ filter, limit })), req);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @example id "9b4775bd-9493-490a-9afa-f786a44caa4f"
|
|
32
|
+
*/
|
|
33
|
+
getVmController(id) {
|
|
34
|
+
return this.getObject(id);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
__decorate([
|
|
38
|
+
Example(vmControllerIds),
|
|
39
|
+
Example(partialVmControllers),
|
|
40
|
+
Get(''),
|
|
41
|
+
__param(0, Request()),
|
|
42
|
+
__param(1, Query()),
|
|
43
|
+
__param(2, Query()),
|
|
44
|
+
__param(3, Query())
|
|
45
|
+
], VmControllerController.prototype, "getVmControllers", null);
|
|
46
|
+
__decorate([
|
|
47
|
+
Example(vmController),
|
|
48
|
+
Get('{id}'),
|
|
49
|
+
Response(notFoundResp.status, notFoundResp.description),
|
|
50
|
+
__param(0, Path())
|
|
51
|
+
], VmControllerController.prototype, "getVmController", null);
|
|
52
|
+
VmControllerController = __decorate([
|
|
53
|
+
Route('vm-controllers'),
|
|
54
|
+
Security('*'),
|
|
55
|
+
Response(unauthorizedResp.status, unauthorizedResp.description),
|
|
56
|
+
Tags('vms'),
|
|
57
|
+
provide(VmControllerController),
|
|
58
|
+
__param(0, inject(RestApi))
|
|
59
|
+
], VmControllerController);
|
|
60
|
+
export { VmControllerController };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
};
|
|
10
|
+
import { Example, Get, Path, Query, Request, Response, Route, Security, Tags } from 'tsoa';
|
|
11
|
+
import { inject } from 'inversify';
|
|
12
|
+
import { notFoundResp, unauthorizedResp } from '../open-api/common/response.common.mjs';
|
|
13
|
+
import { RestApi } from '../rest-api/rest-api.mjs';
|
|
14
|
+
import { XapiXoController } from '../abstract-classes/xapi-xo-controller.mjs';
|
|
15
|
+
import { provide } from 'inversify-binding-decorators';
|
|
16
|
+
import { partialVmSnapshots, vmSnapshot, vmSnapshotIds } from '../open-api/oa-examples/vm-snapshot.oa-example.mjs';
|
|
17
|
+
let VmSnapshotController = class VmSnapshotController extends XapiXoController {
|
|
18
|
+
constructor(restApi) {
|
|
19
|
+
super('VM-snapshot', restApi);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @example fields "uuid,snapshot_time,$snapshot_of"
|
|
24
|
+
* @example filter "snapshot_time:>1725020038"
|
|
25
|
+
* @example limit 42
|
|
26
|
+
*/
|
|
27
|
+
getVmSnapshots(req, fields, filter, limit) {
|
|
28
|
+
return this.sendObjects(Object.values(this.getObjects({ filter, limit })), req);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @example id "d68fca2c-41e6-be87-d790-105c1642a090"
|
|
32
|
+
*/
|
|
33
|
+
getVmSnapshot(id) {
|
|
34
|
+
return this.getObject(id);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
__decorate([
|
|
38
|
+
Example(vmSnapshotIds),
|
|
39
|
+
Example(partialVmSnapshots),
|
|
40
|
+
Get(''),
|
|
41
|
+
__param(0, Request()),
|
|
42
|
+
__param(1, Query()),
|
|
43
|
+
__param(2, Query()),
|
|
44
|
+
__param(3, Query())
|
|
45
|
+
], VmSnapshotController.prototype, "getVmSnapshots", null);
|
|
46
|
+
__decorate([
|
|
47
|
+
Example(vmSnapshot),
|
|
48
|
+
Get('{id}'),
|
|
49
|
+
Response(notFoundResp.status, notFoundResp.description),
|
|
50
|
+
__param(0, Path())
|
|
51
|
+
], VmSnapshotController.prototype, "getVmSnapshot", null);
|
|
52
|
+
VmSnapshotController = __decorate([
|
|
53
|
+
Route('vm-snapshots'),
|
|
54
|
+
Security('*'),
|
|
55
|
+
Response(unauthorizedResp.status, unauthorizedResp.description),
|
|
56
|
+
Tags('vms'),
|
|
57
|
+
provide(VmSnapshotController),
|
|
58
|
+
__param(0, inject(RestApi))
|
|
59
|
+
], VmSnapshotController);
|
|
60
|
+
export { VmSnapshotController };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
};
|
|
10
|
+
import { Example, Get, Security, Query, Request, Response, Route, Tags, Path } from 'tsoa';
|
|
11
|
+
import { inject } from 'inversify';
|
|
12
|
+
import { provide } from 'inversify-binding-decorators';
|
|
13
|
+
import { notFoundResp, unauthorizedResp } from '../open-api/common/response.common.mjs';
|
|
14
|
+
import { RestApi } from '../rest-api/rest-api.mjs';
|
|
15
|
+
import { XapiXoController } from '../abstract-classes/xapi-xo-controller.mjs';
|
|
16
|
+
import { partialVmTemplates, vmTemplate, vmTemplateIds } from '../open-api/oa-examples/vm-template.oa-example.mjs';
|
|
17
|
+
let VmTemplateController = class VmTemplateController extends XapiXoController {
|
|
18
|
+
constructor(restApi) {
|
|
19
|
+
super('VM-template', restApi);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @example fields "id,isDefaultTemplate,name_label"
|
|
23
|
+
* @example filter "isDefaultTemplate?"
|
|
24
|
+
* @example limit 42
|
|
25
|
+
* */
|
|
26
|
+
getVmTemplates(req, fields, filter, limit) {
|
|
27
|
+
return this.sendObjects(Object.values(this.getObjects({ filter, limit })), req);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @example id "b7569d99-30f8-178a-7d94-801de3e29b5b-f873abe0-b138-4995-8f6f-498b423d234d"
|
|
31
|
+
* */
|
|
32
|
+
getVmTemplate(id) {
|
|
33
|
+
return this.getObject(id);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
__decorate([
|
|
37
|
+
Example(vmTemplateIds),
|
|
38
|
+
Example(partialVmTemplates),
|
|
39
|
+
Get(''),
|
|
40
|
+
__param(0, Request()),
|
|
41
|
+
__param(1, Query()),
|
|
42
|
+
__param(2, Query()),
|
|
43
|
+
__param(3, Query())
|
|
44
|
+
], VmTemplateController.prototype, "getVmTemplates", null);
|
|
45
|
+
__decorate([
|
|
46
|
+
Example(vmTemplate),
|
|
47
|
+
Get('{id}'),
|
|
48
|
+
Response(notFoundResp.status, notFoundResp.description),
|
|
49
|
+
__param(0, Path())
|
|
50
|
+
], VmTemplateController.prototype, "getVmTemplate", null);
|
|
51
|
+
VmTemplateController = __decorate([
|
|
52
|
+
Route('vm-templates'),
|
|
53
|
+
Security('*'),
|
|
54
|
+
Response(unauthorizedResp.status, unauthorizedResp.description),
|
|
55
|
+
Tags('vms'),
|
|
56
|
+
provide(VmTemplateController),
|
|
57
|
+
__param(0, inject(RestApi))
|
|
58
|
+
], VmTemplateController);
|
|
59
|
+
export { VmTemplateController };
|