@xen-orchestra/rest-api 0.17.0 → 0.19.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 +20 -0
- package/dist/abstract-classes/xapi-xo-controller.mjs +10 -0
- package/dist/abstract-classes/xo-controller.mjs +1 -1
- package/dist/alarms/alarm.controller.mjs +2 -1
- package/dist/backup-archives/backup-archive.controller.mjs +96 -0
- package/dist/backup-jobs/backup-job.controller.mjs +3 -1
- package/dist/backup-logs/backup-log.controller.mjs +2 -1
- package/dist/backup-repositories/backup-repositories.controller.mjs +2 -1
- package/dist/groups/group.controller.mjs +26 -1
- package/dist/hosts/host.controller.mjs +81 -2
- package/dist/index.mjs +3 -2
- package/dist/ioc/ioc.mjs +0 -5
- package/dist/messages/message.controller.mjs +3 -2
- package/dist/middlewares/authentication.middleware.mjs +44 -20
- package/dist/networks/network.controller.mjs +81 -2
- package/dist/open-api/oa-examples/backup-archive.oa-example.mjs +60 -0
- package/dist/open-api/oa-examples/pbd.oa-example.mjs +41 -0
- package/dist/open-api/oa-examples/user.oa-example.mjs +12 -0
- package/dist/open-api/routes/routes.js +2094 -538
- package/dist/pbds/pbd.controller.mjs +60 -0
- package/dist/pcis/pci.controller.mjs +2 -1
- package/dist/pgpus/pgpu.controller.mjs +2 -1
- package/dist/pifs/pif.controller.mjs +50 -1
- package/dist/pools/pool.controller.mjs +80 -3
- package/dist/proxies/proxy.controller.mjs +2 -1
- package/dist/restore-logs/restore-log.controller.mjs +3 -1
- package/dist/schedules/schedule.controller.mjs +2 -1
- package/dist/servers/server.controller.mjs +26 -2
- package/dist/sms/sm.controller.mjs +2 -1
- package/dist/srs/sr.controller.mjs +81 -2
- package/dist/tasks/task.controller.mjs +2 -1
- package/dist/users/user.controller.mjs +80 -31
- package/dist/users/user.middleware.mjs +11 -0
- package/dist/vbds/vbd.controller.mjs +50 -1
- package/dist/vdi-snapshots/vdi-snapshot.controller.mjs +81 -2
- package/dist/vdis/vdi.controller.mjs +105 -2
- package/dist/vifs/vif.controller.mjs +50 -1
- package/dist/vm-controller/vm-controller.controller.mjs +81 -2
- package/dist/vm-snapshots/vm-snapshot.controller.mjs +59 -8
- package/dist/vm-templates/vm-template.controller.mjs +59 -8
- package/dist/vms/vm.controller.mjs +38 -19
- package/dist/xoa/xoa.controller.mjs +2 -1
- package/open-api/spec/swagger.json +6380 -1008
- package/package.json +4 -4
- package/tsconfig.json +1 -0
- package/tsoa.json +19 -0
- package/dist/tasks/task.service.mjs +0 -24
|
@@ -7,16 +7,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
8
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
9
|
};
|
|
10
|
-
import { Example, Get, Path, Query, Response, Request, Route, Security, Tags, Delete, SuccessResponse } from 'tsoa';
|
|
10
|
+
import { Example, Get, Path, Query, Response, Request, Route, Security, Tags, Delete, SuccessResponse, Put } from 'tsoa';
|
|
11
11
|
import { inject } from 'inversify';
|
|
12
12
|
import { provide } from 'inversify-binding-decorators';
|
|
13
13
|
import { AlarmService } from '../alarms/alarm.service.mjs';
|
|
14
14
|
import { escapeUnsafeComplexMatcher } from '../helpers/utils.helper.mjs';
|
|
15
15
|
import { genericAlarmsExample } from '../open-api/oa-examples/alarm.oa-example.mjs';
|
|
16
16
|
import { network, networkIds, partialNetworks } from '../open-api/oa-examples/network.oa-example.mjs';
|
|
17
|
-
import { noContentResp, notFoundResp, unauthorizedResp } from '../open-api/common/response.common.mjs';
|
|
17
|
+
import { badRequestResp, noContentResp, notFoundResp, unauthorizedResp, } from '../open-api/common/response.common.mjs';
|
|
18
18
|
import { RestApi } from '../rest-api/rest-api.mjs';
|
|
19
19
|
import { XapiXoController } from '../abstract-classes/xapi-xo-controller.mjs';
|
|
20
|
+
import { messageIds, partialMessages } from '../open-api/oa-examples/message.oa-example.mjs';
|
|
21
|
+
import { partialTasks, taskIds } from '../open-api/oa-examples/task.oa-example.mjs';
|
|
20
22
|
let NetworkController = class NetworkController extends XapiXoController {
|
|
21
23
|
#alarmService;
|
|
22
24
|
constructor(restApi, alarmService) {
|
|
@@ -58,6 +60,42 @@ let NetworkController = class NetworkController extends XapiXoController {
|
|
|
58
60
|
});
|
|
59
61
|
return this.sendObjects(Object.values(alarms), req, 'alarms');
|
|
60
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* @example id "9fe12ca3-d75d-cfb0-492e-cfd2bc6c568f"
|
|
65
|
+
* @example fields "name,id,$object"
|
|
66
|
+
* @example filter "name:VM_STARTED"
|
|
67
|
+
* @example limit 42
|
|
68
|
+
*/
|
|
69
|
+
getNetworkMessages(req, id, fields, ndjson, filter, limit) {
|
|
70
|
+
const messages = this.getMessagesForObject(id, { filter, limit });
|
|
71
|
+
return this.sendObjects(Object.values(messages), req, 'messages');
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* @example id "9fe12ca3-d75d-cfb0-492e-cfd2bc6c568f"
|
|
75
|
+
* @example fields "id,status,properties"
|
|
76
|
+
* @example filter "status:failure"
|
|
77
|
+
* @example limit 42
|
|
78
|
+
*/
|
|
79
|
+
async getNetworkTasks(req, id, fields, ndjson, filter, limit) {
|
|
80
|
+
const tasks = await this.getTasksForObject(id, { filter, limit });
|
|
81
|
+
return this.sendObjects(Object.values(tasks), req, 'tasks');
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @example id "9fe12ca3-d75d-cfb0-492e-cfd2bc6c568f"
|
|
85
|
+
* @example tag "from-rest-api"
|
|
86
|
+
*/
|
|
87
|
+
async putNetworkTag(id, tag) {
|
|
88
|
+
const network = this.getXapiObject(id);
|
|
89
|
+
await network.$call('add_tags', tag);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* @example id "9fe12ca3-d75d-cfb0-492e-cfd2bc6c568f"
|
|
93
|
+
* @example tag "from-rest-api"
|
|
94
|
+
*/
|
|
95
|
+
async deleteNetworkTag(id, tag) {
|
|
96
|
+
const network = this.getXapiObject(id);
|
|
97
|
+
await network.$call('remove_tags', tag);
|
|
98
|
+
}
|
|
61
99
|
};
|
|
62
100
|
__decorate([
|
|
63
101
|
Example(networkIds),
|
|
@@ -93,9 +131,50 @@ __decorate([
|
|
|
93
131
|
__param(4, Query()),
|
|
94
132
|
__param(5, Query())
|
|
95
133
|
], NetworkController.prototype, "getNetworkAlarms", null);
|
|
134
|
+
__decorate([
|
|
135
|
+
Example(messageIds),
|
|
136
|
+
Example(partialMessages),
|
|
137
|
+
Get('{id}/messages'),
|
|
138
|
+
Tags('messages'),
|
|
139
|
+
Response(notFoundResp.status, notFoundResp.description),
|
|
140
|
+
__param(0, Request()),
|
|
141
|
+
__param(1, Path()),
|
|
142
|
+
__param(2, Query()),
|
|
143
|
+
__param(3, Query()),
|
|
144
|
+
__param(4, Query()),
|
|
145
|
+
__param(5, Query())
|
|
146
|
+
], NetworkController.prototype, "getNetworkMessages", null);
|
|
147
|
+
__decorate([
|
|
148
|
+
Example(taskIds),
|
|
149
|
+
Example(partialTasks),
|
|
150
|
+
Get('{id}/tasks'),
|
|
151
|
+
Tags('tasks'),
|
|
152
|
+
Response(notFoundResp.status, notFoundResp.description),
|
|
153
|
+
__param(0, Request()),
|
|
154
|
+
__param(1, Path()),
|
|
155
|
+
__param(2, Query()),
|
|
156
|
+
__param(3, Query()),
|
|
157
|
+
__param(4, Query()),
|
|
158
|
+
__param(5, Query())
|
|
159
|
+
], NetworkController.prototype, "getNetworkTasks", null);
|
|
160
|
+
__decorate([
|
|
161
|
+
Put('{id}/tags/{tag}'),
|
|
162
|
+
SuccessResponse(noContentResp.status, noContentResp.description),
|
|
163
|
+
Response(notFoundResp.status, notFoundResp.description),
|
|
164
|
+
__param(0, Path()),
|
|
165
|
+
__param(1, Path())
|
|
166
|
+
], NetworkController.prototype, "putNetworkTag", null);
|
|
167
|
+
__decorate([
|
|
168
|
+
Delete('{id}/tags/{tag}'),
|
|
169
|
+
SuccessResponse(noContentResp.status, noContentResp.description),
|
|
170
|
+
Response(notFoundResp.status, notFoundResp.description),
|
|
171
|
+
__param(0, Path()),
|
|
172
|
+
__param(1, Path())
|
|
173
|
+
], NetworkController.prototype, "deleteNetworkTag", null);
|
|
96
174
|
NetworkController = __decorate([
|
|
97
175
|
Route('networks'),
|
|
98
176
|
Security('*'),
|
|
177
|
+
Response(badRequestResp.status, badRequestResp.description),
|
|
99
178
|
Response(unauthorizedResp.status, unauthorizedResp.description),
|
|
100
179
|
Tags('networks'),
|
|
101
180
|
provide(NetworkController),
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export const backupArchiveIds = [
|
|
2
|
+
'/rest/v0/backup-archives/231264c3-af43-4ec0-a3be-394c5b1fdbfc//xo-vm-backups/6ef7c09e-677b-1e6f-0546-7ab30413c61c/20250801T080832Z.json',
|
|
3
|
+
'/rest/v0/backup-archives/1af95910-01b4-4e87-9c2f-d895cafe0776//xo-vm-backups/7cf6150f-a978-09e6-6b41-0d1d41967bdc/20250918T132942Z.json',
|
|
4
|
+
];
|
|
5
|
+
export const partialBackupArchives = [
|
|
6
|
+
{
|
|
7
|
+
id: '231264c3-af43-4ec0-a3be-394c5b1fdbfc//xo-vm-backups/6ef7c09e-677b-1e6f-0546-7ab30413c61c/20250801T080832Z.json',
|
|
8
|
+
backupRepository: '231264c3-af43-4ec0-a3be-394c5b1fdbfc',
|
|
9
|
+
disks: [
|
|
10
|
+
{
|
|
11
|
+
id: '/xo-vm-backups/6ef7c09e-677b-1e6f-0546-7ab30413c61c/vdis/8b650248-ddd6-4188-ad8b-c0502865ac6c/f1f3c902-dcaa-4ec6-943e-6162c9d85fb2/20250801T080832Z.vhd',
|
|
12
|
+
name: 'debian 12 hub disk',
|
|
13
|
+
uuid: 'cbe1e3ba-8e5c-4c79-9e4d-708144518d50',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: '/xo-vm-backups/6ef7c09e-677b-1e6f-0546-7ab30413c61c/vdis/8b650248-ddd6-4188-ad8b-c0502865ac6c/870e6142-d4e4-4622-bd19-6b101c8da3cc/20250801T080832Z.vhd',
|
|
17
|
+
name: 'XO CloudConfigDrive',
|
|
18
|
+
uuid: 'bea8193d-80ba-4a72-94e4-901f03ffc225',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
href: '/rest/v0/backup-archives/231264c3-af43-4ec0-a3be-394c5b1fdbfc/xo-vm-backups/6ef7c09e-677b-1e6f-0546-7ab30413c61c/20250801T080832Z.json',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: '1af95910-01b4-4e87-9c2f-d895cafe0776//xo-vm-backups/7cf6150f-a978-09e6-6b41-0d1d41967bdc/20250918T132942Z.json',
|
|
25
|
+
backupRepository: '1af95910-01b4-4e87-9c2f-d895cafe0776',
|
|
26
|
+
disks: [
|
|
27
|
+
{
|
|
28
|
+
id: '/xo-vm-backups/803c2676-c309-721e-7123-e6c3de854c32/vdis/ce91bf34-099c-4241-a608-3373f101c02b/7384cf5a-3202-4a21-bfd0-8da467449fa6/20250916T144850Z.vhd',
|
|
29
|
+
name: 'AlmaLinux 9_ivopu',
|
|
30
|
+
uuid: '73ed06ed-fdc8-43ef-a1c4-253e9005fbe0',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
href: '/rest/v0/backup-archives/1af95910-01b4-4e87-9c2f-d895cafe0776//xo-vm-backups/7cf6150f-a978-09e6-6b41-0d1d41967bdc/20250918T132942Z.json',
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
export const backupArchive = {
|
|
37
|
+
type: 'xo-vm-backup',
|
|
38
|
+
backupRepository: '1af95910-01b4-4e87-9c2f-d895cafe0776',
|
|
39
|
+
disks: [
|
|
40
|
+
{
|
|
41
|
+
id: '/xo-vm-backups/7cf6150f-a978-09e6-6b41-0d1d41967bdc/vdis/f2599aa4-7bb4-434b-bf71-cf0ebe1e06a4/007e4f3e-6315-4779-aab5-461b519836f3/20250918T132942Z.alias.vhd',
|
|
42
|
+
name: 'min-alpine-mra_alegi',
|
|
43
|
+
uuid: 'c922ef3c-9d76-4482-87f8-a4da5849ee45',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
id: '1af95910-01b4-4e87-9c2f-d895cafe0776//xo-vm-backups/7cf6150f-a978-09e6-6b41-0d1d41967bdc/20250918T132942Z.json',
|
|
47
|
+
jobId: 'f2599aa4-7bb4-434b-bf71-cf0ebe1e06a4',
|
|
48
|
+
mode: 'delta',
|
|
49
|
+
scheduleId: '8db1c2da-2635-436f-8f78-62079fea3aa6',
|
|
50
|
+
size: 0,
|
|
51
|
+
timestamp: 1758202182963,
|
|
52
|
+
vm: {
|
|
53
|
+
uuid: '7cf6150f-a978-09e6-6b41-0d1d41967bdc',
|
|
54
|
+
name_description: 'root:vateslab',
|
|
55
|
+
name_label: 'mra_vtp_test',
|
|
56
|
+
},
|
|
57
|
+
differencingVhds: 1,
|
|
58
|
+
dynamicVhds: 0,
|
|
59
|
+
withMemory: false,
|
|
60
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export const pbdIds = [
|
|
2
|
+
'/rest/v0/pbds/16b2a60f-7c4d-f45f-7c7a-963b06fc587d',
|
|
3
|
+
'/rest/v0/pbds/28d93f56-23cb-527c-080a-805e54593a0d',
|
|
4
|
+
];
|
|
5
|
+
export const partialPbds = [
|
|
6
|
+
{
|
|
7
|
+
attached: true,
|
|
8
|
+
id: '16b2a60f-7c4d-f45f-7c7a-963b06fc587d',
|
|
9
|
+
device_config: {
|
|
10
|
+
device: '/dev/disk/by-id/ata-YP0120GWCGV_2H5020013956-part3',
|
|
11
|
+
},
|
|
12
|
+
href: '/rest/v0/pbds/16b2a60f-7c4d-f45f-7c7a-963b06fc587d',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
attached: true,
|
|
16
|
+
id: '28d93f56-23cb-527c-080a-805e54593a0d',
|
|
17
|
+
device_config: {
|
|
18
|
+
path: '/opt/xensource/packages/iso',
|
|
19
|
+
location: '/opt/xensource/packages/iso',
|
|
20
|
+
legacy_mode: 'true',
|
|
21
|
+
},
|
|
22
|
+
href: '/rest/v0/pbds/28d93f56-23cb-527c-080a-805e54593a0d',
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
export const pbd = {
|
|
26
|
+
type: 'PBD',
|
|
27
|
+
attached: true,
|
|
28
|
+
host: '669df518-4e5d-4d84-b93a-9be2cdcdfca1',
|
|
29
|
+
SR: '8aa2fb4a-143e-c2bc-05d4-c68bbb101d41',
|
|
30
|
+
device_config: {
|
|
31
|
+
device: '/dev/disk/by-id/ata-YP0120GWCGV_2H5020013956-part3',
|
|
32
|
+
},
|
|
33
|
+
otherConfig: {
|
|
34
|
+
storage_driver_domain: 'OpaqueRef:6a7cfe18-1b68-205f-080a-3a64fb5f0e19',
|
|
35
|
+
},
|
|
36
|
+
id: '16b2a60f-7c4d-f45f-7c7a-963b06fc587d',
|
|
37
|
+
uuid: '16b2a60f-7c4d-f45f-7c7a-963b06fc587d',
|
|
38
|
+
$pool: 'b7569d99-30f8-178a-7d94-801de3e29b5b',
|
|
39
|
+
$poolId: 'b7569d99-30f8-178a-7d94-801de3e29b5b',
|
|
40
|
+
_xapiRef: 'OpaqueRef:fc6b3830-610b-adc8-2ea4-b7769f0931bf',
|
|
41
|
+
};
|
|
@@ -57,3 +57,15 @@ export const authenticationTokens = [
|
|
|
57
57
|
id: 'ktdlq-BX_GdS5N8MR0v7QIuoSymBw4Ys4EOxsOdqpnE',
|
|
58
58
|
},
|
|
59
59
|
];
|
|
60
|
+
export const authenticationToken = {
|
|
61
|
+
token: {
|
|
62
|
+
client: {
|
|
63
|
+
id: 'my-fav-client',
|
|
64
|
+
},
|
|
65
|
+
created_at: 1760346600297,
|
|
66
|
+
description: 'token for CLI usage',
|
|
67
|
+
id: 'fhIUz8AtMLndzMd3ksfoTpHb0tWyKHmT6-M3o_hUbRg',
|
|
68
|
+
user_id: '722d17b9-699b-49d2-8193-be1ac573d3de',
|
|
69
|
+
expiration: 1760350200297,
|
|
70
|
+
},
|
|
71
|
+
};
|