@xen-orchestra/rest-api 0.16.0 → 0.17.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.
|
@@ -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" },
|
|
@@ -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 } from '../alarms/alarm.service.mjs';
|
|
13
|
+
import { AlarmService, RAW_ALARM_FILTER } 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';
|
|
@@ -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,20 @@ 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 vmTemplate = this.getObject(id);
|
|
99
|
+
const messages = this.restApi.getObjectsByType('message', {
|
|
100
|
+
filter: `${escapeUnsafeComplexMatcher(filter) ?? ''} $object:${vmTemplate.uuid} !${RAW_ALARM_FILTER}`,
|
|
101
|
+
limit,
|
|
102
|
+
});
|
|
103
|
+
return this.sendObjects(Object.values(messages), req, 'messages');
|
|
104
|
+
}
|
|
90
105
|
};
|
|
91
106
|
__decorate([
|
|
92
107
|
Example(vmTemplateIds),
|
|
@@ -146,6 +161,19 @@ __decorate([
|
|
|
146
161
|
__param(4, Query()),
|
|
147
162
|
__param(5, Query())
|
|
148
163
|
], VmTemplateController.prototype, "getVmTemplateVdis", null);
|
|
164
|
+
__decorate([
|
|
165
|
+
Example(messageIds),
|
|
166
|
+
Example(partialMessages),
|
|
167
|
+
Get('{id}/messages'),
|
|
168
|
+
Tags('messages'),
|
|
169
|
+
Response(notFoundResp.status, notFoundResp.description),
|
|
170
|
+
__param(0, Request()),
|
|
171
|
+
__param(1, Path()),
|
|
172
|
+
__param(2, Query()),
|
|
173
|
+
__param(3, Query()),
|
|
174
|
+
__param(4, Query()),
|
|
175
|
+
__param(5, Query())
|
|
176
|
+
], VmTemplateController.prototype, "getVmTemplateMessages", null);
|
|
149
177
|
VmTemplateController = __decorate([
|
|
150
178
|
Route('vm-templates'),
|
|
151
179
|
Security('*'),
|
|
@@ -10867,7 +10867,7 @@
|
|
|
10867
10867
|
},
|
|
10868
10868
|
"info": {
|
|
10869
10869
|
"title": "@xen-orchestra/rest-api",
|
|
10870
|
-
"version": "0.
|
|
10870
|
+
"version": "0.17.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",
|
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.
|
|
9
|
+
"version": "0.17.0",
|
|
10
10
|
"description": "REST API to manage your XOA",
|
|
11
11
|
"license": "AGPL-3.0-or-later",
|
|
12
12
|
"private": false,
|