@xen-orchestra/rest-api 0.17.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);
@@ -3293,6 +3293,38 @@ export function RegisterRoutes(app) {
3293
3293
  }
3294
3294
  });
3295
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
3296
3328
  const argsSmController_getSrs = {
3297
3329
  req: { "in": "request", "name": "req", "required": true, "dataType": "object" },
3298
3330
  fields: { "in": "query", "name": "fields", "dataType": "string" },
@@ -4124,6 +4156,38 @@ export function RegisterRoutes(app) {
4124
4156
  }
4125
4157
  });
4126
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
4127
4191
  const argsPifController_getPifs = {
4128
4192
  req: { "in": "request", "name": "req", "required": true, "dataType": "object" },
4129
4193
  fields: { "in": "query", "name": "fields", "dataType": "string" },
@@ -4733,6 +4797,38 @@ export function RegisterRoutes(app) {
4733
4797
  }
4734
4798
  });
4735
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
4736
4832
  const argsGroupController_getGroups = {
4737
4833
  req: { "in": "request", "name": "req", "required": true, "dataType": "object" },
4738
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
  };
@@ -10,7 +10,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
10
10
  import { Example, Get, Security, Query, Request, Response, Route, Tags, Path, Delete, SuccessResponse } 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
16
  import { forbiddenOperationResp, incorrectStateResp, noContentResp, notFoundResp, unauthorizedResp, } from '../open-api/common/response.common.mjs';
@@ -95,11 +95,7 @@ let VmTemplateController = class VmTemplateController extends XapiXoController {
95
95
  * @example limit 42
96
96
  */
97
97
  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
- });
98
+ const messages = this.getMessagesForObject(id, { filter, limit });
103
99
  return this.sendObjects(Object.values(messages), req, 'messages');
104
100
  }
105
101
  };
@@ -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.17.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"
@@ -18071,6 +18071,111 @@
18071
18071
  ]
18072
18072
  }
18073
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
+ },
18074
18179
  "/sms": {
18075
18180
  "get": {
18076
18181
  "operationId": "GetSrs",
@@ -22383,6 +22488,111 @@
22383
22488
  ]
22384
22489
  }
22385
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
+ },
22386
22596
  "/pifs": {
22387
22597
  "get": {
22388
22598
  "operationId": "GetPifs",
@@ -23290,7 +23500,7 @@
23290
23500
  }
23291
23501
  },
23292
23502
  "tags": [
23293
- "message"
23503
+ "messages"
23294
23504
  ],
23295
23505
  "security": [
23296
23506
  {
@@ -23375,7 +23585,7 @@
23375
23585
  }
23376
23586
  },
23377
23587
  "tags": [
23378
- "message"
23588
+ "messages"
23379
23589
  ],
23380
23590
  "security": [
23381
23591
  {
@@ -30297,6 +30507,111 @@
30297
30507
  ]
30298
30508
  }
30299
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
+ },
30300
30615
  "/groups": {
30301
30616
  "get": {
30302
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.17.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 */