@xen-orchestra/rest-api 0.4.0 → 0.6.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/dist/groups/group.controller.mjs +60 -0
- package/dist/open-api/networks/network.controller.mjs +59 -0
- package/dist/open-api/oa-examples/group.oa-example.mjs +23 -0
- package/dist/open-api/oa-examples/network.oa-example.mjs +50 -0
- package/dist/open-api/oa-examples/user.oa-example.mjs +26 -0
- package/dist/open-api/oa-examples/vm-template.oa-example.mjs +1 -1
- package/dist/open-api/routes/routes.js +227 -0
- package/dist/users/user.controller.mjs +70 -0
- package/open-api/spec/swagger.json +836 -2
- package/package.json +1 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
};
|
|
10
|
+
import { Example, Get, Path, Query, Request, Response, Route, Security, Tags } from 'tsoa';
|
|
11
|
+
import { provide } from 'inversify-binding-decorators';
|
|
12
|
+
import { notFoundResp, unauthorizedResp } from '../open-api/common/response.common.mjs';
|
|
13
|
+
import { group, groupIds, partialGroups } from '../open-api/oa-examples/group.oa-example.mjs';
|
|
14
|
+
import { XoController } from '../abstract-classes/xo-controller.mjs';
|
|
15
|
+
let GroupController = class GroupController extends XoController {
|
|
16
|
+
// --- abstract methods
|
|
17
|
+
getAllCollectionObjects() {
|
|
18
|
+
return this.restApi.xoApp.getAllGroups();
|
|
19
|
+
}
|
|
20
|
+
getCollectionObject(id) {
|
|
21
|
+
return this.restApi.xoApp.getGroup(id);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @example fields "name,id,users"
|
|
25
|
+
* @example filter "users:length:>0"
|
|
26
|
+
* @example limit 42
|
|
27
|
+
*/
|
|
28
|
+
async getGroups(req, fields, filter, limit) {
|
|
29
|
+
return this.sendObjects(Object.values(await this.getObjects({ filter, limit })), req);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @example id "7d98fee4-3357-41a7-ac3f-9124212badb7"
|
|
33
|
+
*/
|
|
34
|
+
getGroup(id) {
|
|
35
|
+
return this.getObject(id);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
__decorate([
|
|
39
|
+
Example(groupIds),
|
|
40
|
+
Example(partialGroups),
|
|
41
|
+
Get(''),
|
|
42
|
+
__param(0, Request()),
|
|
43
|
+
__param(1, Query()),
|
|
44
|
+
__param(2, Query()),
|
|
45
|
+
__param(3, Query())
|
|
46
|
+
], GroupController.prototype, "getGroups", null);
|
|
47
|
+
__decorate([
|
|
48
|
+
Example(group),
|
|
49
|
+
Get('{id}'),
|
|
50
|
+
Response(notFoundResp.status, notFoundResp.description),
|
|
51
|
+
__param(0, Path())
|
|
52
|
+
], GroupController.prototype, "getGroup", null);
|
|
53
|
+
GroupController = __decorate([
|
|
54
|
+
Route('groups'),
|
|
55
|
+
Security('*'),
|
|
56
|
+
Response(unauthorizedResp.status, unauthorizedResp.description),
|
|
57
|
+
Tags('groups'),
|
|
58
|
+
provide(GroupController)
|
|
59
|
+
], GroupController);
|
|
60
|
+
export { GroupController };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
};
|
|
10
|
+
import { Example, Get, Path, Query, Response, Request, Route, Security, Tags } from 'tsoa';
|
|
11
|
+
import { inject } from 'inversify';
|
|
12
|
+
import { provide } from 'inversify-binding-decorators';
|
|
13
|
+
import { network, networkIds, partialNetworks } from '../oa-examples/network.oa-example.mjs';
|
|
14
|
+
import { notFoundResp, unauthorizedResp } from '../common/response.common.mjs';
|
|
15
|
+
import { RestApi } from '../../rest-api/rest-api.mjs';
|
|
16
|
+
import { XapiXoController } from '../../abstract-classes/xapi-xo-controller.mjs';
|
|
17
|
+
let NetworkController = class NetworkController extends XapiXoController {
|
|
18
|
+
constructor(restApi) {
|
|
19
|
+
super('network', restApi);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @example fields "nbd,name_label,id"
|
|
23
|
+
* @example filter "nbd?"
|
|
24
|
+
* @example limit 42
|
|
25
|
+
*/
|
|
26
|
+
getNetworks(req, fields, filter, limit) {
|
|
27
|
+
return this.sendObjects(Object.values(this.getObjects({ filter, limit })), req);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @example id "9fe12ca3-d75d-cfb0-492e-cfd2bc6c568f"
|
|
31
|
+
*/
|
|
32
|
+
getNetwork(id) {
|
|
33
|
+
return this.getObject(id);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
__decorate([
|
|
37
|
+
Example(networkIds),
|
|
38
|
+
Example(partialNetworks),
|
|
39
|
+
Get(''),
|
|
40
|
+
__param(0, Request()),
|
|
41
|
+
__param(1, Query()),
|
|
42
|
+
__param(2, Query()),
|
|
43
|
+
__param(3, Query())
|
|
44
|
+
], NetworkController.prototype, "getNetworks", null);
|
|
45
|
+
__decorate([
|
|
46
|
+
Example(network),
|
|
47
|
+
Get('{id}'),
|
|
48
|
+
Response(notFoundResp.status, notFoundResp.description),
|
|
49
|
+
__param(0, Path())
|
|
50
|
+
], NetworkController.prototype, "getNetwork", null);
|
|
51
|
+
NetworkController = __decorate([
|
|
52
|
+
Route('networks'),
|
|
53
|
+
Security('*'),
|
|
54
|
+
Response(unauthorizedResp.status, unauthorizedResp.description),
|
|
55
|
+
Tags('networks'),
|
|
56
|
+
provide(NetworkController),
|
|
57
|
+
__param(0, inject(RestApi))
|
|
58
|
+
], NetworkController);
|
|
59
|
+
export { NetworkController };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const groupIds = [
|
|
2
|
+
'/rest/v0/groups/7d98fee4-3357-41a7-ac3f-9124212badb7',
|
|
3
|
+
'/rest/v0/groups/7981ba62-c395-4546-bfa4-d1261653a77f',
|
|
4
|
+
];
|
|
5
|
+
export const partialGroups = [
|
|
6
|
+
{
|
|
7
|
+
name: 'group 1',
|
|
8
|
+
id: '7d98fee4-3357-41a7-ac3f-9124212badb7',
|
|
9
|
+
users: ['722d17b9-699b-49d2-8193-be1ac573d3de'],
|
|
10
|
+
href: '/rest/v0/groups/7d98fee4-3357-41a7-ac3f-9124212badb7',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'group 2',
|
|
14
|
+
id: '7981ba62-c395-4546-bfa4-d1261653a77f',
|
|
15
|
+
users: ['722d17b9-699b-49d2-8193-be1ac573d3de', '088124f3-41b6-4258-9653-6eedc7b46111'],
|
|
16
|
+
href: '/rest/v0/groups/7981ba62-c395-4546-bfa4-d1261653a77f',
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
export const group = {
|
|
20
|
+
name: 'group 1',
|
|
21
|
+
users: ['722d17b9-699b-49d2-8193-be1ac573d3de'],
|
|
22
|
+
id: '7d98fee4-3357-41a7-ac3f-9124212badb7',
|
|
23
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export const networkIds = [
|
|
2
|
+
'/rest/v0/networks/9fe12ca3-d75d-cfb0-492e-cfd2bc6c568f',
|
|
3
|
+
'/rest/v0/networks/6b6ca0f5-6611-0636-4b0a-1fb1c8e96414',
|
|
4
|
+
];
|
|
5
|
+
export const partialNetworks = [
|
|
6
|
+
{
|
|
7
|
+
nbd: true,
|
|
8
|
+
name_label: 'Host internal management network',
|
|
9
|
+
id: '9fe12ca3-d75d-cfb0-492e-cfd2bc6c568f',
|
|
10
|
+
href: '/rest/v0/networks/9fe12ca3-d75d-cfb0-492e-cfd2bc6c568f',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
nbd: true,
|
|
14
|
+
name_label: 'Lab v2 (VLAN 11)',
|
|
15
|
+
id: '6b6ca0f5-6611-0636-4b0a-1fb1c8e96414',
|
|
16
|
+
href: '/rest/v0/networks/6b6ca0f5-6611-0636-4b0a-1fb1c8e96414',
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
export const network = {
|
|
20
|
+
automatic: false,
|
|
21
|
+
bridge: 'xenapi',
|
|
22
|
+
current_operations: {},
|
|
23
|
+
defaultIsLocked: false,
|
|
24
|
+
MTU: 1500,
|
|
25
|
+
name_description: 'Network on which guests will be assigned a private link-local IP address which can be used to talk XenAPI',
|
|
26
|
+
name_label: 'Host internal management network',
|
|
27
|
+
other_config: {
|
|
28
|
+
is_guest_installer_network: 'true',
|
|
29
|
+
is_host_internal_management_network: 'true',
|
|
30
|
+
ip_begin: '169.254.0.1',
|
|
31
|
+
ip_end: '169.254.255.254',
|
|
32
|
+
netmask: '255.255.0.0',
|
|
33
|
+
},
|
|
34
|
+
tags: [],
|
|
35
|
+
PIFs: [],
|
|
36
|
+
VIFs: [
|
|
37
|
+
'2d039fc8-e522-75db-34c9-536b9553bd5a',
|
|
38
|
+
'38623621-d30e-0307-dcef-eb7ed6c69f0c',
|
|
39
|
+
'cc4b090f-5ff1-254b-558f-f7ac237e6fc5',
|
|
40
|
+
'a9f3d042-a2e1-102f-74fc-ff1df41c6eb3',
|
|
41
|
+
],
|
|
42
|
+
nbd: false,
|
|
43
|
+
insecureNbd: false,
|
|
44
|
+
id: '9fe12ca3-d75d-cfb0-492e-cfd2bc6c568f',
|
|
45
|
+
type: 'network',
|
|
46
|
+
uuid: '9fe12ca3-d75d-cfb0-492e-cfd2bc6c568f',
|
|
47
|
+
$pool: 'b7569d99-30f8-178a-7d94-801de3e29b5b',
|
|
48
|
+
$poolId: 'b7569d99-30f8-178a-7d94-801de3e29b5b',
|
|
49
|
+
_xapiRef: 'OpaqueRef:eb906e77-2221-5399-4a26-60f0ad069b61',
|
|
50
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const userIds = [
|
|
2
|
+
'/rest/v0/users/088124f3-41b6-4258-9653-6eedc7b46111',
|
|
3
|
+
'/rest/v0/users/a8715f02-20e7-4881-8b02-28ce2260c39d',
|
|
4
|
+
];
|
|
5
|
+
export const partialUsers = [
|
|
6
|
+
{
|
|
7
|
+
permission: 'none',
|
|
8
|
+
name: 'testName',
|
|
9
|
+
id: '088124f3-41b6-4258-9653-6eedc7b46111',
|
|
10
|
+
href: '/rest/v0/users/088124f3-41b6-4258-9653-6eedc7b46111',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
permission: 'none',
|
|
14
|
+
id: 'a8715f02-20e7-4881-8b02-28ce2260c39d',
|
|
15
|
+
href: '/rest/v0/users/a8715f02-20e7-4881-8b02-28ce2260c39d',
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
export const user = {
|
|
19
|
+
email: 'admin@admin.net',
|
|
20
|
+
permission: 'admin',
|
|
21
|
+
pw_hash: '***obfuscated***',
|
|
22
|
+
groups: ['7d98fee4-3357-41a7-ac3f-9124212badb7', '7981ba62-c395-4546-bfa4-d1261653a77f'],
|
|
23
|
+
name: 'admin@admin.net',
|
|
24
|
+
preferences: {},
|
|
25
|
+
id: '722d17b9-699b-49d2-8193-be1ac573d3de',
|
|
26
|
+
};
|
|
@@ -16,6 +16,8 @@ import { VdiSnapshotController } from './../../vdi-snapshots/vdi-snapshot.contro
|
|
|
16
16
|
// 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
|
|
17
17
|
import { VbdController } from './../../vbds/vbd.controller.mjs';
|
|
18
18
|
// 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
|
|
19
|
+
import { UserController } from './../../users/user.controller.mjs';
|
|
20
|
+
// 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
|
|
19
21
|
import { SrController } from './../../srs/sr.controller.mjs';
|
|
20
22
|
// 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
|
|
21
23
|
import { ServerController } from './../../servers/server.controller.mjs';
|
|
@@ -24,11 +26,15 @@ import { ScheduleController } from './../../schedules/schedule.controller.mjs';
|
|
|
24
26
|
// 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
|
|
25
27
|
import { PoolController } from './../../pools/pool.controller.mjs';
|
|
26
28
|
// 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
|
|
29
|
+
import { NetworkController } from './../networks/network.controller.mjs';
|
|
30
|
+
// 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
|
|
27
31
|
import { AlarmController } from './../../alarms/alarm.controller.mjs';
|
|
28
32
|
// 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
|
|
29
33
|
import { MessageController } from './../../messages/message.controller.mjs';
|
|
30
34
|
// 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
|
|
31
35
|
import { HostController } from './../../hosts/host.controller.mjs';
|
|
36
|
+
// 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
|
|
37
|
+
import { GroupController } from './../../groups/group.controller.mjs';
|
|
32
38
|
import { expressAuthentication } from './../../middlewares/authentication.middleware.mjs';
|
|
33
39
|
// @ts-ignore - no great way to install types from subpackage
|
|
34
40
|
import { iocContainer } from './../../ioc/ioc.mjs';
|
|
@@ -220,6 +226,21 @@ const models = {
|
|
|
220
226
|
"type": { "dataType": "nestedObjectLiteral", "nestedProperties": { "$pool": { "dataType": "string", "required": true }, "$poolId": { "dataType": "string", "required": true }, "_xapiRef": { "dataType": "string", "required": true }, "uuid": { "dataType": "string", "required": true }, "attached": { "dataType": "boolean", "required": true }, "bootable": { "dataType": "boolean", "required": true }, "device": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "enum", "enums": [null] }], "required": true }, "id": { "dataType": "string", "required": true }, "is_cd_drive": { "dataType": "boolean", "required": true }, "position": { "dataType": "string", "required": true }, "read_only": { "dataType": "boolean", "required": true }, "type": { "dataType": "enum", "enums": ["VBD"], "required": true }, "VDI": { "dataType": "string", "required": true }, "VM": { "dataType": "string", "required": true } }, "validators": {} },
|
|
221
227
|
},
|
|
222
228
|
// 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
|
|
229
|
+
"Partial_Unbrand_XoUser__": {
|
|
230
|
+
"dataType": "refAlias",
|
|
231
|
+
"type": { "dataType": "nestedObjectLiteral", "nestedProperties": { "authProviders": { "dataType": "union", "subSchemas": [{ "ref": "Record_string.string_" }, { "dataType": "undefined" }] }, "email": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "groups": { "dataType": "union", "subSchemas": [{ "dataType": "array", "array": { "dataType": "string" } }, { "dataType": "undefined" }] }, "id": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "name": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "permission": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "pw_hash": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "preferences": { "dataType": "union", "subSchemas": [{ "ref": "Record_string.string_" }, { "dataType": "undefined" }] } }, "validators": {} },
|
|
232
|
+
},
|
|
233
|
+
// 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
|
|
234
|
+
"WithHref_Partial_Unbrand_XoUser___": {
|
|
235
|
+
"dataType": "refAlias",
|
|
236
|
+
"type": { "dataType": "intersection", "subSchemas": [{ "ref": "Partial_Unbrand_XoUser__" }, { "dataType": "nestedObjectLiteral", "nestedProperties": { "href": { "dataType": "string", "required": true } } }], "validators": {} },
|
|
237
|
+
},
|
|
238
|
+
// 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
|
|
239
|
+
"Unbrand_XoUser_": {
|
|
240
|
+
"dataType": "refAlias",
|
|
241
|
+
"type": { "dataType": "nestedObjectLiteral", "nestedProperties": { "authProviders": { "dataType": "union", "subSchemas": [{ "ref": "Record_string.string_" }, { "dataType": "undefined" }] }, "email": { "dataType": "string", "required": true }, "groups": { "dataType": "array", "array": { "dataType": "string" }, "required": true }, "id": { "dataType": "string", "required": true }, "name": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "permission": { "dataType": "string", "required": true }, "pw_hash": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "preferences": { "ref": "Record_string.string_", "required": true } }, "validators": {} },
|
|
242
|
+
},
|
|
243
|
+
// 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
|
|
223
244
|
"Record_string.STORAGE_OPERATIONS_": {
|
|
224
245
|
"dataType": "refAlias",
|
|
225
246
|
"type": { "dataType": "nestedObjectLiteral", "nestedProperties": {}, "validators": {} },
|
|
@@ -295,6 +316,26 @@ const models = {
|
|
|
295
316
|
"type": { "dataType": "nestedObjectLiteral", "nestedProperties": { "$pool": { "dataType": "string", "required": true }, "$poolId": { "dataType": "string", "required": true }, "_xapiRef": { "dataType": "string", "required": true }, "uuid": { "dataType": "string", "required": true }, "auto_poweron": { "dataType": "boolean", "required": true }, "cpus": { "dataType": "nestedObjectLiteral", "nestedProperties": { "sockets": { "dataType": "union", "subSchemas": [{ "dataType": "double" }, { "dataType": "undefined" }] }, "cores": { "dataType": "union", "subSchemas": [{ "dataType": "double" }, { "dataType": "undefined" }] } }, "required": true }, "crashDumpSr": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "current_operations": { "ref": "Record_string.POOL_ALLOWED_OPERATIONS_", "required": true }, "defaultSr": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "HA_enabled": { "dataType": "boolean", "required": true }, "haSrs": { "dataType": "array", "array": { "dataType": "string" }, "required": true }, "id": { "dataType": "string", "required": true }, "master": { "dataType": "string", "required": true }, "migrationCompression": { "dataType": "union", "subSchemas": [{ "dataType": "boolean" }, { "dataType": "undefined" }] }, "name_description": { "dataType": "string", "required": true }, "name_label": { "dataType": "string", "required": true }, "otherConfig": { "ref": "Record_string.string_", "required": true }, "platform_version": { "dataType": "string", "required": true }, "suspendSr": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "tags": { "dataType": "array", "array": { "dataType": "string" }, "required": true }, "type": { "dataType": "enum", "enums": ["pool"], "required": true }, "vtpmSupported": { "dataType": "boolean", "required": true }, "xosanPackInstallationTime": { "dataType": "union", "subSchemas": [{ "dataType": "double" }, { "dataType": "enum", "enums": [null] }], "required": true }, "zstdSupported": { "dataType": "boolean", "required": true } }, "validators": {} },
|
|
296
317
|
},
|
|
297
318
|
// 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
|
|
319
|
+
"Record_string.attaching_": {
|
|
320
|
+
"dataType": "refAlias",
|
|
321
|
+
"type": { "dataType": "nestedObjectLiteral", "nestedProperties": {}, "validators": {} },
|
|
322
|
+
},
|
|
323
|
+
// 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
|
|
324
|
+
"Partial_Unbrand_XoNetwork__": {
|
|
325
|
+
"dataType": "refAlias",
|
|
326
|
+
"type": { "dataType": "nestedObjectLiteral", "nestedProperties": { "$pool": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "$poolId": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "_xapiRef": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "uuid": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "MTU": { "dataType": "union", "subSchemas": [{ "dataType": "double" }, { "dataType": "undefined" }] }, "PIFs": { "dataType": "union", "subSchemas": [{ "dataType": "array", "array": { "dataType": "string" } }, { "dataType": "undefined" }] }, "VIFs": { "dataType": "union", "subSchemas": [{ "dataType": "array", "array": { "dataType": "string" } }, { "dataType": "undefined" }] }, "automatic": { "dataType": "union", "subSchemas": [{ "dataType": "boolean" }, { "dataType": "undefined" }] }, "bridge": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "current_operations": { "dataType": "union", "subSchemas": [{ "ref": "Record_string.attaching_" }, { "dataType": "undefined" }] }, "defaultIsLocked": { "dataType": "union", "subSchemas": [{ "dataType": "boolean" }, { "dataType": "undefined" }] }, "id": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "insecureNbd": { "dataType": "union", "subSchemas": [{ "dataType": "boolean" }, { "dataType": "undefined" }] }, "name_description": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "name_label": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "nbd": { "dataType": "union", "subSchemas": [{ "dataType": "boolean" }, { "dataType": "undefined" }] }, "other_config": { "dataType": "union", "subSchemas": [{ "ref": "Record_string.string_" }, { "dataType": "undefined" }] }, "tags": { "dataType": "union", "subSchemas": [{ "dataType": "array", "array": { "dataType": "string" } }, { "dataType": "undefined" }] }, "type": { "dataType": "union", "subSchemas": [{ "dataType": "enum", "enums": ["network"] }, { "dataType": "undefined" }] } }, "validators": {} },
|
|
327
|
+
},
|
|
328
|
+
// 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
|
|
329
|
+
"WithHref_Partial_Unbrand_XoNetwork___": {
|
|
330
|
+
"dataType": "refAlias",
|
|
331
|
+
"type": { "dataType": "intersection", "subSchemas": [{ "ref": "Partial_Unbrand_XoNetwork__" }, { "dataType": "nestedObjectLiteral", "nestedProperties": { "href": { "dataType": "string", "required": true } } }], "validators": {} },
|
|
332
|
+
},
|
|
333
|
+
// 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
|
|
334
|
+
"Unbrand_XoNetwork_": {
|
|
335
|
+
"dataType": "refAlias",
|
|
336
|
+
"type": { "dataType": "nestedObjectLiteral", "nestedProperties": { "$pool": { "dataType": "string", "required": true }, "$poolId": { "dataType": "string", "required": true }, "_xapiRef": { "dataType": "string", "required": true }, "uuid": { "dataType": "string", "required": true }, "MTU": { "dataType": "double", "required": true }, "PIFs": { "dataType": "array", "array": { "dataType": "string" }, "required": true }, "VIFs": { "dataType": "array", "array": { "dataType": "string" }, "required": true }, "automatic": { "dataType": "boolean", "required": true }, "bridge": { "dataType": "string", "required": true }, "current_operations": { "ref": "Record_string.attaching_", "required": true }, "defaultIsLocked": { "dataType": "boolean", "required": true }, "id": { "dataType": "string", "required": true }, "insecureNbd": { "dataType": "union", "subSchemas": [{ "dataType": "boolean" }, { "dataType": "undefined" }] }, "name_description": { "dataType": "string", "required": true }, "name_label": { "dataType": "string", "required": true }, "nbd": { "dataType": "union", "subSchemas": [{ "dataType": "boolean" }, { "dataType": "undefined" }] }, "other_config": { "ref": "Record_string.string_", "required": true }, "tags": { "dataType": "array", "array": { "dataType": "string" }, "required": true }, "type": { "dataType": "enum", "enums": ["network"], "required": true } }, "validators": {} },
|
|
337
|
+
},
|
|
338
|
+
// 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
|
|
298
339
|
"Partial_UnbrandedXoAlarm_": {
|
|
299
340
|
"dataType": "refAlias",
|
|
300
341
|
"type": { "dataType": "nestedObjectLiteral", "nestedProperties": { "$pool": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "$poolId": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "_xapiRef": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "uuid": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "id": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "type": { "dataType": "union", "subSchemas": [{ "dataType": "enum", "enums": ["message"] }, { "dataType": "undefined" }] }, "name": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "time": { "dataType": "union", "subSchemas": [{ "dataType": "double" }, { "dataType": "undefined" }] }, "body": { "dataType": "union", "subSchemas": [{ "dataType": "nestedObjectLiteral", "nestedProperties": { "name": { "dataType": "string", "required": true }, "value": { "dataType": "string", "required": true } } }, { "dataType": "undefined" }] }, "object": { "dataType": "union", "subSchemas": [{ "dataType": "nestedObjectLiteral", "nestedProperties": { "href": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "uuid": { "dataType": "string", "required": true }, "type": { "dataType": "union", "subSchemas": [{ "dataType": "enum", "enums": ["pool"] }, { "dataType": "enum", "enums": ["VBD"] }, { "dataType": "enum", "enums": ["VGPU"] }, { "dataType": "enum", "enums": ["host"] }, { "dataType": "enum", "enums": ["VIF"] }, { "dataType": "enum", "enums": ["VTPM"] }, { "dataType": "enum", "enums": ["VM"] }, { "dataType": "enum", "enums": ["VM-snapshot"] }, { "dataType": "enum", "enums": ["SR"] }, { "dataType": "enum", "enums": ["message"] }, { "dataType": "enum", "enums": ["network"] }, { "dataType": "enum", "enums": ["VDI"] }, { "dataType": "enum", "enums": ["VDI-snapshot"] }, { "dataType": "enum", "enums": ["VDI-unmanaged"] }, { "dataType": "enum", "enums": ["VM-controller"] }, { "dataType": "enum", "enums": ["VM-template"] }, { "dataType": "enum", "enums": ["unknown"] }], "required": true } } }, { "dataType": "undefined" }] } }, "validators": {} },
|
|
@@ -380,6 +421,21 @@ const models = {
|
|
|
380
421
|
"type": { "ref": "XapiStatsResponse__cpus-Record_string.number-Array_--ioThroughput_58__r-Record_string.number-Array_--w-Record_string.number-Array__--iops_58__r-Record_string.number-Array_--w-Record_string.number-Array__--iowait-Record_string.number-Array_--latency_58__r-Record_string.number-Array_--w-Record_string.number-Array__--load-number-Array--memory-number-Array--memoryFree-number-Array--pifs_58__rx-Record_string.number-Array_--tx-Record_string.number-Array____", "validators": {} },
|
|
381
422
|
},
|
|
382
423
|
// 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
|
|
424
|
+
"Partial_Unbrand_XoGroup__": {
|
|
425
|
+
"dataType": "refAlias",
|
|
426
|
+
"type": { "dataType": "nestedObjectLiteral", "nestedProperties": { "id": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "name": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "provider": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "providerGroupId": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "users": { "dataType": "union", "subSchemas": [{ "dataType": "array", "array": { "dataType": "string" } }, { "dataType": "undefined" }] } }, "validators": {} },
|
|
427
|
+
},
|
|
428
|
+
// 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
|
|
429
|
+
"WithHref_Partial_Unbrand_XoGroup___": {
|
|
430
|
+
"dataType": "refAlias",
|
|
431
|
+
"type": { "dataType": "intersection", "subSchemas": [{ "ref": "Partial_Unbrand_XoGroup__" }, { "dataType": "nestedObjectLiteral", "nestedProperties": { "href": { "dataType": "string", "required": true } } }], "validators": {} },
|
|
432
|
+
},
|
|
433
|
+
// 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
|
|
434
|
+
"Unbrand_XoGroup_": {
|
|
435
|
+
"dataType": "refAlias",
|
|
436
|
+
"type": { "dataType": "nestedObjectLiteral", "nestedProperties": { "id": { "dataType": "string", "required": true }, "name": { "dataType": "string", "required": true }, "provider": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "providerGroupId": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "users": { "dataType": "array", "array": { "dataType": "string" }, "required": true } }, "validators": {} },
|
|
437
|
+
},
|
|
438
|
+
// 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
|
|
383
439
|
};
|
|
384
440
|
const templateService = new ExpressTemplateService(models, { "noImplicitAdditionalProperties": "throw-on-extras", "bodyCoercion": true });
|
|
385
441
|
// 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
|
|
@@ -900,6 +956,63 @@ export function RegisterRoutes(app) {
|
|
|
900
956
|
}
|
|
901
957
|
});
|
|
902
958
|
// 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
|
|
959
|
+
const argsUserController_getUsers = {
|
|
960
|
+
req: { "in": "request", "name": "req", "required": true, "dataType": "object" },
|
|
961
|
+
fields: { "in": "query", "name": "fields", "dataType": "string" },
|
|
962
|
+
filter: { "in": "query", "name": "filter", "dataType": "string" },
|
|
963
|
+
limit: { "in": "query", "name": "limit", "dataType": "double" },
|
|
964
|
+
};
|
|
965
|
+
app.get('/rest/v0/users', authenticateMiddleware([{ "*": [] }]), ...(fetchMiddlewares(UserController)), ...(fetchMiddlewares(UserController.prototype.getUsers)), async function UserController_getUsers(request, response, next) {
|
|
966
|
+
// 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
|
|
967
|
+
let validatedArgs = [];
|
|
968
|
+
try {
|
|
969
|
+
validatedArgs = templateService.getValidatedArgs({ args: argsUserController_getUsers, request, response });
|
|
970
|
+
const container = typeof iocContainer === 'function' ? iocContainer(request) : iocContainer;
|
|
971
|
+
const controller = await container.get(UserController);
|
|
972
|
+
if (typeof controller['setStatus'] === 'function') {
|
|
973
|
+
controller.setStatus(undefined);
|
|
974
|
+
}
|
|
975
|
+
await templateService.apiHandler({
|
|
976
|
+
methodName: 'getUsers',
|
|
977
|
+
controller,
|
|
978
|
+
response,
|
|
979
|
+
next,
|
|
980
|
+
validatedArgs,
|
|
981
|
+
successStatus: undefined,
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
catch (err) {
|
|
985
|
+
return next(err);
|
|
986
|
+
}
|
|
987
|
+
});
|
|
988
|
+
// 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
|
|
989
|
+
const argsUserController_getUser = {
|
|
990
|
+
id: { "in": "path", "name": "id", "required": true, "dataType": "string" },
|
|
991
|
+
};
|
|
992
|
+
app.get('/rest/v0/users/:id', authenticateMiddleware([{ "*": [] }]), ...(fetchMiddlewares(UserController)), ...(fetchMiddlewares(UserController.prototype.getUser)), async function UserController_getUser(request, response, next) {
|
|
993
|
+
// 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
|
|
994
|
+
let validatedArgs = [];
|
|
995
|
+
try {
|
|
996
|
+
validatedArgs = templateService.getValidatedArgs({ args: argsUserController_getUser, request, response });
|
|
997
|
+
const container = typeof iocContainer === 'function' ? iocContainer(request) : iocContainer;
|
|
998
|
+
const controller = await container.get(UserController);
|
|
999
|
+
if (typeof controller['setStatus'] === 'function') {
|
|
1000
|
+
controller.setStatus(undefined);
|
|
1001
|
+
}
|
|
1002
|
+
await templateService.apiHandler({
|
|
1003
|
+
methodName: 'getUser',
|
|
1004
|
+
controller,
|
|
1005
|
+
response,
|
|
1006
|
+
next,
|
|
1007
|
+
validatedArgs,
|
|
1008
|
+
successStatus: undefined,
|
|
1009
|
+
});
|
|
1010
|
+
}
|
|
1011
|
+
catch (err) {
|
|
1012
|
+
return next(err);
|
|
1013
|
+
}
|
|
1014
|
+
});
|
|
1015
|
+
// 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
|
|
903
1016
|
const argsSrController_getSrs = {
|
|
904
1017
|
req: { "in": "request", "name": "req", "required": true, "dataType": "object" },
|
|
905
1018
|
fields: { "in": "query", "name": "fields", "dataType": "string" },
|
|
@@ -1156,6 +1269,63 @@ export function RegisterRoutes(app) {
|
|
|
1156
1269
|
}
|
|
1157
1270
|
});
|
|
1158
1271
|
// 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
|
|
1272
|
+
const argsNetworkController_getNetworks = {
|
|
1273
|
+
req: { "in": "request", "name": "req", "required": true, "dataType": "object" },
|
|
1274
|
+
fields: { "in": "query", "name": "fields", "dataType": "string" },
|
|
1275
|
+
filter: { "in": "query", "name": "filter", "dataType": "string" },
|
|
1276
|
+
limit: { "in": "query", "name": "limit", "dataType": "double" },
|
|
1277
|
+
};
|
|
1278
|
+
app.get('/rest/v0/networks', authenticateMiddleware([{ "*": [] }]), ...(fetchMiddlewares(NetworkController)), ...(fetchMiddlewares(NetworkController.prototype.getNetworks)), async function NetworkController_getNetworks(request, response, next) {
|
|
1279
|
+
// 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
|
|
1280
|
+
let validatedArgs = [];
|
|
1281
|
+
try {
|
|
1282
|
+
validatedArgs = templateService.getValidatedArgs({ args: argsNetworkController_getNetworks, request, response });
|
|
1283
|
+
const container = typeof iocContainer === 'function' ? iocContainer(request) : iocContainer;
|
|
1284
|
+
const controller = await container.get(NetworkController);
|
|
1285
|
+
if (typeof controller['setStatus'] === 'function') {
|
|
1286
|
+
controller.setStatus(undefined);
|
|
1287
|
+
}
|
|
1288
|
+
await templateService.apiHandler({
|
|
1289
|
+
methodName: 'getNetworks',
|
|
1290
|
+
controller,
|
|
1291
|
+
response,
|
|
1292
|
+
next,
|
|
1293
|
+
validatedArgs,
|
|
1294
|
+
successStatus: undefined,
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
catch (err) {
|
|
1298
|
+
return next(err);
|
|
1299
|
+
}
|
|
1300
|
+
});
|
|
1301
|
+
// 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
|
|
1302
|
+
const argsNetworkController_getNetwork = {
|
|
1303
|
+
id: { "in": "path", "name": "id", "required": true, "dataType": "string" },
|
|
1304
|
+
};
|
|
1305
|
+
app.get('/rest/v0/networks/:id', authenticateMiddleware([{ "*": [] }]), ...(fetchMiddlewares(NetworkController)), ...(fetchMiddlewares(NetworkController.prototype.getNetwork)), async function NetworkController_getNetwork(request, response, next) {
|
|
1306
|
+
// 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
|
|
1307
|
+
let validatedArgs = [];
|
|
1308
|
+
try {
|
|
1309
|
+
validatedArgs = templateService.getValidatedArgs({ args: argsNetworkController_getNetwork, request, response });
|
|
1310
|
+
const container = typeof iocContainer === 'function' ? iocContainer(request) : iocContainer;
|
|
1311
|
+
const controller = await container.get(NetworkController);
|
|
1312
|
+
if (typeof controller['setStatus'] === 'function') {
|
|
1313
|
+
controller.setStatus(undefined);
|
|
1314
|
+
}
|
|
1315
|
+
await templateService.apiHandler({
|
|
1316
|
+
methodName: 'getNetwork',
|
|
1317
|
+
controller,
|
|
1318
|
+
response,
|
|
1319
|
+
next,
|
|
1320
|
+
validatedArgs,
|
|
1321
|
+
successStatus: undefined,
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
catch (err) {
|
|
1325
|
+
return next(err);
|
|
1326
|
+
}
|
|
1327
|
+
});
|
|
1328
|
+
// 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
|
|
1159
1329
|
const argsAlarmController_getAlarms = {
|
|
1160
1330
|
req: { "in": "request", "name": "req", "required": true, "dataType": "object" },
|
|
1161
1331
|
fields: { "in": "query", "name": "fields", "dataType": "string" },
|
|
@@ -1355,6 +1525,63 @@ export function RegisterRoutes(app) {
|
|
|
1355
1525
|
}
|
|
1356
1526
|
});
|
|
1357
1527
|
// 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
|
|
1528
|
+
const argsGroupController_getGroups = {
|
|
1529
|
+
req: { "in": "request", "name": "req", "required": true, "dataType": "object" },
|
|
1530
|
+
fields: { "in": "query", "name": "fields", "dataType": "string" },
|
|
1531
|
+
filter: { "in": "query", "name": "filter", "dataType": "string" },
|
|
1532
|
+
limit: { "in": "query", "name": "limit", "dataType": "double" },
|
|
1533
|
+
};
|
|
1534
|
+
app.get('/rest/v0/groups', authenticateMiddleware([{ "*": [] }]), ...(fetchMiddlewares(GroupController)), ...(fetchMiddlewares(GroupController.prototype.getGroups)), async function GroupController_getGroups(request, response, next) {
|
|
1535
|
+
// 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
|
|
1536
|
+
let validatedArgs = [];
|
|
1537
|
+
try {
|
|
1538
|
+
validatedArgs = templateService.getValidatedArgs({ args: argsGroupController_getGroups, request, response });
|
|
1539
|
+
const container = typeof iocContainer === 'function' ? iocContainer(request) : iocContainer;
|
|
1540
|
+
const controller = await container.get(GroupController);
|
|
1541
|
+
if (typeof controller['setStatus'] === 'function') {
|
|
1542
|
+
controller.setStatus(undefined);
|
|
1543
|
+
}
|
|
1544
|
+
await templateService.apiHandler({
|
|
1545
|
+
methodName: 'getGroups',
|
|
1546
|
+
controller,
|
|
1547
|
+
response,
|
|
1548
|
+
next,
|
|
1549
|
+
validatedArgs,
|
|
1550
|
+
successStatus: undefined,
|
|
1551
|
+
});
|
|
1552
|
+
}
|
|
1553
|
+
catch (err) {
|
|
1554
|
+
return next(err);
|
|
1555
|
+
}
|
|
1556
|
+
});
|
|
1557
|
+
// 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
|
|
1558
|
+
const argsGroupController_getGroup = {
|
|
1559
|
+
id: { "in": "path", "name": "id", "required": true, "dataType": "string" },
|
|
1560
|
+
};
|
|
1561
|
+
app.get('/rest/v0/groups/:id', authenticateMiddleware([{ "*": [] }]), ...(fetchMiddlewares(GroupController)), ...(fetchMiddlewares(GroupController.prototype.getGroup)), async function GroupController_getGroup(request, response, next) {
|
|
1562
|
+
// 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
|
|
1563
|
+
let validatedArgs = [];
|
|
1564
|
+
try {
|
|
1565
|
+
validatedArgs = templateService.getValidatedArgs({ args: argsGroupController_getGroup, request, response });
|
|
1566
|
+
const container = typeof iocContainer === 'function' ? iocContainer(request) : iocContainer;
|
|
1567
|
+
const controller = await container.get(GroupController);
|
|
1568
|
+
if (typeof controller['setStatus'] === 'function') {
|
|
1569
|
+
controller.setStatus(undefined);
|
|
1570
|
+
}
|
|
1571
|
+
await templateService.apiHandler({
|
|
1572
|
+
methodName: 'getGroup',
|
|
1573
|
+
controller,
|
|
1574
|
+
response,
|
|
1575
|
+
next,
|
|
1576
|
+
validatedArgs,
|
|
1577
|
+
successStatus: undefined,
|
|
1578
|
+
});
|
|
1579
|
+
}
|
|
1580
|
+
catch (err) {
|
|
1581
|
+
return next(err);
|
|
1582
|
+
}
|
|
1583
|
+
});
|
|
1584
|
+
// 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
|
|
1358
1585
|
// 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
|
|
1359
1586
|
// 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
|
|
1360
1587
|
function authenticateMiddleware(security = []) {
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
};
|
|
10
|
+
import { Example, Get, Path, Query, Request, Response, Route, Security, Tags } from 'tsoa';
|
|
11
|
+
import { provide } from 'inversify-binding-decorators';
|
|
12
|
+
import { notFoundResp, unauthorizedResp } from '../open-api/common/response.common.mjs';
|
|
13
|
+
import { partialUsers, user, userIds } from '../open-api/oa-examples/user.oa-example.mjs';
|
|
14
|
+
import { XoController } from '../abstract-classes/xo-controller.mjs';
|
|
15
|
+
let UserController = class UserController extends XoController {
|
|
16
|
+
// --- abstract methods
|
|
17
|
+
async getAllCollectionObjects() {
|
|
18
|
+
const users = await this.restApi.xoApp.getAllUsers();
|
|
19
|
+
return users.map(user => this.#sanitizeUser(user));
|
|
20
|
+
}
|
|
21
|
+
async getCollectionObject(id) {
|
|
22
|
+
const user = await this.restApi.xoApp.getUser(id);
|
|
23
|
+
return this.#sanitizeUser(user);
|
|
24
|
+
}
|
|
25
|
+
#sanitizeUser(user) {
|
|
26
|
+
const sanitizedUser = { ...user };
|
|
27
|
+
if (sanitizedUser.pw_hash !== undefined) {
|
|
28
|
+
sanitizedUser.pw_hash = '***obfuscated***';
|
|
29
|
+
}
|
|
30
|
+
return sanitizedUser;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @example fields "permission,name,id"
|
|
34
|
+
* @example filter "permission:none"
|
|
35
|
+
* @example limit 42
|
|
36
|
+
*/
|
|
37
|
+
async getUsers(req, fields, filter, limit) {
|
|
38
|
+
const users = Object.values(await this.getObjects({ filter, limit }));
|
|
39
|
+
return this.sendObjects(users, req);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @example id "722d17b9-699b-49d2-8193-be1ac573d3de"
|
|
43
|
+
*/
|
|
44
|
+
getUser(id) {
|
|
45
|
+
return this.getObject(id);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
__decorate([
|
|
49
|
+
Example(userIds),
|
|
50
|
+
Example(partialUsers),
|
|
51
|
+
Get(''),
|
|
52
|
+
__param(0, Request()),
|
|
53
|
+
__param(1, Query()),
|
|
54
|
+
__param(2, Query()),
|
|
55
|
+
__param(3, Query())
|
|
56
|
+
], UserController.prototype, "getUsers", null);
|
|
57
|
+
__decorate([
|
|
58
|
+
Example(user),
|
|
59
|
+
Get('{id}'),
|
|
60
|
+
Response(notFoundResp.status, notFoundResp.description),
|
|
61
|
+
__param(0, Path())
|
|
62
|
+
], UserController.prototype, "getUser", null);
|
|
63
|
+
UserController = __decorate([
|
|
64
|
+
Route('users'),
|
|
65
|
+
Security('*'),
|
|
66
|
+
Response(unauthorizedResp.status, unauthorizedResp.description),
|
|
67
|
+
Tags('users'),
|
|
68
|
+
provide(UserController)
|
|
69
|
+
], UserController);
|
|
70
|
+
export { UserController };
|