@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.
Files changed (47) hide show
  1. package/dist/abstract-classes/base-controller.mjs +20 -0
  2. package/dist/abstract-classes/xapi-xo-controller.mjs +10 -0
  3. package/dist/abstract-classes/xo-controller.mjs +1 -1
  4. package/dist/alarms/alarm.controller.mjs +2 -1
  5. package/dist/backup-archives/backup-archive.controller.mjs +96 -0
  6. package/dist/backup-jobs/backup-job.controller.mjs +3 -1
  7. package/dist/backup-logs/backup-log.controller.mjs +2 -1
  8. package/dist/backup-repositories/backup-repositories.controller.mjs +2 -1
  9. package/dist/groups/group.controller.mjs +26 -1
  10. package/dist/hosts/host.controller.mjs +81 -2
  11. package/dist/index.mjs +3 -2
  12. package/dist/ioc/ioc.mjs +0 -5
  13. package/dist/messages/message.controller.mjs +3 -2
  14. package/dist/middlewares/authentication.middleware.mjs +44 -20
  15. package/dist/networks/network.controller.mjs +81 -2
  16. package/dist/open-api/oa-examples/backup-archive.oa-example.mjs +60 -0
  17. package/dist/open-api/oa-examples/pbd.oa-example.mjs +41 -0
  18. package/dist/open-api/oa-examples/user.oa-example.mjs +12 -0
  19. package/dist/open-api/routes/routes.js +2094 -538
  20. package/dist/pbds/pbd.controller.mjs +60 -0
  21. package/dist/pcis/pci.controller.mjs +2 -1
  22. package/dist/pgpus/pgpu.controller.mjs +2 -1
  23. package/dist/pifs/pif.controller.mjs +50 -1
  24. package/dist/pools/pool.controller.mjs +80 -3
  25. package/dist/proxies/proxy.controller.mjs +2 -1
  26. package/dist/restore-logs/restore-log.controller.mjs +3 -1
  27. package/dist/schedules/schedule.controller.mjs +2 -1
  28. package/dist/servers/server.controller.mjs +26 -2
  29. package/dist/sms/sm.controller.mjs +2 -1
  30. package/dist/srs/sr.controller.mjs +81 -2
  31. package/dist/tasks/task.controller.mjs +2 -1
  32. package/dist/users/user.controller.mjs +80 -31
  33. package/dist/users/user.middleware.mjs +11 -0
  34. package/dist/vbds/vbd.controller.mjs +50 -1
  35. package/dist/vdi-snapshots/vdi-snapshot.controller.mjs +81 -2
  36. package/dist/vdis/vdi.controller.mjs +105 -2
  37. package/dist/vifs/vif.controller.mjs +50 -1
  38. package/dist/vm-controller/vm-controller.controller.mjs +81 -2
  39. package/dist/vm-snapshots/vm-snapshot.controller.mjs +59 -8
  40. package/dist/vm-templates/vm-template.controller.mjs +59 -8
  41. package/dist/vms/vm.controller.mjs +38 -19
  42. package/dist/xoa/xoa.controller.mjs +2 -1
  43. package/open-api/spec/swagger.json +6380 -1008
  44. package/package.json +4 -4
  45. package/tsconfig.json +1 -0
  46. package/tsoa.json +19 -0
  47. package/dist/tasks/task.service.mjs +0 -24
@@ -10,14 +10,16 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
10
10
  import { inject } from 'inversify';
11
11
  import { XapiXoController } from '../abstract-classes/xapi-xo-controller.mjs';
12
12
  import { RestApi } from '../rest-api/rest-api.mjs';
13
- import { Example, Get, Path, Query, Request, Response, Route, Security, Tags } from 'tsoa';
13
+ import { Delete, Example, Get, Path, Put, Query, Request, Response, Route, Security, SuccessResponse, Tags } from 'tsoa';
14
14
  import { AlarmService } from '../alarms/alarm.service.mjs';
15
15
  import { escapeUnsafeComplexMatcher, limitAndFilterArray } from '../helpers/utils.helper.mjs';
16
16
  import { genericAlarmsExample } from '../open-api/oa-examples/alarm.oa-example.mjs';
17
- import { 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 { provide } from 'inversify-binding-decorators';
19
19
  import { partialVmControllers, vmController, vmControllerIds, vmControllerVdis, } from '../open-api/oa-examples/vm-controller.oa-example.mjs';
20
20
  import { VmService } from '../vms/vm.service.mjs';
21
+ import { messageIds, partialMessages } from '../open-api/oa-examples/message.oa-example.mjs';
22
+ import { taskIds, partialTasks } from '../open-api/oa-examples/task.oa-example.mjs';
21
23
  let VmControllerController = class VmControllerController extends XapiXoController {
22
24
  #alarmService;
23
25
  #vmService;
@@ -65,6 +67,42 @@ let VmControllerController = class VmControllerController extends XapiXoControll
65
67
  const vdis = this.#vmService.getVmVdis(id, 'VM-controller');
66
68
  return this.sendObjects(limitAndFilterArray(vdis, { filter, limit }), req, obj => obj.type.toLowerCase() + 's');
67
69
  }
70
+ /**
71
+ * @example id "9b4775bd-9493-490a-9afa-f786a44caa4f"
72
+ * @example fields "name,id,$object"
73
+ * @example filter "name:VM_STARTED"
74
+ * @example limit 42
75
+ */
76
+ getVmControllerMessages(req, id, fields, ndjson, filter, limit) {
77
+ const messages = this.getMessagesForObject(id, { filter, limit });
78
+ return this.sendObjects(Object.values(messages), req, 'messages');
79
+ }
80
+ /**
81
+ * @example id "9b4775bd-9493-490a-9afa-f786a44caa4f"
82
+ * @example fields "id,status,properties"
83
+ * @example filter "status:failure"
84
+ * @example limit 42
85
+ */
86
+ async getVmControllerTasks(req, id, fields, ndjson, filter, limit) {
87
+ const tasks = await this.getTasksForObject(id, { filter, limit });
88
+ return this.sendObjects(Object.values(tasks), req, 'tasks');
89
+ }
90
+ /**
91
+ * @example id "9b4775bd-9493-490a-9afa-f786a44caa4f"
92
+ * @example tag "from-rest-api"
93
+ */
94
+ async putVmControllerTag(id, tag) {
95
+ const vmController = this.getXapiObject(id);
96
+ await vmController.$call('add_tags', tag);
97
+ }
98
+ /**
99
+ * @example id "9b4775bd-9493-490a-9afa-f786a44caa4f"
100
+ * @example tag "from-rest-api"
101
+ */
102
+ async deleteVmControllerTag(id, tag) {
103
+ const vmController = this.getXapiObject(id);
104
+ await vmController.$call('remove_tags', tag);
105
+ }
68
106
  };
69
107
  __decorate([
70
108
  Example(vmControllerIds),
@@ -106,9 +144,50 @@ __decorate([
106
144
  __param(4, Query()),
107
145
  __param(5, Query())
108
146
  ], VmControllerController.prototype, "getVmControllerVdis", null);
147
+ __decorate([
148
+ Example(messageIds),
149
+ Example(partialMessages),
150
+ Get('{id}/messages'),
151
+ Tags('messages'),
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
+ ], VmControllerController.prototype, "getVmControllerMessages", null);
160
+ __decorate([
161
+ Example(taskIds),
162
+ Example(partialTasks),
163
+ Get('{id}/tasks'),
164
+ Tags('tasks'),
165
+ Response(notFoundResp.status, notFoundResp.description),
166
+ __param(0, Request()),
167
+ __param(1, Path()),
168
+ __param(2, Query()),
169
+ __param(3, Query()),
170
+ __param(4, Query()),
171
+ __param(5, Query())
172
+ ], VmControllerController.prototype, "getVmControllerTasks", null);
173
+ __decorate([
174
+ Put('{id}/tags/{tag}'),
175
+ SuccessResponse(noContentResp.status, noContentResp.description),
176
+ Response(notFoundResp.status, notFoundResp.description),
177
+ __param(0, Path()),
178
+ __param(1, Path())
179
+ ], VmControllerController.prototype, "putVmControllerTag", null);
180
+ __decorate([
181
+ Delete('{id}/tags/{tag}'),
182
+ SuccessResponse(noContentResp.status, noContentResp.description),
183
+ Response(notFoundResp.status, notFoundResp.description),
184
+ __param(0, Path()),
185
+ __param(1, Path())
186
+ ], VmControllerController.prototype, "deleteVmControllerTag", null);
109
187
  VmControllerController = __decorate([
110
188
  Route('vm-controllers'),
111
189
  Security('*'),
190
+ Response(badRequestResp.status, badRequestResp.description),
112
191
  Response(unauthorizedResp.status, unauthorizedResp.description),
113
192
  Tags('vms'),
114
193
  provide(VmControllerController),
@@ -7,12 +7,13 @@ 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 { Delete, Example, Get, Path, Query, Request, Response, Route, Security, SuccessResponse, Tags } from 'tsoa';
10
+ import { Delete, Example, Get, Path, Put, Query, Request, Response, Route, Security, SuccessResponse, Tags } from 'tsoa';
11
11
  import { inject } from 'inversify';
12
- import { AlarmService, RAW_ALARM_FILTER } from '../alarms/alarm.service.mjs';
12
+ import { AlarmService } from '../alarms/alarm.service.mjs';
13
13
  import { escapeUnsafeComplexMatcher, limitAndFilterArray } from '../helpers/utils.helper.mjs';
14
14
  import { genericAlarmsExample } from '../open-api/oa-examples/alarm.oa-example.mjs';
15
- import { forbiddenOperationResp, incorrectStateResp, noContentResp, notFoundResp, unauthorizedResp, } from '../open-api/common/response.common.mjs';
15
+ import { partialTasks, taskIds } from '../open-api/oa-examples/task.oa-example.mjs';
16
+ import { badRequestResp, forbiddenOperationResp, incorrectStateResp, noContentResp, notFoundResp, unauthorizedResp, } from '../open-api/common/response.common.mjs';
16
17
  import { RestApi } from '../rest-api/rest-api.mjs';
17
18
  import { XapiXoController } from '../abstract-classes/xapi-xo-controller.mjs';
18
19
  import { provide } from 'inversify-binding-decorators';
@@ -96,13 +97,35 @@ let VmSnapshotController = class VmSnapshotController extends XapiXoController {
96
97
  * @example limit 42
97
98
  */
98
99
  getVmSnapshotsMessages(req, id, fields, ndjson, filter, limit) {
99
- const vm = this.getObject(id);
100
- const messages = this.restApi.getObjectsByType('message', {
101
- filter: `${escapeUnsafeComplexMatcher(filter) ?? ''} $object:${vm.uuid} !${RAW_ALARM_FILTER}`,
102
- limit,
103
- });
100
+ const messages = this.getMessagesForObject(id, { filter, limit });
104
101
  return this.sendObjects(Object.values(messages), req, 'messages');
105
102
  }
103
+ /**
104
+ * @example id "d68fca2c-41e6-be87-d790-105c1642a090"
105
+ * @example fields "id,status,properties"
106
+ * @example filter "status:failure"
107
+ * @example limit 42
108
+ */
109
+ async getVmSnapshotTasks(req, id, fields, ndjson, filter, limit) {
110
+ const tasks = await this.getTasksForObject(id, { filter, limit });
111
+ return this.sendObjects(Object.values(tasks), req, 'tasks');
112
+ }
113
+ /**
114
+ * @example id "d68fca2c-41e6-be87-d790-105c1642a090"
115
+ * @example tag "from-rest-api"
116
+ */
117
+ async putVmSnapshotTag(id, tag) {
118
+ const vmSnapshot = this.getXapiObject(id);
119
+ await vmSnapshot.$call('add_tags', tag);
120
+ }
121
+ /**
122
+ * @example id "d68fca2c-41e6-be87-d790-105c1642a090"
123
+ * @example tag "from-rest-api"
124
+ */
125
+ async deleteVmSnapshotTag(id, tag) {
126
+ const vmSnapshot = this.getXapiObject(id);
127
+ await vmSnapshot.$call('remove_tags', tag);
128
+ }
106
129
  };
107
130
  __decorate([
108
131
  Example(vmSnapshotIds),
@@ -175,9 +198,37 @@ __decorate([
175
198
  __param(4, Query()),
176
199
  __param(5, Query())
177
200
  ], VmSnapshotController.prototype, "getVmSnapshotsMessages", null);
201
+ __decorate([
202
+ Example(taskIds),
203
+ Example(partialTasks),
204
+ Get('{id}/tasks'),
205
+ Tags('tasks'),
206
+ Response(notFoundResp.status, notFoundResp.description),
207
+ __param(0, Request()),
208
+ __param(1, Path()),
209
+ __param(2, Query()),
210
+ __param(3, Query()),
211
+ __param(4, Query()),
212
+ __param(5, Query())
213
+ ], VmSnapshotController.prototype, "getVmSnapshotTasks", null);
214
+ __decorate([
215
+ Put('{id}/tags/{tag}'),
216
+ SuccessResponse(noContentResp.status, noContentResp.description),
217
+ Response(notFoundResp.status, notFoundResp.description),
218
+ __param(0, Path()),
219
+ __param(1, Path())
220
+ ], VmSnapshotController.prototype, "putVmSnapshotTag", null);
221
+ __decorate([
222
+ Delete('{id}/tags/{tag}'),
223
+ SuccessResponse(noContentResp.status, noContentResp.description),
224
+ Response(notFoundResp.status, notFoundResp.description),
225
+ __param(0, Path()),
226
+ __param(1, Path())
227
+ ], VmSnapshotController.prototype, "deleteVmSnapshotTag", null);
178
228
  VmSnapshotController = __decorate([
179
229
  Route('vm-snapshots'),
180
230
  Security('*'),
231
+ Response(badRequestResp.status, badRequestResp.description),
181
232
  Response(unauthorizedResp.status, unauthorizedResp.description),
182
233
  Tags('vms'),
183
234
  provide(VmSnapshotController),
@@ -7,18 +7,19 @@ 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, Security, Query, Request, Response, Route, Tags, Path, Delete, SuccessResponse } from 'tsoa';
10
+ import { Example, Get, Security, Query, Request, Response, Route, Tags, Path, Delete, SuccessResponse, Put } from 'tsoa';
11
11
  import { inject } from 'inversify';
12
12
  import { provide } from 'inversify-binding-decorators';
13
- import { AlarmService, RAW_ALARM_FILTER } from '../alarms/alarm.service.mjs';
13
+ import { AlarmService } from '../alarms/alarm.service.mjs';
14
14
  import { escapeUnsafeComplexMatcher, limitAndFilterArray } from '../helpers/utils.helper.mjs';
15
15
  import { genericAlarmsExample } from '../open-api/oa-examples/alarm.oa-example.mjs';
16
- import { forbiddenOperationResp, incorrectStateResp, noContentResp, notFoundResp, unauthorizedResp, } from '../open-api/common/response.common.mjs';
16
+ import { badRequestResp, forbiddenOperationResp, incorrectStateResp, noContentResp, notFoundResp, unauthorizedResp, } from '../open-api/common/response.common.mjs';
17
17
  import { RestApi } from '../rest-api/rest-api.mjs';
18
18
  import { XapiXoController } from '../abstract-classes/xapi-xo-controller.mjs';
19
19
  import { partialVmTemplates, vmTemplate, vmTemplateIds, vmTemplateVdis, } from '../open-api/oa-examples/vm-template.oa-example.mjs';
20
20
  import { VmService } from '../vms/vm.service.mjs';
21
21
  import { messageIds, partialMessages } from '../open-api/oa-examples/message.oa-example.mjs';
22
+ import { partialTasks, taskIds } from '../open-api/oa-examples/task.oa-example.mjs';
22
23
  let VmTemplateController = class VmTemplateController extends XapiXoController {
23
24
  #alarmService;
24
25
  #vmService;
@@ -95,13 +96,35 @@ let VmTemplateController = class VmTemplateController extends XapiXoController {
95
96
  * @example limit 42
96
97
  */
97
98
  getVmTemplateMessages(req, id, fields, ndjson, filter, limit) {
98
- const vmTemplate = this.getObject(id);
99
- const messages = this.restApi.getObjectsByType('message', {
100
- filter: `${escapeUnsafeComplexMatcher(filter) ?? ''} $object:${vmTemplate.uuid} !${RAW_ALARM_FILTER}`,
101
- limit,
102
- });
99
+ const messages = this.getMessagesForObject(id, { filter, limit });
103
100
  return this.sendObjects(Object.values(messages), req, 'messages');
104
101
  }
102
+ /**
103
+ * @example id "613f541c-4bed-fc77-7ca8-2db6b68f079c"
104
+ * @example fields "id,status,properties"
105
+ * @example filter "status:failure"
106
+ * @example limit 42
107
+ */
108
+ async getVmTemplateTasks(req, id, fields, ndjson, filter, limit) {
109
+ const tasks = await this.getTasksForObject(id, { filter, limit });
110
+ return this.sendObjects(Object.values(tasks), req, 'tasks');
111
+ }
112
+ /**
113
+ * @example id "613f541c-4bed-fc77-7ca8-2db6b68f079c"
114
+ * @example tag "from-rest-api"
115
+ */
116
+ async putVmTemplateTag(id, tag) {
117
+ const vmTemplate = this.getXapiObject(id);
118
+ await vmTemplate.$call('add_tags', tag);
119
+ }
120
+ /**
121
+ * @example id "613f541c-4bed-fc77-7ca8-2db6b68f079c"
122
+ * @example tag "from-rest-api"
123
+ */
124
+ async deleteVmTemplateTag(id, tag) {
125
+ const vmTemplate = this.getXapiObject(id);
126
+ await vmTemplate.$call('remove_tags', tag);
127
+ }
105
128
  };
106
129
  __decorate([
107
130
  Example(vmTemplateIds),
@@ -174,9 +197,37 @@ __decorate([
174
197
  __param(4, Query()),
175
198
  __param(5, Query())
176
199
  ], VmTemplateController.prototype, "getVmTemplateMessages", null);
200
+ __decorate([
201
+ Example(taskIds),
202
+ Example(partialTasks),
203
+ Get('{id}/tasks'),
204
+ Tags('tasks'),
205
+ Response(notFoundResp.status, notFoundResp.description),
206
+ __param(0, Request()),
207
+ __param(1, Path()),
208
+ __param(2, Query()),
209
+ __param(3, Query()),
210
+ __param(4, Query()),
211
+ __param(5, Query())
212
+ ], VmTemplateController.prototype, "getVmTemplateTasks", null);
213
+ __decorate([
214
+ Put('{id}/tags/{tag}'),
215
+ SuccessResponse(noContentResp.status, noContentResp.description),
216
+ Response(notFoundResp.status, notFoundResp.description),
217
+ __param(0, Path()),
218
+ __param(1, Path())
219
+ ], VmTemplateController.prototype, "putVmTemplateTag", null);
220
+ __decorate([
221
+ Delete('{id}/tags/{tag}'),
222
+ SuccessResponse(noContentResp.status, noContentResp.description),
223
+ Response(notFoundResp.status, notFoundResp.description),
224
+ __param(0, Path()),
225
+ __param(1, Path())
226
+ ], VmTemplateController.prototype, "deleteVmTemplateTag", null);
177
227
  VmTemplateController = __decorate([
178
228
  Route('vm-templates'),
179
229
  Security('*'),
230
+ Response(badRequestResp.status, badRequestResp.description),
180
231
  Response(unauthorizedResp.status, unauthorizedResp.description),
181
232
  Tags('vms'),
182
233
  provide(VmTemplateController),
@@ -11,8 +11,8 @@ import { Example, Get, Path, Post, Query, Request, Response, Route, Security, Ta
11
11
  import { inject } from 'inversify';
12
12
  import { incorrectState, invalidParameters } from 'xo-common/api-errors.js';
13
13
  import { provide } from 'inversify-binding-decorators';
14
- import { AlarmService, RAW_ALARM_FILTER } from '../alarms/alarm.service.mjs';
15
- import { asynchronousActionResp, createdResp, forbiddenOperationResp, incorrectStateResp, internalServerErrorResp, noContentResp, notFoundResp, unauthorizedResp, } from '../open-api/common/response.common.mjs';
14
+ import { AlarmService } from '../alarms/alarm.service.mjs';
15
+ import { asynchronousActionResp, badRequestResp, createdResp, forbiddenOperationResp, incorrectStateResp, internalServerErrorResp, noContentResp, notFoundResp, unauthorizedResp, } from '../open-api/common/response.common.mjs';
16
16
  import { BASE_URL } from '../index.mjs';
17
17
  import { escapeUnsafeComplexMatcher, limitAndFilterArray } from '../helpers/utils.helper.mjs';
18
18
  import { genericAlarmsExample } from '../open-api/oa-examples/alarm.oa-example.mjs';
@@ -21,7 +21,6 @@ import { RestApi } from '../rest-api/rest-api.mjs';
21
21
  import { partialTasks, taskIds, taskLocation } from '../open-api/oa-examples/task.oa-example.mjs';
22
22
  import { XapiXoController } from '../abstract-classes/xapi-xo-controller.mjs';
23
23
  import { VmService } from './vm.service.mjs';
24
- import { TaskService } from '../tasks/task.service.mjs';
25
24
  import { BackupJobService } from '../backup-jobs/backup-job.service.mjs';
26
25
  import { partialVmBackupJobs, vmBackupJobIds } from '../open-api/oa-examples/backup-job.oa-example.mjs';
27
26
  import { messageIds, partialMessages } from '../open-api/oa-examples/message.oa-example.mjs';
@@ -29,13 +28,11 @@ const IGNORED_VDIS_TAG = '[NOSNAP]';
29
28
  let VmController = class VmController extends XapiXoController {
30
29
  #alarmService;
31
30
  #vmService;
32
- #taskService;
33
31
  #backupJobService;
34
- constructor(restApi, alarmService, vmService, taskService, backupJobService) {
32
+ constructor(restApi, alarmService, vmService, backupJobService) {
35
33
  super('VM', restApi);
36
34
  this.#alarmService = alarmService;
37
35
  this.#vmService = vmService;
38
- this.#taskService = taskService;
39
36
  this.#backupJobService = backupJobService;
40
37
  }
41
38
  /**
@@ -376,11 +373,7 @@ let VmController = class VmController extends XapiXoController {
376
373
  * @example limit 42
377
374
  */
378
375
  getVmMessages(req, id, fields, ndjson, filter, limit) {
379
- const vm = this.getObject(id);
380
- const messages = this.restApi.getObjectsByType('message', {
381
- filter: `${escapeUnsafeComplexMatcher(filter) ?? ''} $object:${vm.uuid} !${RAW_ALARM_FILTER}`,
382
- limit,
383
- });
376
+ const messages = this.getMessagesForObject(id, { filter, limit });
384
377
  return this.sendObjects(Object.values(messages), req, 'messages');
385
378
  }
386
379
  /**
@@ -390,12 +383,24 @@ let VmController = class VmController extends XapiXoController {
390
383
  * @example limit 42
391
384
  */
392
385
  async getVmTasks(req, id, fields, ndjson, filter, limit) {
393
- const vm = this.getObject(id);
394
- const tasks = await this.#taskService.getTasks({
395
- filter: `${escapeUnsafeComplexMatcher(filter) ?? ''} |(properties:objectId:${vm.id} properties:params:id:${vm.id})`,
396
- limit,
397
- });
398
- return this.sendObjects(tasks, req, 'tasks');
386
+ const tasks = await this.getTasksForObject(id, { filter, limit });
387
+ return this.sendObjects(Object.values(tasks), req, 'tasks');
388
+ }
389
+ /**
390
+ * @example id "613f541c-4bed-fc77-7ca8-2db6b68f079c"
391
+ * @example tag "from-rest-api"
392
+ */
393
+ async putVmTag(id, tag) {
394
+ const vm = this.getXapiObject(id);
395
+ await vm.$call('add_tags', tag);
396
+ }
397
+ /**
398
+ * @example id "613f541c-4bed-fc77-7ca8-2db6b68f079c"
399
+ * @example tag "from-rest-api"
400
+ */
401
+ async deleteVmTag(id, tag) {
402
+ const vm = this.getXapiObject(id);
403
+ await vm.$call('remove_tags', tag);
399
404
  }
400
405
  };
401
406
  __decorate([
@@ -617,9 +622,24 @@ __decorate([
617
622
  __param(4, Query()),
618
623
  __param(5, Query())
619
624
  ], VmController.prototype, "getVmTasks", null);
625
+ __decorate([
626
+ Put('{id}/tags/{tag}'),
627
+ SuccessResponse(noContentResp.status, noContentResp.description),
628
+ Response(notFoundResp.status, notFoundResp.description),
629
+ __param(0, Path()),
630
+ __param(1, Path())
631
+ ], VmController.prototype, "putVmTag", null);
632
+ __decorate([
633
+ Delete('{id}/tags/{tag}'),
634
+ SuccessResponse(noContentResp.status, noContentResp.description),
635
+ Response(notFoundResp.status, notFoundResp.description),
636
+ __param(0, Path()),
637
+ __param(1, Path())
638
+ ], VmController.prototype, "deleteVmTag", null);
620
639
  VmController = __decorate([
621
640
  Route('vms'),
622
641
  Security('*'),
642
+ Response(badRequestResp.status, badRequestResp.description),
623
643
  Response(unauthorizedResp.status, unauthorizedResp.description),
624
644
  Tags('vms')
625
645
  // the `provide` decorator is mandatory on class that injects/receives dependencies.
@@ -629,7 +649,6 @@ VmController = __decorate([
629
649
  __param(0, inject(RestApi)),
630
650
  __param(1, inject(AlarmService)),
631
651
  __param(2, inject(VmService)),
632
- __param(3, inject(TaskService)),
633
- __param(4, inject(BackupJobService))
652
+ __param(3, inject(BackupJobService))
634
653
  ], VmController);
635
654
  export { VmController };
@@ -11,7 +11,7 @@ import { Controller, Example, Get, Query, Request, Response, Route, Security, Ta
11
11
  import { inject } from 'inversify';
12
12
  import { PassThrough } from 'node:stream';
13
13
  import { provide } from 'inversify-binding-decorators';
14
- import { unauthorizedResp } from '../open-api/common/response.common.mjs';
14
+ import { badRequestResp, unauthorizedResp } from '../open-api/common/response.common.mjs';
15
15
  import { xoaDashboard } from '../open-api/oa-examples/xoa.oa-example.mjs';
16
16
  import { XoaService } from './xoa.service.mjs';
17
17
  import { NDJSON_CONTENT_TYPE } from '../helpers/utils.helper.mjs';
@@ -47,6 +47,7 @@ __decorate([
47
47
  XoaController = __decorate([
48
48
  Route(''),
49
49
  Security('*'),
50
+ Response(badRequestResp.status, badRequestResp.description),
50
51
  Response(unauthorizedResp.status, unauthorizedResp.description),
51
52
  Tags('xoa'),
52
53
  provide(XoaController),