@xen-orchestra/rest-api 0.16.0 → 0.18.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.
@@ -1,4 +1,6 @@
1
1
  import { BaseController } from './base-controller.mjs';
2
+ import { escapeUnsafeComplexMatcher } from '../helpers/utils.helper.mjs';
3
+ import { RAW_ALARM_FILTER } from '../alarms/alarm.service.mjs';
2
4
  export class XapiXoController extends BaseController {
3
5
  #type;
4
6
  constructor(type, restApi) {
@@ -14,4 +16,12 @@ export class XapiXoController extends BaseController {
14
16
  getXapiObject(maybeId) {
15
17
  return this.restApi.getXapiObject(maybeId, this.#type);
16
18
  }
19
+ getMessagesForObject(id, { filter, limit } = {}) {
20
+ const object = this.getObject(id);
21
+ const messages = this.restApi.getObjectsByType('message', {
22
+ filter: `${escapeUnsafeComplexMatcher(filter) ?? ''} $object:${object.uuid} !${RAW_ALARM_FILTER}`,
23
+ limit,
24
+ });
25
+ return messages;
26
+ }
17
27
  }
@@ -19,6 +19,7 @@ import { RestApi } from '../rest-api/rest-api.mjs';
19
19
  import { XapiXoController } from '../abstract-classes/xapi-xo-controller.mjs';
20
20
  import { featureUnauthorized, internalServerErrorResp, notFoundResp, unauthorizedResp, } from '../open-api/common/response.common.mjs';
21
21
  import { HostService } from './host.service.mjs';
22
+ import { messageIds, partialMessages } from '../open-api/oa-examples/message.oa-example.mjs';
22
23
  let HostController = class HostController extends XapiXoController {
23
24
  #alarmService;
24
25
  #hostService;
@@ -117,6 +118,16 @@ let HostController = class HostController extends XapiXoController {
117
118
  const { missingPatches } = await this.#hostService.getMissingPatchesInfo({ filter: host => host.id === id });
118
119
  return missingPatches;
119
120
  }
121
+ /**
122
+ * @example id "b61a5c92-700e-4966-a13b-00633f03eea8"
123
+ * @example fields "name,id,$object"
124
+ * @example filter "name:PBD_PLUG_FAILED_ON_SERVER_START"
125
+ * @example limit 42
126
+ */
127
+ getHostMessages(req, id, fields, ndjson, filter, limit) {
128
+ const messages = this.getMessagesForObject(id, { filter, limit });
129
+ return this.sendObjects(Object.values(messages), req, 'messages');
130
+ }
120
131
  };
121
132
  __decorate([
122
133
  Example(hostIds),
@@ -185,6 +196,19 @@ __decorate([
185
196
  Response(featureUnauthorized.status, featureUnauthorized.description),
186
197
  __param(0, Path())
187
198
  ], HostController.prototype, "getMissingPatches", null);
199
+ __decorate([
200
+ Example(messageIds),
201
+ Example(partialMessages),
202
+ Get('{id}/messages'),
203
+ Tags('messages'),
204
+ Response(notFoundResp.status, notFoundResp.description),
205
+ __param(0, Request()),
206
+ __param(1, Path()),
207
+ __param(2, Query()),
208
+ __param(3, Query()),
209
+ __param(4, Query()),
210
+ __param(5, Query())
211
+ ], HostController.prototype, "getHostMessages", null);
188
212
  HostController = __decorate([
189
213
  Route('hosts'),
190
214
  Security('*'),
@@ -77,7 +77,7 @@ MessageController = __decorate([
77
77
  Route('messages'),
78
78
  Security('*'),
79
79
  Response(unauthorizedResp.status, unauthorizedResp.description),
80
- Tags('message'),
80
+ Tags('messages'),
81
81
  provide(MessageController),
82
82
  __param(0, inject(RestApi))
83
83
  ], MessageController);
@@ -1938,6 +1938,38 @@ export function RegisterRoutes(app) {
1938
1938
  }
1939
1939
  });
1940
1940
  // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
1941
+ const argsVmTemplateController_getVmTemplateMessages = {
1942
+ req: { "in": "request", "name": "req", "required": true, "dataType": "object" },
1943
+ id: { "in": "path", "name": "id", "required": true, "dataType": "string" },
1944
+ fields: { "in": "query", "name": "fields", "dataType": "string" },
1945
+ ndjson: { "in": "query", "name": "ndjson", "dataType": "boolean" },
1946
+ filter: { "in": "query", "name": "filter", "dataType": "string" },
1947
+ limit: { "in": "query", "name": "limit", "dataType": "double" },
1948
+ };
1949
+ app.get('/rest/v0/vm-templates/:id/messages', authenticateMiddleware([{ "*": [] }]), ...(fetchMiddlewares(VmTemplateController)), ...(fetchMiddlewares(VmTemplateController.prototype.getVmTemplateMessages)), async function VmTemplateController_getVmTemplateMessages(request, response, next) {
1950
+ // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
1951
+ let validatedArgs = [];
1952
+ try {
1953
+ validatedArgs = templateService.getValidatedArgs({ args: argsVmTemplateController_getVmTemplateMessages, request, response });
1954
+ const container = typeof iocContainer === 'function' ? iocContainer(request) : iocContainer;
1955
+ const controller = await container.get(VmTemplateController);
1956
+ if (typeof controller['setStatus'] === 'function') {
1957
+ controller.setStatus(undefined);
1958
+ }
1959
+ await templateService.apiHandler({
1960
+ methodName: 'getVmTemplateMessages',
1961
+ controller,
1962
+ response,
1963
+ next,
1964
+ validatedArgs,
1965
+ successStatus: undefined,
1966
+ });
1967
+ }
1968
+ catch (err) {
1969
+ return next(err);
1970
+ }
1971
+ });
1972
+ // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
1941
1973
  const argsVmSnapshotController_getVmSnapshots = {
1942
1974
  req: { "in": "request", "name": "req", "required": true, "dataType": "object" },
1943
1975
  fields: { "in": "query", "name": "fields", "dataType": "string" },
@@ -3261,6 +3293,38 @@ export function RegisterRoutes(app) {
3261
3293
  }
3262
3294
  });
3263
3295
  // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
3296
+ const argsSrController_getSrMessages = {
3297
+ req: { "in": "request", "name": "req", "required": true, "dataType": "object" },
3298
+ id: { "in": "path", "name": "id", "required": true, "dataType": "string" },
3299
+ fields: { "in": "query", "name": "fields", "dataType": "string" },
3300
+ ndjson: { "in": "query", "name": "ndjson", "dataType": "boolean" },
3301
+ filter: { "in": "query", "name": "filter", "dataType": "string" },
3302
+ limit: { "in": "query", "name": "limit", "dataType": "double" },
3303
+ };
3304
+ app.get('/rest/v0/srs/:id/messages', authenticateMiddleware([{ "*": [] }]), ...(fetchMiddlewares(SrController)), ...(fetchMiddlewares(SrController.prototype.getSrMessages)), async function SrController_getSrMessages(request, response, next) {
3305
+ // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
3306
+ let validatedArgs = [];
3307
+ try {
3308
+ validatedArgs = templateService.getValidatedArgs({ args: argsSrController_getSrMessages, request, response });
3309
+ const container = typeof iocContainer === 'function' ? iocContainer(request) : iocContainer;
3310
+ const controller = await container.get(SrController);
3311
+ if (typeof controller['setStatus'] === 'function') {
3312
+ controller.setStatus(undefined);
3313
+ }
3314
+ await templateService.apiHandler({
3315
+ methodName: 'getSrMessages',
3316
+ controller,
3317
+ response,
3318
+ next,
3319
+ validatedArgs,
3320
+ successStatus: undefined,
3321
+ });
3322
+ }
3323
+ catch (err) {
3324
+ return next(err);
3325
+ }
3326
+ });
3327
+ // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
3264
3328
  const argsSmController_getSrs = {
3265
3329
  req: { "in": "request", "name": "req", "required": true, "dataType": "object" },
3266
3330
  fields: { "in": "query", "name": "fields", "dataType": "string" },
@@ -4092,6 +4156,38 @@ export function RegisterRoutes(app) {
4092
4156
  }
4093
4157
  });
4094
4158
  // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
4159
+ const argsPoolController_getPoolMessages = {
4160
+ req: { "in": "request", "name": "req", "required": true, "dataType": "object" },
4161
+ id: { "in": "path", "name": "id", "required": true, "dataType": "string" },
4162
+ fields: { "in": "query", "name": "fields", "dataType": "string" },
4163
+ ndjson: { "in": "query", "name": "ndjson", "dataType": "boolean" },
4164
+ filter: { "in": "query", "name": "filter", "dataType": "string" },
4165
+ limit: { "in": "query", "name": "limit", "dataType": "double" },
4166
+ };
4167
+ app.get('/rest/v0/pools/:id/messages', authenticateMiddleware([{ "*": [] }]), ...(fetchMiddlewares(PoolController)), ...(fetchMiddlewares(PoolController.prototype.getPoolMessages)), async function PoolController_getPoolMessages(request, response, next) {
4168
+ // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
4169
+ let validatedArgs = [];
4170
+ try {
4171
+ validatedArgs = templateService.getValidatedArgs({ args: argsPoolController_getPoolMessages, request, response });
4172
+ const container = typeof iocContainer === 'function' ? iocContainer(request) : iocContainer;
4173
+ const controller = await container.get(PoolController);
4174
+ if (typeof controller['setStatus'] === 'function') {
4175
+ controller.setStatus(undefined);
4176
+ }
4177
+ await templateService.apiHandler({
4178
+ methodName: 'getPoolMessages',
4179
+ controller,
4180
+ response,
4181
+ next,
4182
+ validatedArgs,
4183
+ successStatus: undefined,
4184
+ });
4185
+ }
4186
+ catch (err) {
4187
+ return next(err);
4188
+ }
4189
+ });
4190
+ // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
4095
4191
  const argsPifController_getPifs = {
4096
4192
  req: { "in": "request", "name": "req", "required": true, "dataType": "object" },
4097
4193
  fields: { "in": "query", "name": "fields", "dataType": "string" },
@@ -4701,6 +4797,38 @@ export function RegisterRoutes(app) {
4701
4797
  }
4702
4798
  });
4703
4799
  // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
4800
+ const argsHostController_getHostMessages = {
4801
+ req: { "in": "request", "name": "req", "required": true, "dataType": "object" },
4802
+ id: { "in": "path", "name": "id", "required": true, "dataType": "string" },
4803
+ fields: { "in": "query", "name": "fields", "dataType": "string" },
4804
+ ndjson: { "in": "query", "name": "ndjson", "dataType": "boolean" },
4805
+ filter: { "in": "query", "name": "filter", "dataType": "string" },
4806
+ limit: { "in": "query", "name": "limit", "dataType": "double" },
4807
+ };
4808
+ app.get('/rest/v0/hosts/:id/messages', authenticateMiddleware([{ "*": [] }]), ...(fetchMiddlewares(HostController)), ...(fetchMiddlewares(HostController.prototype.getHostMessages)), async function HostController_getHostMessages(request, response, next) {
4809
+ // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
4810
+ let validatedArgs = [];
4811
+ try {
4812
+ validatedArgs = templateService.getValidatedArgs({ args: argsHostController_getHostMessages, request, response });
4813
+ const container = typeof iocContainer === 'function' ? iocContainer(request) : iocContainer;
4814
+ const controller = await container.get(HostController);
4815
+ if (typeof controller['setStatus'] === 'function') {
4816
+ controller.setStatus(undefined);
4817
+ }
4818
+ await templateService.apiHandler({
4819
+ methodName: 'getHostMessages',
4820
+ controller,
4821
+ response,
4822
+ next,
4823
+ validatedArgs,
4824
+ successStatus: undefined,
4825
+ });
4826
+ }
4827
+ catch (err) {
4828
+ return next(err);
4829
+ }
4830
+ });
4831
+ // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
4704
4832
  const argsGroupController_getGroups = {
4705
4833
  req: { "in": "request", "name": "req", "required": true, "dataType": "object" },
4706
4834
  fields: { "in": "query", "name": "fields", "dataType": "string" },
@@ -24,6 +24,7 @@ import { BASE_URL } from '../index.mjs';
24
24
  import { VmService } from '../vms/vm.service.mjs';
25
25
  import { PoolService } from './pool.service.mjs';
26
26
  import { escapeUnsafeComplexMatcher, NDJSON_CONTENT_TYPE } from '../helpers/utils.helper.mjs';
27
+ import { messageIds, partialMessages } from '../open-api/oa-examples/message.oa-example.mjs';
27
28
  let PoolController = class PoolController extends XapiXoController {
28
29
  #vmService;
29
30
  #poolService;
@@ -229,6 +230,16 @@ let PoolController = class PoolController extends XapiXoController {
229
230
  const { missingPatches } = await this.#poolService.getMissingPatches(pool.id);
230
231
  return missingPatches;
231
232
  }
233
+ /**
234
+ * @example id "355ee47d-ff4c-4924-3db2-fd86ae629676"
235
+ * @example fields "name,id,$object"
236
+ * @example filter "name:IP_CONFIGURED_PIF_CAN_UNPLUG"
237
+ * @example limit 42
238
+ */
239
+ getPoolMessages(req, id, fields, ndjson, filter, limit) {
240
+ const messages = this.getMessagesForObject(id, { filter, limit });
241
+ return this.sendObjects(Object.values(messages), req, 'messages');
242
+ }
232
243
  };
233
244
  __decorate([
234
245
  Example(poolIds),
@@ -350,6 +361,19 @@ __decorate([
350
361
  Response(featureUnauthorized.status, featureUnauthorized.description),
351
362
  __param(0, Path())
352
363
  ], PoolController.prototype, "getPoolMissingPatches", null);
364
+ __decorate([
365
+ Example(messageIds),
366
+ Example(partialMessages),
367
+ Get('{id}/messages'),
368
+ Tags('messages'),
369
+ Response(notFoundResp.status, notFoundResp.description),
370
+ __param(0, Request()),
371
+ __param(1, Path()),
372
+ __param(2, Query()),
373
+ __param(3, Query()),
374
+ __param(4, Query()),
375
+ __param(5, Query())
376
+ ], PoolController.prototype, "getPoolMessages", null);
353
377
  PoolController = __decorate([
354
378
  Route('pools'),
355
379
  Security('*'),
@@ -20,6 +20,7 @@ import { partialSrs, sr, srIds } from '../open-api/oa-examples/sr.oa-example.mjs
20
20
  import { vdiId } from '../open-api/oa-examples/vdi.oa-example.mjs';
21
21
  import { RestApi } from '../rest-api/rest-api.mjs';
22
22
  import { XapiXoController } from '../abstract-classes/xapi-xo-controller.mjs';
23
+ import { messageIds, partialMessages } from '../open-api/oa-examples/message.oa-example.mjs';
23
24
  let SrController = class SrController extends XapiXoController {
24
25
  #alarmService;
25
26
  constructor(restApi, alarmService) {
@@ -76,6 +77,16 @@ let SrController = class SrController extends XapiXoController {
76
77
  this.setHeader('Location', `${BASE_URL}/vdis/${vdiId}`);
77
78
  return { id: vdiId };
78
79
  }
80
+ /**
81
+ * @example id "c4284e12-37c9-7967-b9e8-83ef229c3e03"
82
+ * @example fields "name,id,$object"
83
+ * @example filter "name:VM_STARTED"
84
+ * @example limit 42
85
+ */
86
+ getSrMessages(req, id, fields, ndjson, filter, limit) {
87
+ const messages = this.getMessagesForObject(id, { filter, limit });
88
+ return this.sendObjects(Object.values(messages), req, 'messages');
89
+ }
79
90
  };
80
91
  __decorate([
81
92
  Example(srIds),
@@ -117,6 +128,19 @@ __decorate([
117
128
  __param(3, Query()),
118
129
  __param(4, Query())
119
130
  ], SrController.prototype, "srImportVdi", null);
131
+ __decorate([
132
+ Example(messageIds),
133
+ Example(partialMessages),
134
+ Get('{id}/messages'),
135
+ Tags('messages'),
136
+ Response(notFoundResp.status, notFoundResp.description),
137
+ __param(0, Request()),
138
+ __param(1, Path()),
139
+ __param(2, Query()),
140
+ __param(3, Query()),
141
+ __param(4, Query()),
142
+ __param(5, Query())
143
+ ], SrController.prototype, "getSrMessages", null);
120
144
  SrController = __decorate([
121
145
  Route('srs'),
122
146
  Security('*'),
@@ -9,7 +9,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
9
9
  };
10
10
  import { Delete, Example, Get, Path, 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
15
  import { forbiddenOperationResp, incorrectStateResp, noContentResp, notFoundResp, unauthorizedResp, } from '../open-api/common/response.common.mjs';
@@ -96,11 +96,7 @@ let VmSnapshotController = class VmSnapshotController extends XapiXoController {
96
96
  * @example limit 42
97
97
  */
98
98
  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
- });
99
+ const messages = this.getMessagesForObject(id, { filter, limit });
104
100
  return this.sendObjects(Object.values(messages), req, 'messages');
105
101
  }
106
102
  };
@@ -18,6 +18,7 @@ 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
+ import { messageIds, partialMessages } from '../open-api/oa-examples/message.oa-example.mjs';
21
22
  let VmTemplateController = class VmTemplateController extends XapiXoController {
22
23
  #alarmService;
23
24
  #vmService;
@@ -87,6 +88,16 @@ let VmTemplateController = class VmTemplateController extends XapiXoController {
87
88
  const vdis = this.#vmService.getVmVdis(id, 'VM-template');
88
89
  return this.sendObjects(limitAndFilterArray(vdis, { filter, limit }), req, obj => obj.type.toLowerCase() + 's');
89
90
  }
91
+ /**
92
+ * @example id "6d50ba76-0f11-1ff1-4f6a-b502afc31b8e"
93
+ * @example fields "name,id,$object"
94
+ * @example filter "name:VM_STARTED"
95
+ * @example limit 42
96
+ */
97
+ getVmTemplateMessages(req, id, fields, ndjson, filter, limit) {
98
+ const messages = this.getMessagesForObject(id, { filter, limit });
99
+ return this.sendObjects(Object.values(messages), req, 'messages');
100
+ }
90
101
  };
91
102
  __decorate([
92
103
  Example(vmTemplateIds),
@@ -146,6 +157,19 @@ __decorate([
146
157
  __param(4, Query()),
147
158
  __param(5, Query())
148
159
  ], VmTemplateController.prototype, "getVmTemplateVdis", null);
160
+ __decorate([
161
+ Example(messageIds),
162
+ Example(partialMessages),
163
+ Get('{id}/messages'),
164
+ Tags('messages'),
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
+ ], VmTemplateController.prototype, "getVmTemplateMessages", null);
149
173
  VmTemplateController = __decorate([
150
174
  Route('vm-templates'),
151
175
  Security('*'),
@@ -11,7 +11,7 @@ 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';
14
+ import { AlarmService } from '../alarms/alarm.service.mjs';
15
15
  import { asynchronousActionResp, 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';
@@ -376,11 +376,7 @@ let VmController = class VmController extends XapiXoController {
376
376
  * @example limit 42
377
377
  */
378
378
  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
- });
379
+ const messages = this.getMessagesForObject(id, { filter, limit });
384
380
  return this.sendObjects(Object.values(messages), req, 'messages');
385
381
  }
386
382
  /**
@@ -10867,7 +10867,7 @@
10867
10867
  },
10868
10868
  "info": {
10869
10869
  "title": "@xen-orchestra/rest-api",
10870
- "version": "0.16.0",
10870
+ "version": "0.18.0",
10871
10871
  "description": "REST API to manage your XOA",
10872
10872
  "license": {
10873
10873
  "name": "AGPL-3.0-or-later"
@@ -14449,6 +14449,111 @@
14449
14449
  ]
14450
14450
  }
14451
14451
  },
14452
+ "/vm-templates/{id}/messages": {
14453
+ "get": {
14454
+ "operationId": "GetVmTemplateMessages",
14455
+ "responses": {
14456
+ "200": {
14457
+ "description": "Ok",
14458
+ "content": {
14459
+ "application/json": {
14460
+ "schema": {
14461
+ "$ref": "#/components/schemas/SendObjects_Partial_Unbrand_XoMessage___"
14462
+ },
14463
+ "examples": {
14464
+ "Example 1": {
14465
+ "value": [
14466
+ "/rest/v0/messages/f775eaeb-abe5-94e0-9682-14c37c3a1dfe",
14467
+ "/rest/v0/messages/ed2d1623-3e65-8d39-7a14-4eb69274c5e3"
14468
+ ]
14469
+ },
14470
+ "Example 2": {
14471
+ "value": [
14472
+ {
14473
+ "name": "VM_STARTED",
14474
+ "body": "VM 'Alpine MRA' (uuid: cef5f68c-61ae-3831-d2e6-1590d4934acf) started on host: XCP 8.3.0 master (uuid: b61a5c92-700e-4966-a13b-00633f03eea8)",
14475
+ "id": "f775eaeb-abe5-94e0-9682-14c37c3a1dfe",
14476
+ "$object": "cef5f68c-61ae-3831-d2e6-1590d4934acf",
14477
+ "href": "/rest/v0/messages/f775eaeb-abe5-94e0-9682-14c37c3a1dfe"
14478
+ },
14479
+ {
14480
+ "name": "VM_STARTED",
14481
+ "body": "VM 'Alpine MRA' (uuid: cef5f68c-61ae-3831-d2e6-1590d4934acf) started on host: XCP 8.3.0 master (uuid: b61a5c92-700e-4966-a13b-00633f03eea8)",
14482
+ "id": "ed2d1623-3e65-8d39-7a14-4eb69274c5e3",
14483
+ "$object": "cef5f68c-61ae-3831-d2e6-1590d4934acf",
14484
+ "href": "/rest/v0/messages/ed2d1623-3e65-8d39-7a14-4eb69274c5e3"
14485
+ }
14486
+ ]
14487
+ }
14488
+ }
14489
+ }
14490
+ }
14491
+ },
14492
+ "401": {
14493
+ "description": "Authentication required"
14494
+ },
14495
+ "404": {
14496
+ "description": "Resource not found"
14497
+ }
14498
+ },
14499
+ "tags": [
14500
+ "messages",
14501
+ "vms"
14502
+ ],
14503
+ "security": [
14504
+ {
14505
+ "*": []
14506
+ }
14507
+ ],
14508
+ "parameters": [
14509
+ {
14510
+ "in": "path",
14511
+ "name": "id",
14512
+ "required": true,
14513
+ "schema": {
14514
+ "type": "string"
14515
+ },
14516
+ "example": "6d50ba76-0f11-1ff1-4f6a-b502afc31b8e"
14517
+ },
14518
+ {
14519
+ "in": "query",
14520
+ "name": "fields",
14521
+ "required": false,
14522
+ "schema": {
14523
+ "type": "string"
14524
+ },
14525
+ "example": "name,id,$object"
14526
+ },
14527
+ {
14528
+ "in": "query",
14529
+ "name": "ndjson",
14530
+ "required": false,
14531
+ "schema": {
14532
+ "type": "boolean"
14533
+ }
14534
+ },
14535
+ {
14536
+ "in": "query",
14537
+ "name": "filter",
14538
+ "required": false,
14539
+ "schema": {
14540
+ "type": "string"
14541
+ },
14542
+ "example": "name:VM_STARTED"
14543
+ },
14544
+ {
14545
+ "in": "query",
14546
+ "name": "limit",
14547
+ "required": false,
14548
+ "schema": {
14549
+ "format": "double",
14550
+ "type": "number"
14551
+ },
14552
+ "example": 42
14553
+ }
14554
+ ]
14555
+ }
14556
+ },
14452
14557
  "/vm-snapshots": {
14453
14558
  "get": {
14454
14559
  "operationId": "GetVmSnapshots",
@@ -17966,6 +18071,111 @@
17966
18071
  ]
17967
18072
  }
17968
18073
  },
18074
+ "/srs/{id}/messages": {
18075
+ "get": {
18076
+ "operationId": "GetSrMessages",
18077
+ "responses": {
18078
+ "200": {
18079
+ "description": "Ok",
18080
+ "content": {
18081
+ "application/json": {
18082
+ "schema": {
18083
+ "$ref": "#/components/schemas/SendObjects_Partial_Unbrand_XoMessage___"
18084
+ },
18085
+ "examples": {
18086
+ "Example 1": {
18087
+ "value": [
18088
+ "/rest/v0/messages/f775eaeb-abe5-94e0-9682-14c37c3a1dfe",
18089
+ "/rest/v0/messages/ed2d1623-3e65-8d39-7a14-4eb69274c5e3"
18090
+ ]
18091
+ },
18092
+ "Example 2": {
18093
+ "value": [
18094
+ {
18095
+ "name": "VM_STARTED",
18096
+ "body": "VM 'Alpine MRA' (uuid: cef5f68c-61ae-3831-d2e6-1590d4934acf) started on host: XCP 8.3.0 master (uuid: b61a5c92-700e-4966-a13b-00633f03eea8)",
18097
+ "id": "f775eaeb-abe5-94e0-9682-14c37c3a1dfe",
18098
+ "$object": "cef5f68c-61ae-3831-d2e6-1590d4934acf",
18099
+ "href": "/rest/v0/messages/f775eaeb-abe5-94e0-9682-14c37c3a1dfe"
18100
+ },
18101
+ {
18102
+ "name": "VM_STARTED",
18103
+ "body": "VM 'Alpine MRA' (uuid: cef5f68c-61ae-3831-d2e6-1590d4934acf) started on host: XCP 8.3.0 master (uuid: b61a5c92-700e-4966-a13b-00633f03eea8)",
18104
+ "id": "ed2d1623-3e65-8d39-7a14-4eb69274c5e3",
18105
+ "$object": "cef5f68c-61ae-3831-d2e6-1590d4934acf",
18106
+ "href": "/rest/v0/messages/ed2d1623-3e65-8d39-7a14-4eb69274c5e3"
18107
+ }
18108
+ ]
18109
+ }
18110
+ }
18111
+ }
18112
+ }
18113
+ },
18114
+ "401": {
18115
+ "description": "Authentication required"
18116
+ },
18117
+ "404": {
18118
+ "description": "Resource not found"
18119
+ }
18120
+ },
18121
+ "tags": [
18122
+ "messages",
18123
+ "srs"
18124
+ ],
18125
+ "security": [
18126
+ {
18127
+ "*": []
18128
+ }
18129
+ ],
18130
+ "parameters": [
18131
+ {
18132
+ "in": "path",
18133
+ "name": "id",
18134
+ "required": true,
18135
+ "schema": {
18136
+ "type": "string"
18137
+ },
18138
+ "example": "c4284e12-37c9-7967-b9e8-83ef229c3e03"
18139
+ },
18140
+ {
18141
+ "in": "query",
18142
+ "name": "fields",
18143
+ "required": false,
18144
+ "schema": {
18145
+ "type": "string"
18146
+ },
18147
+ "example": "name,id,$object"
18148
+ },
18149
+ {
18150
+ "in": "query",
18151
+ "name": "ndjson",
18152
+ "required": false,
18153
+ "schema": {
18154
+ "type": "boolean"
18155
+ }
18156
+ },
18157
+ {
18158
+ "in": "query",
18159
+ "name": "filter",
18160
+ "required": false,
18161
+ "schema": {
18162
+ "type": "string"
18163
+ },
18164
+ "example": "name:VM_STARTED"
18165
+ },
18166
+ {
18167
+ "in": "query",
18168
+ "name": "limit",
18169
+ "required": false,
18170
+ "schema": {
18171
+ "format": "double",
18172
+ "type": "number"
18173
+ },
18174
+ "example": 42
18175
+ }
18176
+ ]
18177
+ }
18178
+ },
17969
18179
  "/sms": {
17970
18180
  "get": {
17971
18181
  "operationId": "GetSrs",
@@ -22278,6 +22488,111 @@
22278
22488
  ]
22279
22489
  }
22280
22490
  },
22491
+ "/pools/{id}/messages": {
22492
+ "get": {
22493
+ "operationId": "GetPoolMessages",
22494
+ "responses": {
22495
+ "200": {
22496
+ "description": "Ok",
22497
+ "content": {
22498
+ "application/json": {
22499
+ "schema": {
22500
+ "$ref": "#/components/schemas/SendObjects_Partial_Unbrand_XoMessage___"
22501
+ },
22502
+ "examples": {
22503
+ "Example 1": {
22504
+ "value": [
22505
+ "/rest/v0/messages/f775eaeb-abe5-94e0-9682-14c37c3a1dfe",
22506
+ "/rest/v0/messages/ed2d1623-3e65-8d39-7a14-4eb69274c5e3"
22507
+ ]
22508
+ },
22509
+ "Example 2": {
22510
+ "value": [
22511
+ {
22512
+ "name": "VM_STARTED",
22513
+ "body": "VM 'Alpine MRA' (uuid: cef5f68c-61ae-3831-d2e6-1590d4934acf) started on host: XCP 8.3.0 master (uuid: b61a5c92-700e-4966-a13b-00633f03eea8)",
22514
+ "id": "f775eaeb-abe5-94e0-9682-14c37c3a1dfe",
22515
+ "$object": "cef5f68c-61ae-3831-d2e6-1590d4934acf",
22516
+ "href": "/rest/v0/messages/f775eaeb-abe5-94e0-9682-14c37c3a1dfe"
22517
+ },
22518
+ {
22519
+ "name": "VM_STARTED",
22520
+ "body": "VM 'Alpine MRA' (uuid: cef5f68c-61ae-3831-d2e6-1590d4934acf) started on host: XCP 8.3.0 master (uuid: b61a5c92-700e-4966-a13b-00633f03eea8)",
22521
+ "id": "ed2d1623-3e65-8d39-7a14-4eb69274c5e3",
22522
+ "$object": "cef5f68c-61ae-3831-d2e6-1590d4934acf",
22523
+ "href": "/rest/v0/messages/ed2d1623-3e65-8d39-7a14-4eb69274c5e3"
22524
+ }
22525
+ ]
22526
+ }
22527
+ }
22528
+ }
22529
+ }
22530
+ },
22531
+ "401": {
22532
+ "description": "Authentication required"
22533
+ },
22534
+ "404": {
22535
+ "description": "Resource not found"
22536
+ }
22537
+ },
22538
+ "tags": [
22539
+ "messages",
22540
+ "pools"
22541
+ ],
22542
+ "security": [
22543
+ {
22544
+ "*": []
22545
+ }
22546
+ ],
22547
+ "parameters": [
22548
+ {
22549
+ "in": "path",
22550
+ "name": "id",
22551
+ "required": true,
22552
+ "schema": {
22553
+ "type": "string"
22554
+ },
22555
+ "example": "355ee47d-ff4c-4924-3db2-fd86ae629676"
22556
+ },
22557
+ {
22558
+ "in": "query",
22559
+ "name": "fields",
22560
+ "required": false,
22561
+ "schema": {
22562
+ "type": "string"
22563
+ },
22564
+ "example": "name,id,$object"
22565
+ },
22566
+ {
22567
+ "in": "query",
22568
+ "name": "ndjson",
22569
+ "required": false,
22570
+ "schema": {
22571
+ "type": "boolean"
22572
+ }
22573
+ },
22574
+ {
22575
+ "in": "query",
22576
+ "name": "filter",
22577
+ "required": false,
22578
+ "schema": {
22579
+ "type": "string"
22580
+ },
22581
+ "example": "name:IP_CONFIGURED_PIF_CAN_UNPLUG"
22582
+ },
22583
+ {
22584
+ "in": "query",
22585
+ "name": "limit",
22586
+ "required": false,
22587
+ "schema": {
22588
+ "format": "double",
22589
+ "type": "number"
22590
+ },
22591
+ "example": 42
22592
+ }
22593
+ ]
22594
+ }
22595
+ },
22281
22596
  "/pifs": {
22282
22597
  "get": {
22283
22598
  "operationId": "GetPifs",
@@ -23185,7 +23500,7 @@
23185
23500
  }
23186
23501
  },
23187
23502
  "tags": [
23188
- "message"
23503
+ "messages"
23189
23504
  ],
23190
23505
  "security": [
23191
23506
  {
@@ -23270,7 +23585,7 @@
23270
23585
  }
23271
23586
  },
23272
23587
  "tags": [
23273
- "message"
23588
+ "messages"
23274
23589
  ],
23275
23590
  "security": [
23276
23591
  {
@@ -30192,6 +30507,111 @@
30192
30507
  ]
30193
30508
  }
30194
30509
  },
30510
+ "/hosts/{id}/messages": {
30511
+ "get": {
30512
+ "operationId": "GetHostMessages",
30513
+ "responses": {
30514
+ "200": {
30515
+ "description": "Ok",
30516
+ "content": {
30517
+ "application/json": {
30518
+ "schema": {
30519
+ "$ref": "#/components/schemas/SendObjects_Partial_Unbrand_XoMessage___"
30520
+ },
30521
+ "examples": {
30522
+ "Example 1": {
30523
+ "value": [
30524
+ "/rest/v0/messages/f775eaeb-abe5-94e0-9682-14c37c3a1dfe",
30525
+ "/rest/v0/messages/ed2d1623-3e65-8d39-7a14-4eb69274c5e3"
30526
+ ]
30527
+ },
30528
+ "Example 2": {
30529
+ "value": [
30530
+ {
30531
+ "name": "VM_STARTED",
30532
+ "body": "VM 'Alpine MRA' (uuid: cef5f68c-61ae-3831-d2e6-1590d4934acf) started on host: XCP 8.3.0 master (uuid: b61a5c92-700e-4966-a13b-00633f03eea8)",
30533
+ "id": "f775eaeb-abe5-94e0-9682-14c37c3a1dfe",
30534
+ "$object": "cef5f68c-61ae-3831-d2e6-1590d4934acf",
30535
+ "href": "/rest/v0/messages/f775eaeb-abe5-94e0-9682-14c37c3a1dfe"
30536
+ },
30537
+ {
30538
+ "name": "VM_STARTED",
30539
+ "body": "VM 'Alpine MRA' (uuid: cef5f68c-61ae-3831-d2e6-1590d4934acf) started on host: XCP 8.3.0 master (uuid: b61a5c92-700e-4966-a13b-00633f03eea8)",
30540
+ "id": "ed2d1623-3e65-8d39-7a14-4eb69274c5e3",
30541
+ "$object": "cef5f68c-61ae-3831-d2e6-1590d4934acf",
30542
+ "href": "/rest/v0/messages/ed2d1623-3e65-8d39-7a14-4eb69274c5e3"
30543
+ }
30544
+ ]
30545
+ }
30546
+ }
30547
+ }
30548
+ }
30549
+ },
30550
+ "401": {
30551
+ "description": "Authentication required"
30552
+ },
30553
+ "404": {
30554
+ "description": "Resource not found"
30555
+ }
30556
+ },
30557
+ "tags": [
30558
+ "messages",
30559
+ "hosts"
30560
+ ],
30561
+ "security": [
30562
+ {
30563
+ "*": []
30564
+ }
30565
+ ],
30566
+ "parameters": [
30567
+ {
30568
+ "in": "path",
30569
+ "name": "id",
30570
+ "required": true,
30571
+ "schema": {
30572
+ "type": "string"
30573
+ },
30574
+ "example": "b61a5c92-700e-4966-a13b-00633f03eea8"
30575
+ },
30576
+ {
30577
+ "in": "query",
30578
+ "name": "fields",
30579
+ "required": false,
30580
+ "schema": {
30581
+ "type": "string"
30582
+ },
30583
+ "example": "name,id,$object"
30584
+ },
30585
+ {
30586
+ "in": "query",
30587
+ "name": "ndjson",
30588
+ "required": false,
30589
+ "schema": {
30590
+ "type": "boolean"
30591
+ }
30592
+ },
30593
+ {
30594
+ "in": "query",
30595
+ "name": "filter",
30596
+ "required": false,
30597
+ "schema": {
30598
+ "type": "string"
30599
+ },
30600
+ "example": "name:PBD_PLUG_FAILED_ON_SERVER_START"
30601
+ },
30602
+ {
30603
+ "in": "query",
30604
+ "name": "limit",
30605
+ "required": false,
30606
+ "schema": {
30607
+ "format": "double",
30608
+ "type": "number"
30609
+ },
30610
+ "example": 42
30611
+ }
30612
+ ]
30613
+ }
30614
+ },
30195
30615
  "/groups": {
30196
30616
  "get": {
30197
30617
  "operationId": "GetGroups",
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "main": "./dist/index.mjs",
7
7
  "name": "@xen-orchestra/rest-api",
8
8
  "homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/rest-api",
9
- "version": "0.16.0",
9
+ "version": "0.18.0",
10
10
  "description": "REST API to manage your XOA",
11
11
  "license": "AGPL-3.0-or-later",
12
12
  "private": false,
@@ -33,9 +33,9 @@
33
33
  "typescript-eslint": "^8.23.0"
34
34
  },
35
35
  "dependencies": {
36
- "@vates/async-each": "^1.0.0",
36
+ "@vates/async-each": "^1.0.1",
37
37
  "@vates/task": "^0.6.1",
38
- "@vates/types": "^1.12.0",
38
+ "@vates/types": "^1.12.1",
39
39
  "@xen-orchestra/backups": "^0.64.3",
40
40
  "@xen-orchestra/log": "^0.7.1",
41
41
  "complex-matcher": "^1.0.0",
package/tsconfig.json CHANGED
@@ -9,6 +9,7 @@
9
9
  "moduleResolution": "bundler",
10
10
  "target": "ES2023",
11
11
  "skipLibCheck": true,
12
+ "types": ["node"], // Only use types from Node.js and packages that are explicitly imported
12
13
  "noImplicitAny": false, // otherwise it will throw an error when importing packages without type definition
13
14
 
14
15
  /* Experimental options */