@xen-orchestra/rest-api 0.29.0 → 0.30.1

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 (53) hide show
  1. package/README.md +101 -1
  2. package/dist/abstract-classes/base-controller.mjs +20 -3
  3. package/dist/abstract-classes/listener.mjs +116 -12
  4. package/dist/acl-privileges/acl-privilege.controller.mjs +172 -0
  5. package/dist/acl-roles/acl-role.controller.mjs +384 -0
  6. package/dist/alarms/alarm.controller.mjs +22 -9
  7. package/dist/alarms/alarm.service.mjs +8 -0
  8. package/dist/backup-archives/backup-archive.controller.mjs +30 -21
  9. package/dist/backup-archives/backup-archive.service.mjs +21 -0
  10. package/dist/backup-jobs/backup-job.controller.mjs +59 -15
  11. package/dist/backup-jobs/backup-job.service.mjs +7 -0
  12. package/dist/backup-logs/backup-log.controller.mjs +25 -11
  13. package/dist/backup-logs/backup-log.service.mjs +19 -0
  14. package/dist/backup-repositories/backup-repositories.controller.mjs +21 -3
  15. package/dist/events/event.class.mjs +24 -9
  16. package/dist/events/event.controller.mjs +3 -0
  17. package/dist/events/event.service.mjs +2 -1
  18. package/dist/groups/group.controller.mjs +90 -6
  19. package/dist/hosts/host.controller.mjs +78 -7
  20. package/dist/ioc/ioc.mjs +13 -4
  21. package/dist/messages/message.controller.mjs +29 -8
  22. package/dist/middlewares/acl.middleware.mjs +206 -0
  23. package/dist/middlewares/authentication.middleware.mjs +15 -6
  24. package/dist/middlewares/tsoa-to-xo-error.middleware.mjs +19 -1
  25. package/dist/networks/network.controller.mjs +60 -9
  26. package/dist/open-api/oa-examples/acl-privilege.oa-example.mjs +25 -0
  27. package/dist/open-api/oa-examples/acl-role.oa-example.mjs +22 -0
  28. package/dist/open-api/oa-examples/backup-archive.oa-example.mjs +6 -6
  29. package/dist/open-api/oa-examples/common.oa-example.mjs +3 -0
  30. package/dist/open-api/routes/routes.js +676 -132
  31. package/dist/pbds/pbd.controller.mjs +17 -3
  32. package/dist/pcis/pci.controller.mjs +16 -3
  33. package/dist/pgpus/pgpu.controller.mjs +16 -3
  34. package/dist/pifs/pif.controller.mjs +44 -8
  35. package/dist/pools/pool.controller.mjs +154 -9
  36. package/dist/proxies/proxy.controller.mjs +22 -4
  37. package/dist/restore-logs/restore-log.controller.mjs +36 -19
  38. package/dist/schedules/schedule.controller.mjs +33 -3
  39. package/dist/servers/server.controller.mjs +65 -5
  40. package/dist/sms/sm.controller.mjs +14 -2
  41. package/dist/srs/sr.controller.mjs +62 -10
  42. package/dist/tasks/task.controller.mjs +75 -11
  43. package/dist/users/user.controller.mjs +115 -16
  44. package/dist/vbds/vbd.controller.mjs +65 -31
  45. package/dist/vdi-snapshots/vdi-snapshot.controller.mjs +36 -6
  46. package/dist/vdis/vdi.controller.mjs +69 -8
  47. package/dist/vifs/vif.controller.mjs +43 -7
  48. package/dist/vm-controller/vm-controller.controller.mjs +62 -9
  49. package/dist/vm-snapshots/vm-snapshot.controller.mjs +70 -8
  50. package/dist/vm-templates/vm-template.controller.mjs +71 -8
  51. package/dist/vms/vm.controller.mjs +164 -12
  52. package/open-api/spec/swagger.json +10907 -3265
  53. package/package.json +4 -3
@@ -7,7 +7,7 @@ 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, Put, Query, Request, Response, Route, Security, SuccessResponse, Tags } from 'tsoa';
10
+ import { Delete, Example, Get, Path, Put, Query, Request, Response, Route, Security, SuccessResponse, Tags, Middlewares, } from 'tsoa';
11
11
  import { inject } from 'inversify';
12
12
  import { AlarmService } from '../alarms/alarm.service.mjs';
13
13
  import { escapeUnsafeComplexMatcher, limitAndFilterArray } from '../helpers/utils.helper.mjs';
@@ -16,6 +16,7 @@ import { partialTasks, taskIds } from '../open-api/oa-examples/task.oa-example.m
16
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
+ import { acl } from '../middlewares/acl.middleware.mjs';
19
20
  import { provide } from 'inversify-binding-decorators';
20
21
  import { partialVmSnapshots, vmSnapshot, vmSnapshotIds, vmSnapshotVdis, } from '../open-api/oa-examples/vm-snapshot.oa-example.mjs';
21
22
  import { VmService } from '../vms/vm.service.mjs';
@@ -29,18 +30,26 @@ let VmSnapshotController = class VmSnapshotController extends XapiXoController {
29
30
  this.#vmService = vmService;
30
31
  }
31
32
  /**
33
+ * Returns all VM snapshots that match the following privilege:
34
+ * - resource: vm-snapshot, action: read
32
35
  *
33
36
  * @example fields "uuid,snapshot_time,$snapshot_of"
34
37
  * @example filter "snapshot_time:>1725020038"
35
38
  * @example limit 42
36
39
  */
37
40
  getVmSnapshots(req, fields, ndjson, markdown, filter, limit) {
38
- return this.sendObjects(Object.values(this.getObjects({ filter, limit })), req);
41
+ return this.sendObjects(Object.values(this.getObjects({ filter })), req, {
42
+ limit,
43
+ privilege: { action: 'read', resource: 'vm-snapshot' },
44
+ });
39
45
  }
40
46
  /**
41
47
  *
42
48
  * Export VM-snapshot. Compress is only used for XVA format
43
49
  *
50
+ * Required privilege:
51
+ * - resource: vm-snapshot, action: export
52
+ *
44
53
  * @example id "d68fca2c-41e6-be87-d790-105c1642a090"
45
54
  */
46
55
  async exportVmSnapshot(req, id, format, compress) {
@@ -54,12 +63,18 @@ let VmSnapshotController = class VmSnapshotController extends XapiXoController {
54
63
  return stream;
55
64
  }
56
65
  /**
66
+ * Required privilege:
67
+ * - resource: vm-snapshot, action: read
68
+ *
57
69
  * @example id "d68fca2c-41e6-be87-d790-105c1642a090"
58
70
  */
59
71
  getVmSnapshot(id) {
60
72
  return this.getObject(id);
61
73
  }
62
74
  /**
75
+ * Required privilege:
76
+ * - resource: vm-snapshot, action: delete
77
+ *
63
78
  * @example id "d68fca2c-41e6-be87-d790-105c1642a090"
64
79
  */
65
80
  async deleteVmSnapshot(id) {
@@ -67,6 +82,9 @@ let VmSnapshotController = class VmSnapshotController extends XapiXoController {
67
82
  await xapiVmSnapshot.$xapi.VM_destroy(xapiVmSnapshot.$ref);
68
83
  }
69
84
  /**
85
+ * Returns all alarms that match the following privilege:
86
+ * - resource: alarm, action: read
87
+ *
70
88
  * @example id "d68fca2c-41e6-be87-d790-105c1642a090"
71
89
  * @example fields "id,time"
72
90
  * @example filter "time:>1747053793"
@@ -76,11 +94,17 @@ let VmSnapshotController = class VmSnapshotController extends XapiXoController {
76
94
  const vmSnapshot = this.getObject(id);
77
95
  const alarms = this.#alarmService.getAlarms({
78
96
  filter: `${escapeUnsafeComplexMatcher(filter) ?? ''} object:uuid:${vmSnapshot.uuid}`,
97
+ });
98
+ return this.sendObjects(Object.values(alarms), req, {
99
+ path: 'alarms',
79
100
  limit,
101
+ privilege: { action: 'read', resource: 'alarm' },
80
102
  });
81
- return this.sendObjects(Object.values(alarms), req, 'alarms');
82
103
  }
83
104
  /**
105
+ * Returns all VDIs that match the following privilege:
106
+ * - resource: vdi, action: read
107
+ *
84
108
  * @example id "d68fca2c-41e6-be87-d790-105c1642a090"
85
109
  * @example fields "VDI_type,id,name_label"
86
110
  * @example filter "VDI_type:user"
@@ -88,29 +112,50 @@ let VmSnapshotController = class VmSnapshotController extends XapiXoController {
88
112
  */
89
113
  getVmSnapshotVdis(req, id, fields, ndjson, markdown, filter, limit) {
90
114
  const vdis = this.#vmService.getVmVdis(id, 'VM-snapshot');
91
- return this.sendObjects(limitAndFilterArray(vdis, { filter, limit }), req, obj => obj.type.toLowerCase() + 's');
115
+ return this.sendObjects(limitAndFilterArray(vdis, { filter }), req, {
116
+ path: obj => obj.type.toLowerCase() + 's',
117
+ limit,
118
+ privilege: { action: 'read', resource: 'vdi' },
119
+ });
92
120
  }
93
121
  /**
122
+ * Returns all messages that match the following privilege:
123
+ * - resource: message, action: read
124
+ *
94
125
  * @example id "d68fca2c-41e6-be87-d790-105c1642a090"
95
126
  * @example fields "name,id,$object"
96
127
  * @example filter "name:VM_STARTED"
97
128
  * @example limit 42
98
129
  */
99
130
  getVmSnapshotsMessages(req, id, fields, ndjson, markdown, filter, limit) {
100
- const messages = this.getMessagesForObject(id, { filter, limit });
101
- return this.sendObjects(Object.values(messages), req, 'messages');
131
+ const messages = this.getMessagesForObject(id, { filter });
132
+ return this.sendObjects(Object.values(messages), req, {
133
+ path: 'messages',
134
+ limit,
135
+ privilege: { action: 'read', resource: 'message' },
136
+ });
102
137
  }
103
138
  /**
139
+ * Returns all tasks that match the following privilege:
140
+ * - resource: task, action: read
141
+ *
104
142
  * @example id "d68fca2c-41e6-be87-d790-105c1642a090"
105
143
  * @example fields "id,status,properties"
106
144
  * @example filter "status:failure"
107
145
  * @example limit 42
108
146
  */
109
147
  async getVmSnapshotTasks(req, id, fields, ndjson, markdown, filter, limit) {
110
- const tasks = await this.getTasksForObject(id, { filter, limit });
111
- return this.sendObjects(Object.values(tasks), req, 'tasks');
148
+ const tasks = await this.getTasksForObject(id, { filter });
149
+ return this.sendObjects(Object.values(tasks), req, {
150
+ path: 'tasks',
151
+ limit,
152
+ privilege: { action: 'read', resource: 'task' },
153
+ });
112
154
  }
113
155
  /**
156
+ * Required privilege:
157
+ * - resource: vm-snapshot, action: update:tags
158
+ *
114
159
  * @example id "d68fca2c-41e6-be87-d790-105c1642a090"
115
160
  * @example tag "from-rest-api"
116
161
  */
@@ -119,6 +164,9 @@ let VmSnapshotController = class VmSnapshotController extends XapiXoController {
119
164
  await vmSnapshot.$call('add_tags', tag);
120
165
  }
121
166
  /**
167
+ * Required privilege:
168
+ * - resource: vm-snapshot, action: update:tags
169
+ *
122
170
  * @example id "d68fca2c-41e6-be87-d790-105c1642a090"
123
171
  * @example tag "from-rest-api"
124
172
  */
@@ -131,6 +179,7 @@ __decorate([
131
179
  Example(vmSnapshotIds),
132
180
  Example(partialVmSnapshots),
133
181
  Get(''),
182
+ Security('*', ['acl']),
134
183
  __param(0, Request()),
135
184
  __param(1, Query()),
136
185
  __param(2, Query()),
@@ -140,7 +189,9 @@ __decorate([
140
189
  ], VmSnapshotController.prototype, "getVmSnapshots", null);
141
190
  __decorate([
142
191
  Get('{id}.{format}'),
192
+ Middlewares(acl({ resource: 'vm-snapshot', action: 'export', objectId: 'params.id' })),
143
193
  SuccessResponse(200, 'Download started', 'application/octet-stream'),
194
+ Response(forbiddenOperationResp.status, forbiddenOperationResp.description),
144
195
  Response(notFoundResp.status, notFoundResp.description),
145
196
  Response(422, 'Invalid format, Invalid compress'),
146
197
  __param(0, Request()),
@@ -151,11 +202,14 @@ __decorate([
151
202
  __decorate([
152
203
  Example(vmSnapshot),
153
204
  Get('{id}'),
205
+ Middlewares(acl({ resource: 'vm-snapshot', action: 'read', objectId: 'params.id' })),
206
+ Response(forbiddenOperationResp.status, forbiddenOperationResp.description),
154
207
  Response(notFoundResp.status, notFoundResp.description),
155
208
  __param(0, Path())
156
209
  ], VmSnapshotController.prototype, "getVmSnapshot", null);
157
210
  __decorate([
158
211
  Delete('{id}'),
212
+ Middlewares(acl({ resource: 'vm-snapshot', action: 'delete', objectId: 'params.id' })),
159
213
  SuccessResponse(noContentResp.status, noContentResp.description),
160
214
  Response(notFoundResp.status, notFoundResp.description),
161
215
  Response(forbiddenOperationResp.status, forbiddenOperationResp.description),
@@ -165,6 +219,7 @@ __decorate([
165
219
  __decorate([
166
220
  Example(genericAlarmsExample),
167
221
  Get('{id}/alarms'),
222
+ Security('*', ['acl']),
168
223
  Tags('alarms'),
169
224
  Response(notFoundResp.status, notFoundResp.description),
170
225
  __param(0, Request()),
@@ -178,6 +233,7 @@ __decorate([
178
233
  __decorate([
179
234
  Example(vmSnapshotVdis),
180
235
  Get('{id}/vdis'),
236
+ Security('*', ['acl']),
181
237
  Tags('vdis'),
182
238
  Response(notFoundResp.status, notFoundResp.description),
183
239
  __param(0, Request()),
@@ -192,6 +248,7 @@ __decorate([
192
248
  Example(messageIds),
193
249
  Example(partialMessages),
194
250
  Get('{id}/messages'),
251
+ Security('*', ['acl']),
195
252
  Tags('messages'),
196
253
  Response(notFoundResp.status, notFoundResp.description),
197
254
  __param(0, Request()),
@@ -206,6 +263,7 @@ __decorate([
206
263
  Example(taskIds),
207
264
  Example(partialTasks),
208
265
  Get('{id}/tasks'),
266
+ Security('*', ['acl']),
209
267
  Tags('tasks'),
210
268
  Response(notFoundResp.status, notFoundResp.description),
211
269
  __param(0, Request()),
@@ -218,14 +276,18 @@ __decorate([
218
276
  ], VmSnapshotController.prototype, "getVmSnapshotTasks", null);
219
277
  __decorate([
220
278
  Put('{id}/tags/{tag}'),
279
+ Middlewares(acl({ resource: 'vm-snapshot', action: 'update:tags', objectId: 'params.id' })),
221
280
  SuccessResponse(noContentResp.status, noContentResp.description),
281
+ Response(forbiddenOperationResp.status, forbiddenOperationResp.description),
222
282
  Response(notFoundResp.status, notFoundResp.description),
223
283
  __param(0, Path()),
224
284
  __param(1, Path())
225
285
  ], VmSnapshotController.prototype, "putVmSnapshotTag", null);
226
286
  __decorate([
227
287
  Delete('{id}/tags/{tag}'),
288
+ Middlewares(acl({ resource: 'vm-snapshot', action: 'update:tags', objectId: 'params.id' })),
228
289
  SuccessResponse(noContentResp.status, noContentResp.description),
290
+ Response(forbiddenOperationResp.status, forbiddenOperationResp.description),
229
291
  Response(notFoundResp.status, notFoundResp.description),
230
292
  __param(0, Path()),
231
293
  __param(1, Path())
@@ -7,7 +7,7 @@ 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, Put } from 'tsoa';
10
+ import { Example, Get, Security, Query, Request, Response, Route, Tags, Path, Delete, SuccessResponse, Put, Middlewares, } 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';
@@ -16,6 +16,7 @@ import { genericAlarmsExample } from '../open-api/oa-examples/alarm.oa-example.m
16
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
+ import { acl } from '../middlewares/acl.middleware.mjs';
19
20
  import { partialVmTemplates, vmTemplate, vmTemplateIds, vmTemplateVdis, } from '../open-api/oa-examples/vm-template.oa-example.mjs';
20
21
  import { VmService } from '../vms/vm.service.mjs';
21
22
  import { messageIds, partialMessages } from '../open-api/oa-examples/message.oa-example.mjs';
@@ -29,17 +30,26 @@ let VmTemplateController = class VmTemplateController extends XapiXoController {
29
30
  this.#vmService = vmService;
30
31
  }
31
32
  /**
33
+ * Returns all VM templates that match the following privilege:
34
+ * - resource: vm-template, action: read
35
+ *
32
36
  * @example fields "id,isDefaultTemplate,name_label"
33
37
  * @example filter "isDefaultTemplate?"
34
38
  * @example limit 42
35
39
  * */
36
40
  getVmTemplates(req, fields, ndjson, markdown, filter, limit) {
37
- return this.sendObjects(Object.values(this.getObjects({ filter, limit })), req);
41
+ return this.sendObjects(Object.values(this.getObjects({ filter })), req, {
42
+ limit,
43
+ privilege: { action: 'read', resource: 'vm-template' },
44
+ });
38
45
  }
39
46
  /**
40
47
  *
41
48
  * Export VM-template. Compress is only used for XVA format
42
49
  *
50
+ * Required privilege:
51
+ * - resource: vm-template, action: export
52
+ *
43
53
  * @example id "b7569d99-30f8-178a-7d94-801de3e29b5b-f873abe0-b138-4995-8f6f-498b423d234d"
44
54
  */
45
55
  async exportVmTemplate(req, id, format, compress) {
@@ -53,12 +63,18 @@ let VmTemplateController = class VmTemplateController extends XapiXoController {
53
63
  return stream;
54
64
  }
55
65
  /**
66
+ * Required privilege:
67
+ * - resource: vm-template, action: read
68
+ *
56
69
  * @example id "b7569d99-30f8-178a-7d94-801de3e29b5b-f873abe0-b138-4995-8f6f-498b423d234d"
57
70
  * */
58
71
  getVmTemplate(id) {
59
72
  return this.getObject(id);
60
73
  }
61
74
  /**
75
+ * Required privilege:
76
+ * - resource: vm-template, action: delete
77
+ *
62
78
  * @example id "6d50ba76-0f11-1ff1-4f6a-b502afc31b8e"
63
79
  */
64
80
  async deleteVmTemplate(id) {
@@ -66,6 +82,9 @@ let VmTemplateController = class VmTemplateController extends XapiXoController {
66
82
  await xapiVmTemplate.$xapi.VM_destroy(xapiVmTemplate.$ref);
67
83
  }
68
84
  /**
85
+ * Returns all alarms that match the following privilege:
86
+ * - resource: alarm, action: read
87
+ *
69
88
  * @example id "b7569d99-30f8-178a-7d94-801de3e29b5b-f873abe0-b138-4995-8f6f-498b423d234d"
70
89
  * @example fields "id,time"
71
90
  * @example filter "time:>1747053793"
@@ -75,11 +94,17 @@ let VmTemplateController = class VmTemplateController extends XapiXoController {
75
94
  const vmTemplate = this.getObject(id);
76
95
  const alarms = this.#alarmService.getAlarms({
77
96
  filter: `${escapeUnsafeComplexMatcher(filter) ?? ''} object:uuid:${vmTemplate.uuid}`,
97
+ });
98
+ return this.sendObjects(Object.values(alarms), req, {
99
+ path: 'alarms',
78
100
  limit,
101
+ privilege: { action: 'read', resource: 'alarm' },
79
102
  });
80
- return this.sendObjects(Object.values(alarms), req, 'alarms');
81
103
  }
82
104
  /**
105
+ * Returns all VDIs that match the following privilege:
106
+ * - resource: vdi, action: read
107
+ *
83
108
  * @example id "6d50ba76-0f11-1ff1-4f6a-b502afc31b8e"
84
109
  * @example fields "VDI_type,id,name_label"
85
110
  * @example filter "VDI_type:user"
@@ -87,29 +112,50 @@ let VmTemplateController = class VmTemplateController extends XapiXoController {
87
112
  */
88
113
  getVmTemplateVdis(req, id, fields, ndjson, markdown, filter, limit) {
89
114
  const vdis = this.#vmService.getVmVdis(id, 'VM-template');
90
- return this.sendObjects(limitAndFilterArray(vdis, { filter, limit }), req, obj => obj.type.toLowerCase() + 's');
115
+ return this.sendObjects(limitAndFilterArray(vdis, { filter }), req, {
116
+ path: obj => obj.type.toLowerCase() + 's',
117
+ limit,
118
+ privilege: { action: 'read', resource: 'vdi' },
119
+ });
91
120
  }
92
121
  /**
122
+ * Returns all messages that match the following privilege:
123
+ * - resource: message, action: read
124
+ *
93
125
  * @example id "6d50ba76-0f11-1ff1-4f6a-b502afc31b8e"
94
126
  * @example fields "name,id,$object"
95
127
  * @example filter "name:VM_STARTED"
96
128
  * @example limit 42
97
129
  */
98
130
  getVmTemplateMessages(req, id, fields, ndjson, markdown, filter, limit) {
99
- const messages = this.getMessagesForObject(id, { filter, limit });
100
- return this.sendObjects(Object.values(messages), req, 'messages');
131
+ const messages = this.getMessagesForObject(id, { filter });
132
+ return this.sendObjects(Object.values(messages), req, {
133
+ path: 'messages',
134
+ limit,
135
+ privilege: { action: 'read', resource: 'message' },
136
+ });
101
137
  }
102
138
  /**
139
+ * Returns all tasks that match the following privilege:
140
+ * - resource: task, action: read
141
+ *
103
142
  * @example id "613f541c-4bed-fc77-7ca8-2db6b68f079c"
104
143
  * @example fields "id,status,properties"
105
144
  * @example filter "status:failure"
106
145
  * @example limit 42
107
146
  */
108
147
  async getVmTemplateTasks(req, id, fields, ndjson, markdown, filter, limit) {
109
- const tasks = await this.getTasksForObject(id, { filter, limit });
110
- return this.sendObjects(Object.values(tasks), req, 'tasks');
148
+ const tasks = await this.getTasksForObject(id, { filter });
149
+ return this.sendObjects(Object.values(tasks), req, {
150
+ path: 'tasks',
151
+ limit,
152
+ privilege: { action: 'read', resource: 'task' },
153
+ });
111
154
  }
112
155
  /**
156
+ * Required privilege:
157
+ * - resource: vm-template, action: update:tags
158
+ *
113
159
  * @example id "613f541c-4bed-fc77-7ca8-2db6b68f079c"
114
160
  * @example tag "from-rest-api"
115
161
  */
@@ -118,6 +164,9 @@ let VmTemplateController = class VmTemplateController extends XapiXoController {
118
164
  await vmTemplate.$call('add_tags', tag);
119
165
  }
120
166
  /**
167
+ * Required privilege:
168
+ * - resource: vm-template, action: update:tags
169
+ *
121
170
  * @example id "613f541c-4bed-fc77-7ca8-2db6b68f079c"
122
171
  * @example tag "from-rest-api"
123
172
  */
@@ -130,6 +179,7 @@ __decorate([
130
179
  Example(vmTemplateIds),
131
180
  Example(partialVmTemplates),
132
181
  Get(''),
182
+ Security('*', ['acl']),
133
183
  __param(0, Request()),
134
184
  __param(1, Query()),
135
185
  __param(2, Query()),
@@ -139,7 +189,9 @@ __decorate([
139
189
  ], VmTemplateController.prototype, "getVmTemplates", null);
140
190
  __decorate([
141
191
  Get('{id}.{format}'),
192
+ Middlewares(acl({ resource: 'vm-template', action: 'export', objectId: 'params.id' })),
142
193
  SuccessResponse(200, 'Download started', 'application/octet-stream'),
194
+ Response(forbiddenOperationResp.status, forbiddenOperationResp.description),
143
195
  Response(notFoundResp.status, notFoundResp.description),
144
196
  Response(422, 'Invalid format, Invalid compress'),
145
197
  __param(0, Request()),
@@ -150,11 +202,14 @@ __decorate([
150
202
  __decorate([
151
203
  Example(vmTemplate),
152
204
  Get('{id}'),
205
+ Middlewares(acl({ resource: 'vm-template', action: 'read', objectId: 'params.id' })),
206
+ Response(forbiddenOperationResp.status, forbiddenOperationResp.description),
153
207
  Response(notFoundResp.status, notFoundResp.description),
154
208
  __param(0, Path())
155
209
  ], VmTemplateController.prototype, "getVmTemplate", null);
156
210
  __decorate([
157
211
  Delete('{id}'),
212
+ Middlewares(acl({ resource: 'vm-template', action: 'delete', objectId: 'params.id' })),
158
213
  SuccessResponse(noContentResp.status, noContentResp.description),
159
214
  Response(notFoundResp.status, notFoundResp.description),
160
215
  Response(forbiddenOperationResp.status, forbiddenOperationResp.description),
@@ -164,6 +219,7 @@ __decorate([
164
219
  __decorate([
165
220
  Example(genericAlarmsExample),
166
221
  Get('{id}/alarms'),
222
+ Security('*', ['acl']),
167
223
  Tags('alarms'),
168
224
  Response(notFoundResp.status, notFoundResp.description),
169
225
  __param(0, Request()),
@@ -177,6 +233,7 @@ __decorate([
177
233
  __decorate([
178
234
  Example(vmTemplateVdis),
179
235
  Get('{id}/vdis'),
236
+ Security('*', ['acl']),
180
237
  Tags('vdis'),
181
238
  Response(notFoundResp.status, notFoundResp.description),
182
239
  __param(0, Request()),
@@ -191,6 +248,7 @@ __decorate([
191
248
  Example(messageIds),
192
249
  Example(partialMessages),
193
250
  Get('{id}/messages'),
251
+ Security('*', ['acl']),
194
252
  Tags('messages'),
195
253
  Response(notFoundResp.status, notFoundResp.description),
196
254
  __param(0, Request()),
@@ -205,6 +263,7 @@ __decorate([
205
263
  Example(taskIds),
206
264
  Example(partialTasks),
207
265
  Get('{id}/tasks'),
266
+ Security('*', ['acl']),
208
267
  Tags('tasks'),
209
268
  Response(notFoundResp.status, notFoundResp.description),
210
269
  __param(0, Request()),
@@ -217,14 +276,18 @@ __decorate([
217
276
  ], VmTemplateController.prototype, "getVmTemplateTasks", null);
218
277
  __decorate([
219
278
  Put('{id}/tags/{tag}'),
279
+ Middlewares(acl({ resource: 'vm-template', action: 'update:tags', objectId: 'params.id' })),
220
280
  SuccessResponse(noContentResp.status, noContentResp.description),
281
+ Response(forbiddenOperationResp.status, forbiddenOperationResp.description),
221
282
  Response(notFoundResp.status, notFoundResp.description),
222
283
  __param(0, Path()),
223
284
  __param(1, Path())
224
285
  ], VmTemplateController.prototype, "putVmTemplateTag", null);
225
286
  __decorate([
226
287
  Delete('{id}/tags/{tag}'),
288
+ Middlewares(acl({ resource: 'vm-template', action: 'update:tags', objectId: 'params.id' })),
227
289
  SuccessResponse(noContentResp.status, noContentResp.description),
290
+ Response(forbiddenOperationResp.status, forbiddenOperationResp.description),
228
291
  Response(notFoundResp.status, notFoundResp.description),
229
292
  __param(0, Path()),
230
293
  __param(1, Path())