@xen-orchestra/rest-api 0.28.2 → 0.30.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/README.md +108 -1
- package/dist/abstract-classes/base-controller.mjs +28 -3
- package/dist/abstract-classes/listener.mjs +124 -15
- package/dist/acl-privileges/acl-privilege.controller.mjs +172 -0
- package/dist/acl-roles/acl-role.controller.mjs +384 -0
- package/dist/alarms/alarm.controller.mjs +25 -11
- package/dist/alarms/alarm.service.mjs +8 -0
- package/dist/backup-archives/backup-archive.controller.mjs +33 -23
- package/dist/backup-archives/backup-archive.service.mjs +21 -0
- package/dist/backup-jobs/backup-job.controller.mjs +74 -25
- package/dist/backup-jobs/backup-job.service.mjs +7 -0
- package/dist/backup-logs/backup-log.controller.mjs +28 -13
- package/dist/backup-logs/backup-log.service.mjs +19 -0
- package/dist/backup-repositories/backup-repositories.controller.mjs +24 -5
- package/dist/events/event.class.mjs +36 -18
- package/dist/events/event.controller.mjs +3 -0
- package/dist/events/event.service.mjs +4 -4
- package/dist/groups/group.controller.mjs +99 -12
- package/dist/helpers/markdown.helper.mjs +20 -0
- package/dist/helpers/object-wrapper.helper.mjs +3 -3
- package/dist/hosts/host.controller.mjs +90 -15
- package/dist/ioc/ioc.mjs +13 -4
- package/dist/messages/message.controller.mjs +32 -10
- package/dist/middlewares/acl.middleware.mjs +202 -0
- package/dist/middlewares/authentication.middleware.mjs +15 -6
- package/dist/middlewares/tsoa-to-xo-error.middleware.mjs +19 -1
- package/dist/networks/network.controller.mjs +72 -17
- package/dist/open-api/oa-examples/acl-privilege.oa-example.mjs +25 -0
- package/dist/open-api/oa-examples/acl-role.oa-example.mjs +22 -0
- package/dist/open-api/oa-examples/backup-archive.oa-example.mjs +6 -6
- package/dist/open-api/oa-examples/common.oa-example.mjs +3 -0
- package/dist/open-api/routes/routes.js +856 -172
- package/dist/pbds/pbd.controller.mjs +20 -5
- package/dist/pcis/pci.controller.mjs +19 -5
- package/dist/pgpus/pgpu.controller.mjs +19 -5
- package/dist/pifs/pif.controller.mjs +56 -16
- package/dist/pools/pool.controller.mjs +166 -17
- package/dist/proxies/proxy.controller.mjs +25 -6
- package/dist/restore-logs/restore-log.controller.mjs +42 -23
- package/dist/schedules/schedule.controller.mjs +36 -5
- package/dist/servers/server.controller.mjs +71 -9
- package/dist/sms/sm.controller.mjs +17 -4
- package/dist/srs/sr.controller.mjs +74 -18
- package/dist/tasks/task.controller.mjs +74 -13
- package/dist/users/user.controller.mjs +124 -22
- package/dist/vbds/vbd.controller.mjs +76 -38
- package/dist/vdi-snapshots/vdi-snapshot.controller.mjs +48 -14
- package/dist/vdis/vdi.controller.mjs +81 -16
- package/dist/vifs/vif.controller.mjs +118 -16
- package/dist/vm-controller/vm-controller.controller.mjs +77 -19
- package/dist/vm-snapshots/vm-snapshot.controller.mjs +85 -18
- package/dist/vm-templates/vm-template.controller.mjs +86 -18
- package/dist/vms/vm.controller.mjs +182 -24
- package/open-api/spec/swagger.json +12112 -3537
- package/package.json +12 -11
|
@@ -10,17 +10,18 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
10
10
|
import { Body, Delete, Example, Get, Middlewares, Path, Post, Query, Request, Response, Route, Security, SuccessResponse, Tags, } from 'tsoa';
|
|
11
11
|
import { inject } from 'inversify';
|
|
12
12
|
import { json } from 'express';
|
|
13
|
+
import { acl } from '../middlewares/acl.middleware.mjs';
|
|
13
14
|
import { escapeUnsafeComplexMatcher } from '../helpers/utils.helper.mjs';
|
|
14
15
|
import { provide } from 'inversify-binding-decorators';
|
|
15
16
|
import { RestApi } from '../rest-api/rest-api.mjs';
|
|
16
|
-
import { badRequestResp, createdResp, internalServerErrorResp, invalidParameters as invalidParametersResp, noContentResp, notFoundResp, unauthorizedResp, } from '../open-api/common/response.common.mjs';
|
|
17
|
+
import { asynchronousActionResp, badRequestResp, createdResp, internalServerErrorResp, invalidParameters as invalidParametersResp, noContentResp, forbiddenOperationResp, notFoundResp, unauthorizedResp, } from '../open-api/common/response.common.mjs';
|
|
17
18
|
import { invalidParameters } from 'xo-common/api-errors.js';
|
|
18
19
|
import { XapiXoController } from '../abstract-classes/xapi-xo-controller.mjs';
|
|
19
20
|
import { partialVifs, vif, vifId, vifIds } from '../open-api/oa-examples/vif.oa-example.mjs';
|
|
20
21
|
import { genericAlarmsExample } from '../open-api/oa-examples/alarm.oa-example.mjs';
|
|
21
22
|
import { AlarmService } from '../alarms/alarm.service.mjs';
|
|
22
23
|
import { messageIds, partialMessages } from '../open-api/oa-examples/message.oa-example.mjs';
|
|
23
|
-
import { taskIds, partialTasks } from '../open-api/oa-examples/task.oa-example.mjs';
|
|
24
|
+
import { taskIds, partialTasks, taskLocation } from '../open-api/oa-examples/task.oa-example.mjs';
|
|
24
25
|
let VifController = class VifController extends XapiXoController {
|
|
25
26
|
#alarmService;
|
|
26
27
|
constructor(restApi, alarmService) {
|
|
@@ -28,52 +29,81 @@ let VifController = class VifController extends XapiXoController {
|
|
|
28
29
|
this.#alarmService = alarmService;
|
|
29
30
|
}
|
|
30
31
|
/**
|
|
32
|
+
* Returns all VIFs that match the following privilege:
|
|
33
|
+
* - resource: vif, action: read
|
|
34
|
+
*
|
|
31
35
|
* @example fields "attached,id,device"
|
|
32
36
|
* @example filter "attached?"
|
|
33
37
|
* @example limit 42
|
|
34
38
|
*/
|
|
35
|
-
getVifs(req, fields, ndjson, filter, limit) {
|
|
36
|
-
return this.sendObjects(Object.values(this.getObjects({ filter
|
|
39
|
+
getVifs(req, fields, ndjson, markdown, filter, limit) {
|
|
40
|
+
return this.sendObjects(Object.values(this.getObjects({ filter })), req, {
|
|
41
|
+
limit,
|
|
42
|
+
privilege: { action: 'read', resource: 'vif' },
|
|
43
|
+
});
|
|
37
44
|
}
|
|
38
45
|
/**
|
|
46
|
+
* Required privilege:
|
|
47
|
+
* - resource: vif, action: read
|
|
48
|
+
*
|
|
39
49
|
* @example id "f028c5d4-578a-332c-394e-087aaca32dd3"
|
|
40
50
|
*/
|
|
41
51
|
getVif(id) {
|
|
42
52
|
return this.getObject(id);
|
|
43
53
|
}
|
|
44
54
|
/**
|
|
55
|
+
* Returns all alarms that match the following privilege:
|
|
56
|
+
* - resource: alarm, action: read
|
|
57
|
+
*
|
|
45
58
|
* @example id "f028c5d4-578a-332c-394e-087aaca32dd3"
|
|
46
59
|
* @example fields "id,time"
|
|
47
60
|
* @example filter "time:>1747053793"
|
|
48
61
|
* @example limit 42
|
|
49
62
|
*/
|
|
50
|
-
getVifAlarms(req, id, fields, ndjson, filter, limit) {
|
|
63
|
+
getVifAlarms(req, id, fields, ndjson, markdown, filter, limit) {
|
|
51
64
|
const vif = this.getObject(id);
|
|
52
65
|
const alarms = this.#alarmService.getAlarms({
|
|
53
66
|
filter: `${escapeUnsafeComplexMatcher(filter) ?? ''} object:uuid:${vif.uuid}`,
|
|
67
|
+
});
|
|
68
|
+
return this.sendObjects(Object.values(alarms), req, {
|
|
69
|
+
path: 'alarms',
|
|
54
70
|
limit,
|
|
71
|
+
privilege: { action: 'read', resource: 'alarm' },
|
|
55
72
|
});
|
|
56
|
-
return this.sendObjects(Object.values(alarms), req, 'alarms');
|
|
57
73
|
}
|
|
58
74
|
/**
|
|
75
|
+
* Returns all messages that match the following privilege:
|
|
76
|
+
* - resource: message, action: read
|
|
77
|
+
*
|
|
59
78
|
* @example id "f028c5d4-578a-332c-394e-087aaca32dd3"
|
|
60
79
|
* @example fields "name,id,$object"
|
|
61
80
|
* @example filter "name:VM_STARTED"
|
|
62
81
|
* @example limit 42
|
|
63
82
|
*/
|
|
64
|
-
getVifMessages(req, id, fields, ndjson, filter, limit) {
|
|
65
|
-
const messages = this.getMessagesForObject(id, { filter
|
|
66
|
-
return this.sendObjects(Object.values(messages), req,
|
|
83
|
+
getVifMessages(req, id, fields, ndjson, markdown, filter, limit) {
|
|
84
|
+
const messages = this.getMessagesForObject(id, { filter });
|
|
85
|
+
return this.sendObjects(Object.values(messages), req, {
|
|
86
|
+
path: 'messages',
|
|
87
|
+
limit,
|
|
88
|
+
privilege: { action: 'read', resource: 'message' },
|
|
89
|
+
});
|
|
67
90
|
}
|
|
68
91
|
/**
|
|
92
|
+
* Returns all tasks that match the following privilege:
|
|
93
|
+
* - resource: task, action: read
|
|
94
|
+
*
|
|
69
95
|
* @example id "f028c5d4-578a-332c-394e-087aaca32dd3"
|
|
70
96
|
* @example fields "id,status,properties"
|
|
71
97
|
* @example filter "status:failure"
|
|
72
98
|
* @example limit 42
|
|
73
99
|
*/
|
|
74
|
-
async getVifTasks(req, id, fields, ndjson, filter, limit) {
|
|
75
|
-
const tasks = await this.getTasksForObject(id, { filter
|
|
76
|
-
return this.sendObjects(Object.values(tasks), req,
|
|
100
|
+
async getVifTasks(req, id, fields, ndjson, markdown, filter, limit) {
|
|
101
|
+
const tasks = await this.getTasksForObject(id, { filter });
|
|
102
|
+
return this.sendObjects(Object.values(tasks), req, {
|
|
103
|
+
path: 'tasks',
|
|
104
|
+
limit,
|
|
105
|
+
privilege: { action: 'read', resource: 'task' },
|
|
106
|
+
});
|
|
77
107
|
}
|
|
78
108
|
/**
|
|
79
109
|
* @example body {
|
|
@@ -106,26 +136,73 @@ let VifController = class VifController extends XapiXoController {
|
|
|
106
136
|
const xapi = this.getXapi(id);
|
|
107
137
|
await xapi.deleteVif(id);
|
|
108
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Hotplug the VIF, dynamically attaching it to the running VM
|
|
141
|
+
* Requires PV drivers to be installed on the VM
|
|
142
|
+
*
|
|
143
|
+
* @example id "f07ab729-c0e8-721c-45ec-f11276377030"
|
|
144
|
+
*/
|
|
145
|
+
async connectVif(id, sync) {
|
|
146
|
+
const vifId = id;
|
|
147
|
+
const action = async () => {
|
|
148
|
+
const xapi = this.getXapi(vifId);
|
|
149
|
+
await xapi.connectVif(vifId);
|
|
150
|
+
};
|
|
151
|
+
return this.createAction(action, {
|
|
152
|
+
sync,
|
|
153
|
+
statusCode: noContentResp.status,
|
|
154
|
+
taskProperties: {
|
|
155
|
+
name: 'connect VIF',
|
|
156
|
+
objectId: vifId,
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Hot-unplug the VIF, dynamically detaching it from the running VM
|
|
162
|
+
* Requires PV drivers to be installed on the VM
|
|
163
|
+
*
|
|
164
|
+
* @example id "f07ab729-c0e8-721c-45ec-f11276377030"
|
|
165
|
+
*/
|
|
166
|
+
async disconnectVif(id, sync) {
|
|
167
|
+
const vifId = id;
|
|
168
|
+
const action = async () => {
|
|
169
|
+
const xapi = this.getXapi(vifId);
|
|
170
|
+
await xapi.disconnectVif(vifId);
|
|
171
|
+
};
|
|
172
|
+
return this.createAction(action, {
|
|
173
|
+
sync,
|
|
174
|
+
statusCode: noContentResp.status,
|
|
175
|
+
taskProperties: {
|
|
176
|
+
name: 'disconnect VIF',
|
|
177
|
+
objectId: vifId,
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
}
|
|
109
181
|
};
|
|
110
182
|
__decorate([
|
|
111
183
|
Example(vifIds),
|
|
112
184
|
Example(partialVifs),
|
|
113
185
|
Get(''),
|
|
186
|
+
Security('*', ['acl']),
|
|
114
187
|
__param(0, Request()),
|
|
115
188
|
__param(1, Query()),
|
|
116
189
|
__param(2, Query()),
|
|
117
190
|
__param(3, Query()),
|
|
118
|
-
__param(4, Query())
|
|
191
|
+
__param(4, Query()),
|
|
192
|
+
__param(5, Query())
|
|
119
193
|
], VifController.prototype, "getVifs", null);
|
|
120
194
|
__decorate([
|
|
121
195
|
Example(vif),
|
|
122
196
|
Get('{id}'),
|
|
197
|
+
Middlewares(acl({ resource: 'vif', action: 'read', objectId: 'params.id' })),
|
|
198
|
+
Response(forbiddenOperationResp.status, forbiddenOperationResp.description),
|
|
123
199
|
Response(notFoundResp.status, notFoundResp.description),
|
|
124
200
|
__param(0, Path())
|
|
125
201
|
], VifController.prototype, "getVif", null);
|
|
126
202
|
__decorate([
|
|
127
203
|
Example(genericAlarmsExample),
|
|
128
204
|
Get('{id}/alarms'),
|
|
205
|
+
Security('*', ['acl']),
|
|
129
206
|
Tags('alarms'),
|
|
130
207
|
Response(notFoundResp.status, notFoundResp.description),
|
|
131
208
|
__param(0, Request()),
|
|
@@ -133,12 +210,14 @@ __decorate([
|
|
|
133
210
|
__param(2, Query()),
|
|
134
211
|
__param(3, Query()),
|
|
135
212
|
__param(4, Query()),
|
|
136
|
-
__param(5, Query())
|
|
213
|
+
__param(5, Query()),
|
|
214
|
+
__param(6, Query())
|
|
137
215
|
], VifController.prototype, "getVifAlarms", null);
|
|
138
216
|
__decorate([
|
|
139
217
|
Example(messageIds),
|
|
140
218
|
Example(partialMessages),
|
|
141
219
|
Get('{id}/messages'),
|
|
220
|
+
Security('*', ['acl']),
|
|
142
221
|
Tags('messages'),
|
|
143
222
|
Response(notFoundResp.status, notFoundResp.description),
|
|
144
223
|
__param(0, Request()),
|
|
@@ -146,12 +225,14 @@ __decorate([
|
|
|
146
225
|
__param(2, Query()),
|
|
147
226
|
__param(3, Query()),
|
|
148
227
|
__param(4, Query()),
|
|
149
|
-
__param(5, Query())
|
|
228
|
+
__param(5, Query()),
|
|
229
|
+
__param(6, Query())
|
|
150
230
|
], VifController.prototype, "getVifMessages", null);
|
|
151
231
|
__decorate([
|
|
152
232
|
Example(taskIds),
|
|
153
233
|
Example(partialTasks),
|
|
154
234
|
Get('{id}/tasks'),
|
|
235
|
+
Security('*', ['acl']),
|
|
155
236
|
Tags('tasks'),
|
|
156
237
|
Response(notFoundResp.status, notFoundResp.description),
|
|
157
238
|
__param(0, Request()),
|
|
@@ -159,7 +240,8 @@ __decorate([
|
|
|
159
240
|
__param(2, Query()),
|
|
160
241
|
__param(3, Query()),
|
|
161
242
|
__param(4, Query()),
|
|
162
|
-
__param(5, Query())
|
|
243
|
+
__param(5, Query()),
|
|
244
|
+
__param(6, Query())
|
|
163
245
|
], VifController.prototype, "getVifTasks", null);
|
|
164
246
|
__decorate([
|
|
165
247
|
Example(vifId),
|
|
@@ -178,6 +260,26 @@ __decorate([
|
|
|
178
260
|
Response(internalServerErrorResp.status, internalServerErrorResp.description),
|
|
179
261
|
__param(0, Path())
|
|
180
262
|
], VifController.prototype, "destroyVif", null);
|
|
263
|
+
__decorate([
|
|
264
|
+
Example(taskLocation),
|
|
265
|
+
Post('{id}/actions/connect'),
|
|
266
|
+
SuccessResponse(asynchronousActionResp.status, asynchronousActionResp.description),
|
|
267
|
+
Response(noContentResp.status, noContentResp.description),
|
|
268
|
+
Response(notFoundResp.status, notFoundResp.description),
|
|
269
|
+
Response(internalServerErrorResp.status, internalServerErrorResp.description),
|
|
270
|
+
__param(0, Path()),
|
|
271
|
+
__param(1, Query())
|
|
272
|
+
], VifController.prototype, "connectVif", null);
|
|
273
|
+
__decorate([
|
|
274
|
+
Example(taskLocation),
|
|
275
|
+
Post('{id}/actions/disconnect'),
|
|
276
|
+
SuccessResponse(asynchronousActionResp.status, asynchronousActionResp.description),
|
|
277
|
+
Response(noContentResp.status, noContentResp.description),
|
|
278
|
+
Response(notFoundResp.status, notFoundResp.description),
|
|
279
|
+
Response(internalServerErrorResp.status, internalServerErrorResp.description),
|
|
280
|
+
__param(0, Path()),
|
|
281
|
+
__param(1, Query())
|
|
282
|
+
], VifController.prototype, "disconnectVif", null);
|
|
181
283
|
VifController = __decorate([
|
|
182
284
|
Route('vifs'),
|
|
183
285
|
Security('*'),
|
|
@@ -10,11 +10,12 @@ 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 { Delete, Example, Get, Path, Put, Query, Request, Response, Route, Security, SuccessResponse, Tags } from 'tsoa';
|
|
13
|
+
import { Delete, Example, Get, Path, Put, Query, Request, Response, Route, Security, SuccessResponse, Tags, Middlewares } from 'tsoa';
|
|
14
14
|
import { AlarmService } from '../alarms/alarm.service.mjs';
|
|
15
15
|
import { escapeUnsafeComplexMatcher, limitAndFilterArray } from '../helpers/utils.helper.mjs';
|
|
16
|
+
import { acl } from '../middlewares/acl.middleware.mjs';
|
|
16
17
|
import { genericAlarmsExample } from '../open-api/oa-examples/alarm.oa-example.mjs';
|
|
17
|
-
import { badRequestResp, noContentResp, notFoundResp, unauthorizedResp, } from '../open-api/common/response.common.mjs';
|
|
18
|
+
import { badRequestResp, forbiddenOperationResp, noContentResp, notFoundResp, unauthorizedResp, } from '../open-api/common/response.common.mjs';
|
|
18
19
|
import { provide } from 'inversify-binding-decorators';
|
|
19
20
|
import { partialVmControllers, vmController, vmControllerIds, vmControllerVdis, } from '../open-api/oa-examples/vm-controller.oa-example.mjs';
|
|
20
21
|
import { VmService } from '../vms/vm.service.mjs';
|
|
@@ -29,65 +30,103 @@ let VmControllerController = class VmControllerController extends XapiXoControll
|
|
|
29
30
|
this.#vmService = vmService;
|
|
30
31
|
}
|
|
31
32
|
/**
|
|
33
|
+
* Returns all VM controllers that match the following privilege:
|
|
34
|
+
* - resource: vm-controller, action: read
|
|
32
35
|
*
|
|
33
36
|
* @example fields "type,uuid"
|
|
34
37
|
* @example filter "power_state:Running"
|
|
35
38
|
* @example limit 42
|
|
36
39
|
*/
|
|
37
|
-
getVmControllers(req, fields, ndjson, filter, limit) {
|
|
38
|
-
return this.sendObjects(Object.values(this.getObjects({ filter
|
|
40
|
+
getVmControllers(req, fields, ndjson, markdown, filter, limit) {
|
|
41
|
+
return this.sendObjects(Object.values(this.getObjects({ filter })), req, {
|
|
42
|
+
limit,
|
|
43
|
+
privilege: { action: 'read', resource: 'vm-controller' },
|
|
44
|
+
});
|
|
39
45
|
}
|
|
40
46
|
/**
|
|
47
|
+
* Required privilege:
|
|
48
|
+
* - resource: vm-controller, action: read
|
|
49
|
+
*
|
|
41
50
|
* @example id "9b4775bd-9493-490a-9afa-f786a44caa4f"
|
|
42
51
|
*/
|
|
43
52
|
getVmController(id) {
|
|
44
53
|
return this.getObject(id);
|
|
45
54
|
}
|
|
46
55
|
/**
|
|
56
|
+
* Returns all alarms that match the following privilege:
|
|
57
|
+
* - resource: alarm, action: read
|
|
58
|
+
*
|
|
47
59
|
* @example id "9b4775bd-9493-490a-9afa-f786a44caa4f"
|
|
48
60
|
* @example fields "id,time"
|
|
49
61
|
* @example filter "time:>1747053793"
|
|
50
62
|
* @example limit 42
|
|
51
63
|
*/
|
|
52
|
-
getVmControllerAlarms(req, id, fields, ndjson, filter, limit) {
|
|
64
|
+
getVmControllerAlarms(req, id, fields, ndjson, markdown, filter, limit) {
|
|
53
65
|
const vmController = this.getObject(id);
|
|
54
66
|
const alarms = this.#alarmService.getAlarms({
|
|
55
67
|
filter: `${escapeUnsafeComplexMatcher(filter) ?? ''} object:uuid:${vmController.uuid}`,
|
|
68
|
+
});
|
|
69
|
+
return this.sendObjects(Object.values(alarms), req, {
|
|
70
|
+
path: 'alarms',
|
|
56
71
|
limit,
|
|
72
|
+
privilege: { action: 'read', resource: 'alarm' },
|
|
57
73
|
});
|
|
58
|
-
return this.sendObjects(Object.values(alarms), req, 'alarms');
|
|
59
74
|
}
|
|
60
75
|
/**
|
|
76
|
+
* Returns all VDIs that match the following privilege:
|
|
77
|
+
* - resource: vdi, action: read
|
|
78
|
+
*
|
|
61
79
|
* @example id "9b4775bd-9493-490a-9afa-f786a44caa4f"
|
|
62
80
|
* @example fields "VDI_type,id,name_label"
|
|
63
81
|
* @example filter "VDI_type:user"
|
|
64
82
|
* @example limit 42
|
|
65
83
|
*/
|
|
66
|
-
getVmControllerVdis(req, id, fields, ndjson, filter, limit) {
|
|
84
|
+
getVmControllerVdis(req, id, fields, ndjson, markdown, filter, limit) {
|
|
67
85
|
const vdis = this.#vmService.getVmVdis(id, 'VM-controller');
|
|
68
|
-
return this.sendObjects(limitAndFilterArray(vdis, { filter
|
|
86
|
+
return this.sendObjects(limitAndFilterArray(vdis, { filter }), req, {
|
|
87
|
+
path: obj => obj.type.toLowerCase() + 's',
|
|
88
|
+
limit,
|
|
89
|
+
privilege: { action: 'read', resource: 'vdi' },
|
|
90
|
+
});
|
|
69
91
|
}
|
|
70
92
|
/**
|
|
93
|
+
* Returns all messages that match the following privilege:
|
|
94
|
+
* - resource: message, action: read
|
|
95
|
+
*
|
|
71
96
|
* @example id "9b4775bd-9493-490a-9afa-f786a44caa4f"
|
|
72
97
|
* @example fields "name,id,$object"
|
|
73
98
|
* @example filter "name:VM_STARTED"
|
|
74
99
|
* @example limit 42
|
|
75
100
|
*/
|
|
76
|
-
getVmControllerMessages(req, id, fields, ndjson, filter, limit) {
|
|
77
|
-
const messages = this.getMessagesForObject(id, { filter
|
|
78
|
-
return this.sendObjects(Object.values(messages), req,
|
|
101
|
+
getVmControllerMessages(req, id, fields, ndjson, markdown, filter, limit) {
|
|
102
|
+
const messages = this.getMessagesForObject(id, { filter });
|
|
103
|
+
return this.sendObjects(Object.values(messages), req, {
|
|
104
|
+
path: 'messages',
|
|
105
|
+
limit,
|
|
106
|
+
privilege: { action: 'read', resource: 'message' },
|
|
107
|
+
});
|
|
79
108
|
}
|
|
80
109
|
/**
|
|
110
|
+
* Returns all tasks that match the following privilege:
|
|
111
|
+
* - resource: task, action: read
|
|
112
|
+
*
|
|
81
113
|
* @example id "9b4775bd-9493-490a-9afa-f786a44caa4f"
|
|
82
114
|
* @example fields "id,status,properties"
|
|
83
115
|
* @example filter "status:failure"
|
|
84
116
|
* @example limit 42
|
|
85
117
|
*/
|
|
86
|
-
async getVmControllerTasks(req, id, fields, ndjson, filter, limit) {
|
|
87
|
-
const tasks = await this.getTasksForObject(id, { filter
|
|
88
|
-
return this.sendObjects(Object.values(tasks), req,
|
|
118
|
+
async getVmControllerTasks(req, id, fields, ndjson, markdown, filter, limit) {
|
|
119
|
+
const tasks = await this.getTasksForObject(id, { filter });
|
|
120
|
+
return this.sendObjects(Object.values(tasks), req, {
|
|
121
|
+
path: 'tasks',
|
|
122
|
+
limit,
|
|
123
|
+
privilege: { action: 'read', resource: 'task' },
|
|
124
|
+
});
|
|
89
125
|
}
|
|
90
126
|
/**
|
|
127
|
+
* Required privilege:
|
|
128
|
+
* - resource: vm-controller, action: update:tags
|
|
129
|
+
*
|
|
91
130
|
* @example id "9b4775bd-9493-490a-9afa-f786a44caa4f"
|
|
92
131
|
* @example tag "from-rest-api"
|
|
93
132
|
*/
|
|
@@ -96,6 +135,9 @@ let VmControllerController = class VmControllerController extends XapiXoControll
|
|
|
96
135
|
await vmController.$call('add_tags', tag);
|
|
97
136
|
}
|
|
98
137
|
/**
|
|
138
|
+
* Required privilege:
|
|
139
|
+
* - resource: vm-controller, action: update:tags
|
|
140
|
+
*
|
|
99
141
|
* @example id "9b4775bd-9493-490a-9afa-f786a44caa4f"
|
|
100
142
|
* @example tag "from-rest-api"
|
|
101
143
|
*/
|
|
@@ -108,21 +150,26 @@ __decorate([
|
|
|
108
150
|
Example(vmControllerIds),
|
|
109
151
|
Example(partialVmControllers),
|
|
110
152
|
Get(''),
|
|
153
|
+
Security('*', ['acl']),
|
|
111
154
|
__param(0, Request()),
|
|
112
155
|
__param(1, Query()),
|
|
113
156
|
__param(2, Query()),
|
|
114
157
|
__param(3, Query()),
|
|
115
|
-
__param(4, Query())
|
|
158
|
+
__param(4, Query()),
|
|
159
|
+
__param(5, Query())
|
|
116
160
|
], VmControllerController.prototype, "getVmControllers", null);
|
|
117
161
|
__decorate([
|
|
118
162
|
Example(vmController),
|
|
119
163
|
Get('{id}'),
|
|
164
|
+
Middlewares(acl({ resource: 'vm-controller', action: 'read', objectId: 'params.id' })),
|
|
120
165
|
Response(notFoundResp.status, notFoundResp.description),
|
|
166
|
+
Response(forbiddenOperationResp.status, forbiddenOperationResp.description),
|
|
121
167
|
__param(0, Path())
|
|
122
168
|
], VmControllerController.prototype, "getVmController", null);
|
|
123
169
|
__decorate([
|
|
124
170
|
Example(genericAlarmsExample),
|
|
125
171
|
Get('{id}/alarms'),
|
|
172
|
+
Security('*', ['acl']),
|
|
126
173
|
Tags('alarms'),
|
|
127
174
|
Response(notFoundResp.status, notFoundResp.description),
|
|
128
175
|
__param(0, Request()),
|
|
@@ -130,11 +177,13 @@ __decorate([
|
|
|
130
177
|
__param(2, Query()),
|
|
131
178
|
__param(3, Query()),
|
|
132
179
|
__param(4, Query()),
|
|
133
|
-
__param(5, Query())
|
|
180
|
+
__param(5, Query()),
|
|
181
|
+
__param(6, Query())
|
|
134
182
|
], VmControllerController.prototype, "getVmControllerAlarms", null);
|
|
135
183
|
__decorate([
|
|
136
184
|
Example(vmControllerVdis),
|
|
137
185
|
Get('{id}/vdis'),
|
|
186
|
+
Security('*', ['acl']),
|
|
138
187
|
Tags('vdis'),
|
|
139
188
|
Response(notFoundResp.status, notFoundResp.description),
|
|
140
189
|
__param(0, Request()),
|
|
@@ -142,12 +191,14 @@ __decorate([
|
|
|
142
191
|
__param(2, Query()),
|
|
143
192
|
__param(3, Query()),
|
|
144
193
|
__param(4, Query()),
|
|
145
|
-
__param(5, Query())
|
|
194
|
+
__param(5, Query()),
|
|
195
|
+
__param(6, Query())
|
|
146
196
|
], VmControllerController.prototype, "getVmControllerVdis", null);
|
|
147
197
|
__decorate([
|
|
148
198
|
Example(messageIds),
|
|
149
199
|
Example(partialMessages),
|
|
150
200
|
Get('{id}/messages'),
|
|
201
|
+
Security('*', ['acl']),
|
|
151
202
|
Tags('messages'),
|
|
152
203
|
Response(notFoundResp.status, notFoundResp.description),
|
|
153
204
|
__param(0, Request()),
|
|
@@ -155,12 +206,14 @@ __decorate([
|
|
|
155
206
|
__param(2, Query()),
|
|
156
207
|
__param(3, Query()),
|
|
157
208
|
__param(4, Query()),
|
|
158
|
-
__param(5, Query())
|
|
209
|
+
__param(5, Query()),
|
|
210
|
+
__param(6, Query())
|
|
159
211
|
], VmControllerController.prototype, "getVmControllerMessages", null);
|
|
160
212
|
__decorate([
|
|
161
213
|
Example(taskIds),
|
|
162
214
|
Example(partialTasks),
|
|
163
215
|
Get('{id}/tasks'),
|
|
216
|
+
Security('*', ['acl']),
|
|
164
217
|
Tags('tasks'),
|
|
165
218
|
Response(notFoundResp.status, notFoundResp.description),
|
|
166
219
|
__param(0, Request()),
|
|
@@ -168,18 +221,23 @@ __decorate([
|
|
|
168
221
|
__param(2, Query()),
|
|
169
222
|
__param(3, Query()),
|
|
170
223
|
__param(4, Query()),
|
|
171
|
-
__param(5, Query())
|
|
224
|
+
__param(5, Query()),
|
|
225
|
+
__param(6, Query())
|
|
172
226
|
], VmControllerController.prototype, "getVmControllerTasks", null);
|
|
173
227
|
__decorate([
|
|
174
228
|
Put('{id}/tags/{tag}'),
|
|
229
|
+
Middlewares(acl({ resource: 'vm-controller', action: 'update:tags', objectId: 'params.id' })),
|
|
175
230
|
SuccessResponse(noContentResp.status, noContentResp.description),
|
|
231
|
+
Response(forbiddenOperationResp.status, forbiddenOperationResp.description),
|
|
176
232
|
Response(notFoundResp.status, notFoundResp.description),
|
|
177
233
|
__param(0, Path()),
|
|
178
234
|
__param(1, Path())
|
|
179
235
|
], VmControllerController.prototype, "putVmControllerTag", null);
|
|
180
236
|
__decorate([
|
|
181
237
|
Delete('{id}/tags/{tag}'),
|
|
238
|
+
Middlewares(acl({ resource: 'vm-controller', action: 'update:tags', objectId: 'params.id' })),
|
|
182
239
|
SuccessResponse(noContentResp.status, noContentResp.description),
|
|
240
|
+
Response(forbiddenOperationResp.status, forbiddenOperationResp.description),
|
|
183
241
|
Response(notFoundResp.status, notFoundResp.description),
|
|
184
242
|
__param(0, Path()),
|
|
185
243
|
__param(1, Path())
|