@xen-orchestra/rest-api 0.5.0 → 0.7.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.
@@ -26,11 +26,15 @@ import { ScheduleController } from './../../schedules/schedule.controller.mjs';
26
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
27
27
  import { PoolController } from './../../pools/pool.controller.mjs';
28
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
29
31
  import { AlarmController } from './../../alarms/alarm.controller.mjs';
30
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
31
33
  import { MessageController } from './../../messages/message.controller.mjs';
32
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
33
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';
34
38
  import { expressAuthentication } from './../../middlewares/authentication.middleware.mjs';
35
39
  // @ts-ignore - no great way to install types from subpackage
36
40
  import { iocContainer } from './../../ioc/ioc.mjs';
@@ -277,6 +281,20 @@ const models = {
277
281
  "type": { "dataType": "nestedObjectLiteral", "nestedProperties": { "allowUnauthorized": { "dataType": "boolean", "required": true }, "enabled": { "dataType": "boolean", "required": true }, "error": { "dataType": "union", "subSchemas": [{ "ref": "Record_string.unknown_" }, { "dataType": "undefined" }] }, "host": { "dataType": "string", "required": true }, "httpProxy": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "id": { "dataType": "string", "required": true }, "label": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "poolId": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "poolNameDescription": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "poolNameLabel": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "readOnly": { "dataType": "boolean", "required": true }, "status": { "dataType": "union", "subSchemas": [{ "dataType": "enum", "enums": ["connected"] }, { "dataType": "enum", "enums": ["disconnected"] }, { "dataType": "enum", "enums": ["connecting"] }], "required": true }, "username": { "dataType": "string", "required": true } }, "validators": {} },
278
282
  },
279
283
  // 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
284
+ "InsertableXoServer": {
285
+ "dataType": "refObject",
286
+ "properties": {
287
+ "host": { "dataType": "string", "required": true },
288
+ "httpProxy": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] },
289
+ "label": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] },
290
+ "username": { "dataType": "string", "required": true },
291
+ "allowUnauthorized": { "dataType": "boolean" },
292
+ "password": { "dataType": "string", "required": true },
293
+ "readOnly": { "dataType": "boolean" },
294
+ },
295
+ "additionalProperties": false,
296
+ },
297
+ // 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
280
298
  "Partial_Unbrand_XoSchedule__": {
281
299
  "dataType": "refAlias",
282
300
  "type": { "dataType": "nestedObjectLiteral", "nestedProperties": { "cron": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "enable": { "dataType": "union", "subSchemas": [{ "dataType": "boolean" }, { "dataType": "undefined" }] }, "id": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "jobId": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "name": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] }, "timezone": { "dataType": "union", "subSchemas": [{ "dataType": "string" }, { "dataType": "undefined" }] } }, "validators": {} },
@@ -312,6 +330,26 @@ const models = {
312
330
  "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": {} },
313
331
  },
314
332
  // 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
333
+ "Record_string.attaching_": {
334
+ "dataType": "refAlias",
335
+ "type": { "dataType": "nestedObjectLiteral", "nestedProperties": {}, "validators": {} },
336
+ },
337
+ // 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
338
+ "Partial_Unbrand_XoNetwork__": {
339
+ "dataType": "refAlias",
340
+ "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": {} },
341
+ },
342
+ // 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
343
+ "WithHref_Partial_Unbrand_XoNetwork___": {
344
+ "dataType": "refAlias",
345
+ "type": { "dataType": "intersection", "subSchemas": [{ "ref": "Partial_Unbrand_XoNetwork__" }, { "dataType": "nestedObjectLiteral", "nestedProperties": { "href": { "dataType": "string", "required": true } } }], "validators": {} },
346
+ },
347
+ // 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
348
+ "Unbrand_XoNetwork_": {
349
+ "dataType": "refAlias",
350
+ "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": {} },
351
+ },
352
+ // 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
315
353
  "Partial_UnbrandedXoAlarm_": {
316
354
  "dataType": "refAlias",
317
355
  "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": {} },
@@ -397,6 +435,21 @@ const models = {
397
435
  "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": {} },
398
436
  },
399
437
  // 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
438
+ "Partial_Unbrand_XoGroup__": {
439
+ "dataType": "refAlias",
440
+ "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": {} },
441
+ },
442
+ // 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
443
+ "WithHref_Partial_Unbrand_XoGroup___": {
444
+ "dataType": "refAlias",
445
+ "type": { "dataType": "intersection", "subSchemas": [{ "ref": "Partial_Unbrand_XoGroup__" }, { "dataType": "nestedObjectLiteral", "nestedProperties": { "href": { "dataType": "string", "required": true } } }], "validators": {} },
446
+ },
447
+ // 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
448
+ "Unbrand_XoGroup_": {
449
+ "dataType": "refAlias",
450
+ "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": {} },
451
+ },
452
+ // 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
400
453
  };
401
454
  const templateService = new ExpressTemplateService(models, { "noImplicitAdditionalProperties": "throw-on-extras", "bodyCoercion": true });
402
455
  // 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
@@ -518,6 +571,118 @@ export function RegisterRoutes(app) {
518
571
  }
519
572
  });
520
573
  // 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
574
+ const argsVmController_cleanShutdownVm = {
575
+ id: { "in": "path", "name": "id", "required": true, "dataType": "string" },
576
+ sync: { "in": "query", "name": "sync", "dataType": "boolean" },
577
+ };
578
+ app.post('/rest/v0/vms/:id/actions/clean_shutdown', authenticateMiddleware([{ "*": [] }]), ...(fetchMiddlewares(VmController)), ...(fetchMiddlewares(VmController.prototype.cleanShutdownVm)), async function VmController_cleanShutdownVm(request, response, next) {
579
+ // 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
580
+ let validatedArgs = [];
581
+ try {
582
+ validatedArgs = templateService.getValidatedArgs({ args: argsVmController_cleanShutdownVm, request, response });
583
+ const container = typeof iocContainer === 'function' ? iocContainer(request) : iocContainer;
584
+ const controller = await container.get(VmController);
585
+ if (typeof controller['setStatus'] === 'function') {
586
+ controller.setStatus(undefined);
587
+ }
588
+ await templateService.apiHandler({
589
+ methodName: 'cleanShutdownVm',
590
+ controller,
591
+ response,
592
+ next,
593
+ validatedArgs,
594
+ successStatus: 202,
595
+ });
596
+ }
597
+ catch (err) {
598
+ return next(err);
599
+ }
600
+ });
601
+ // 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
602
+ const argsVmController_cleanRebootVm = {
603
+ id: { "in": "path", "name": "id", "required": true, "dataType": "string" },
604
+ sync: { "in": "query", "name": "sync", "dataType": "boolean" },
605
+ };
606
+ app.post('/rest/v0/vms/:id/actions/clean_reboot', authenticateMiddleware([{ "*": [] }]), ...(fetchMiddlewares(VmController)), ...(fetchMiddlewares(VmController.prototype.cleanRebootVm)), async function VmController_cleanRebootVm(request, response, next) {
607
+ // 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
608
+ let validatedArgs = [];
609
+ try {
610
+ validatedArgs = templateService.getValidatedArgs({ args: argsVmController_cleanRebootVm, request, response });
611
+ const container = typeof iocContainer === 'function' ? iocContainer(request) : iocContainer;
612
+ const controller = await container.get(VmController);
613
+ if (typeof controller['setStatus'] === 'function') {
614
+ controller.setStatus(undefined);
615
+ }
616
+ await templateService.apiHandler({
617
+ methodName: 'cleanRebootVm',
618
+ controller,
619
+ response,
620
+ next,
621
+ validatedArgs,
622
+ successStatus: undefined,
623
+ });
624
+ }
625
+ catch (err) {
626
+ return next(err);
627
+ }
628
+ });
629
+ // 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
630
+ const argsVmController_hardShutdownVm = {
631
+ id: { "in": "path", "name": "id", "required": true, "dataType": "string" },
632
+ sync: { "in": "query", "name": "sync", "dataType": "boolean" },
633
+ };
634
+ app.post('/rest/v0/vms/:id/actions/hard_shutdown', authenticateMiddleware([{ "*": [] }]), ...(fetchMiddlewares(VmController)), ...(fetchMiddlewares(VmController.prototype.hardShutdownVm)), async function VmController_hardShutdownVm(request, response, next) {
635
+ // 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
636
+ let validatedArgs = [];
637
+ try {
638
+ validatedArgs = templateService.getValidatedArgs({ args: argsVmController_hardShutdownVm, request, response });
639
+ const container = typeof iocContainer === 'function' ? iocContainer(request) : iocContainer;
640
+ const controller = await container.get(VmController);
641
+ if (typeof controller['setStatus'] === 'function') {
642
+ controller.setStatus(undefined);
643
+ }
644
+ await templateService.apiHandler({
645
+ methodName: 'hardShutdownVm',
646
+ controller,
647
+ response,
648
+ next,
649
+ validatedArgs,
650
+ successStatus: 202,
651
+ });
652
+ }
653
+ catch (err) {
654
+ return next(err);
655
+ }
656
+ });
657
+ // 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
658
+ const argsVmController_hardRebootVm = {
659
+ id: { "in": "path", "name": "id", "required": true, "dataType": "string" },
660
+ sync: { "in": "query", "name": "sync", "dataType": "boolean" },
661
+ };
662
+ app.post('/rest/v0/vms/:id/actions/hard_reboot', authenticateMiddleware([{ "*": [] }]), ...(fetchMiddlewares(VmController)), ...(fetchMiddlewares(VmController.prototype.hardRebootVm)), async function VmController_hardRebootVm(request, response, next) {
663
+ // 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
664
+ let validatedArgs = [];
665
+ try {
666
+ validatedArgs = templateService.getValidatedArgs({ args: argsVmController_hardRebootVm, request, response });
667
+ const container = typeof iocContainer === 'function' ? iocContainer(request) : iocContainer;
668
+ const controller = await container.get(VmController);
669
+ if (typeof controller['setStatus'] === 'function') {
670
+ controller.setStatus(undefined);
671
+ }
672
+ await templateService.apiHandler({
673
+ methodName: 'hardRebootVm',
674
+ controller,
675
+ response,
676
+ next,
677
+ validatedArgs,
678
+ successStatus: 202,
679
+ });
680
+ }
681
+ catch (err) {
682
+ return next(err);
683
+ }
684
+ });
685
+ // 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
521
686
  const argsVmTemplateController_getVmTemplates = {
522
687
  req: { "in": "request", "name": "req", "required": true, "dataType": "object" },
523
688
  fields: { "in": "query", "name": "fields", "dataType": "string" },
@@ -1088,6 +1253,89 @@ export function RegisterRoutes(app) {
1088
1253
  }
1089
1254
  });
1090
1255
  // 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
1256
+ const argsServerController_addServer = {
1257
+ body: { "in": "body", "name": "body", "required": true, "ref": "InsertableXoServer" },
1258
+ };
1259
+ app.post('/rest/v0/servers', authenticateMiddleware([{ "*": [] }]), ...(fetchMiddlewares(ServerController)), ...(fetchMiddlewares(ServerController.prototype.addServer)), async function ServerController_addServer(request, response, next) {
1260
+ // 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
1261
+ let validatedArgs = [];
1262
+ try {
1263
+ validatedArgs = templateService.getValidatedArgs({ args: argsServerController_addServer, request, response });
1264
+ const container = typeof iocContainer === 'function' ? iocContainer(request) : iocContainer;
1265
+ const controller = await container.get(ServerController);
1266
+ if (typeof controller['setStatus'] === 'function') {
1267
+ controller.setStatus(undefined);
1268
+ }
1269
+ await templateService.apiHandler({
1270
+ methodName: 'addServer',
1271
+ controller,
1272
+ response,
1273
+ next,
1274
+ validatedArgs,
1275
+ successStatus: 201,
1276
+ });
1277
+ }
1278
+ catch (err) {
1279
+ return next(err);
1280
+ }
1281
+ });
1282
+ // 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
1283
+ const argsServerController_connectServer = {
1284
+ id: { "in": "path", "name": "id", "required": true, "dataType": "string" },
1285
+ sync: { "in": "query", "name": "sync", "dataType": "boolean" },
1286
+ };
1287
+ app.post('/rest/v0/servers/:id/actions/connect', authenticateMiddleware([{ "*": [] }]), ...(fetchMiddlewares(ServerController)), ...(fetchMiddlewares(ServerController.prototype.connectServer)), async function ServerController_connectServer(request, response, next) {
1288
+ // 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
1289
+ let validatedArgs = [];
1290
+ try {
1291
+ validatedArgs = templateService.getValidatedArgs({ args: argsServerController_connectServer, request, response });
1292
+ const container = typeof iocContainer === 'function' ? iocContainer(request) : iocContainer;
1293
+ const controller = await container.get(ServerController);
1294
+ if (typeof controller['setStatus'] === 'function') {
1295
+ controller.setStatus(undefined);
1296
+ }
1297
+ await templateService.apiHandler({
1298
+ methodName: 'connectServer',
1299
+ controller,
1300
+ response,
1301
+ next,
1302
+ validatedArgs,
1303
+ successStatus: 202,
1304
+ });
1305
+ }
1306
+ catch (err) {
1307
+ return next(err);
1308
+ }
1309
+ });
1310
+ // 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
1311
+ const argsServerController_disconnectServer = {
1312
+ id: { "in": "path", "name": "id", "required": true, "dataType": "string" },
1313
+ sync: { "in": "query", "name": "sync", "dataType": "boolean" },
1314
+ };
1315
+ app.post('/rest/v0/servers/:id/actions/disconnect', authenticateMiddleware([{ "*": [] }]), ...(fetchMiddlewares(ServerController)), ...(fetchMiddlewares(ServerController.prototype.disconnectServer)), async function ServerController_disconnectServer(request, response, next) {
1316
+ // 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
1317
+ let validatedArgs = [];
1318
+ try {
1319
+ validatedArgs = templateService.getValidatedArgs({ args: argsServerController_disconnectServer, request, response });
1320
+ const container = typeof iocContainer === 'function' ? iocContainer(request) : iocContainer;
1321
+ const controller = await container.get(ServerController);
1322
+ if (typeof controller['setStatus'] === 'function') {
1323
+ controller.setStatus(undefined);
1324
+ }
1325
+ await templateService.apiHandler({
1326
+ methodName: 'disconnectServer',
1327
+ controller,
1328
+ response,
1329
+ next,
1330
+ validatedArgs,
1331
+ successStatus: 202,
1332
+ });
1333
+ }
1334
+ catch (err) {
1335
+ return next(err);
1336
+ }
1337
+ });
1338
+ // 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
1091
1339
  const argsScheduleController_getSchedules = {
1092
1340
  req: { "in": "request", "name": "req", "required": true, "dataType": "object" },
1093
1341
  fields: { "in": "query", "name": "fields", "dataType": "string" },
@@ -1230,6 +1478,63 @@ export function RegisterRoutes(app) {
1230
1478
  }
1231
1479
  });
1232
1480
  // 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
1481
+ const argsNetworkController_getNetworks = {
1482
+ req: { "in": "request", "name": "req", "required": true, "dataType": "object" },
1483
+ fields: { "in": "query", "name": "fields", "dataType": "string" },
1484
+ filter: { "in": "query", "name": "filter", "dataType": "string" },
1485
+ limit: { "in": "query", "name": "limit", "dataType": "double" },
1486
+ };
1487
+ app.get('/rest/v0/networks', authenticateMiddleware([{ "*": [] }]), ...(fetchMiddlewares(NetworkController)), ...(fetchMiddlewares(NetworkController.prototype.getNetworks)), async function NetworkController_getNetworks(request, response, next) {
1488
+ // 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
1489
+ let validatedArgs = [];
1490
+ try {
1491
+ validatedArgs = templateService.getValidatedArgs({ args: argsNetworkController_getNetworks, request, response });
1492
+ const container = typeof iocContainer === 'function' ? iocContainer(request) : iocContainer;
1493
+ const controller = await container.get(NetworkController);
1494
+ if (typeof controller['setStatus'] === 'function') {
1495
+ controller.setStatus(undefined);
1496
+ }
1497
+ await templateService.apiHandler({
1498
+ methodName: 'getNetworks',
1499
+ controller,
1500
+ response,
1501
+ next,
1502
+ validatedArgs,
1503
+ successStatus: undefined,
1504
+ });
1505
+ }
1506
+ catch (err) {
1507
+ return next(err);
1508
+ }
1509
+ });
1510
+ // 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
1511
+ const argsNetworkController_getNetwork = {
1512
+ id: { "in": "path", "name": "id", "required": true, "dataType": "string" },
1513
+ };
1514
+ app.get('/rest/v0/networks/:id', authenticateMiddleware([{ "*": [] }]), ...(fetchMiddlewares(NetworkController)), ...(fetchMiddlewares(NetworkController.prototype.getNetwork)), async function NetworkController_getNetwork(request, response, next) {
1515
+ // 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
1516
+ let validatedArgs = [];
1517
+ try {
1518
+ validatedArgs = templateService.getValidatedArgs({ args: argsNetworkController_getNetwork, request, response });
1519
+ const container = typeof iocContainer === 'function' ? iocContainer(request) : iocContainer;
1520
+ const controller = await container.get(NetworkController);
1521
+ if (typeof controller['setStatus'] === 'function') {
1522
+ controller.setStatus(undefined);
1523
+ }
1524
+ await templateService.apiHandler({
1525
+ methodName: 'getNetwork',
1526
+ controller,
1527
+ response,
1528
+ next,
1529
+ validatedArgs,
1530
+ successStatus: undefined,
1531
+ });
1532
+ }
1533
+ catch (err) {
1534
+ return next(err);
1535
+ }
1536
+ });
1537
+ // 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
1233
1538
  const argsAlarmController_getAlarms = {
1234
1539
  req: { "in": "request", "name": "req", "required": true, "dataType": "object" },
1235
1540
  fields: { "in": "query", "name": "fields", "dataType": "string" },
@@ -1429,6 +1734,63 @@ export function RegisterRoutes(app) {
1429
1734
  }
1430
1735
  });
1431
1736
  // 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
1737
+ const argsGroupController_getGroups = {
1738
+ req: { "in": "request", "name": "req", "required": true, "dataType": "object" },
1739
+ fields: { "in": "query", "name": "fields", "dataType": "string" },
1740
+ filter: { "in": "query", "name": "filter", "dataType": "string" },
1741
+ limit: { "in": "query", "name": "limit", "dataType": "double" },
1742
+ };
1743
+ app.get('/rest/v0/groups', authenticateMiddleware([{ "*": [] }]), ...(fetchMiddlewares(GroupController)), ...(fetchMiddlewares(GroupController.prototype.getGroups)), async function GroupController_getGroups(request, response, next) {
1744
+ // 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
1745
+ let validatedArgs = [];
1746
+ try {
1747
+ validatedArgs = templateService.getValidatedArgs({ args: argsGroupController_getGroups, request, response });
1748
+ const container = typeof iocContainer === 'function' ? iocContainer(request) : iocContainer;
1749
+ const controller = await container.get(GroupController);
1750
+ if (typeof controller['setStatus'] === 'function') {
1751
+ controller.setStatus(undefined);
1752
+ }
1753
+ await templateService.apiHandler({
1754
+ methodName: 'getGroups',
1755
+ controller,
1756
+ response,
1757
+ next,
1758
+ validatedArgs,
1759
+ successStatus: undefined,
1760
+ });
1761
+ }
1762
+ catch (err) {
1763
+ return next(err);
1764
+ }
1765
+ });
1766
+ // 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
1767
+ const argsGroupController_getGroup = {
1768
+ id: { "in": "path", "name": "id", "required": true, "dataType": "string" },
1769
+ };
1770
+ app.get('/rest/v0/groups/:id', authenticateMiddleware([{ "*": [] }]), ...(fetchMiddlewares(GroupController)), ...(fetchMiddlewares(GroupController.prototype.getGroup)), async function GroupController_getGroup(request, response, next) {
1771
+ // 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
1772
+ let validatedArgs = [];
1773
+ try {
1774
+ validatedArgs = templateService.getValidatedArgs({ args: argsGroupController_getGroup, request, response });
1775
+ const container = typeof iocContainer === 'function' ? iocContainer(request) : iocContainer;
1776
+ const controller = await container.get(GroupController);
1777
+ if (typeof controller['setStatus'] === 'function') {
1778
+ controller.setStatus(undefined);
1779
+ }
1780
+ await templateService.apiHandler({
1781
+ methodName: 'getGroup',
1782
+ controller,
1783
+ response,
1784
+ next,
1785
+ validatedArgs,
1786
+ successStatus: undefined,
1787
+ });
1788
+ }
1789
+ catch (err) {
1790
+ return next(err);
1791
+ }
1792
+ });
1793
+ // 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
1432
1794
  // 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
1433
1795
  // 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
1434
1796
  function authenticateMiddleware(security = []) {
@@ -7,10 +7,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __param = (this && this.__param) || function (paramIndex, decorator) {
8
8
  return function (target, key) { decorator(target, key, paramIndex); }
9
9
  };
10
- import { Example, Get, Path, Query, Request, Response, Route, Security, Tags } from 'tsoa';
10
+ import { Body, Example, Get, Middlewares, Path, Post, Query, Request, Response, Route, Security, SuccessResponse, Tags, } from 'tsoa';
11
+ import { json } from 'express';
11
12
  import { provide } from 'inversify-binding-decorators';
12
- import { notFoundResp, unauthorizedResp } from '../open-api/common/response.common.mjs';
13
- import { partialServers, server, serverIds } from '../open-api/oa-examples/server.oa-example.mjs';
13
+ import { actionAsyncroneResp, createdResp, invalidParameters, noContentResp, notFoundResp, resourceAlreadyExists, unauthorizedResp, } from '../open-api/common/response.common.mjs';
14
+ import { partialServers, server, serverId, serverIds } from '../open-api/oa-examples/server.oa-example.mjs';
15
+ import { taskLocation } from '../open-api/oa-examples/task.oa-example.mjs';
14
16
  import { XoController } from '../abstract-classes/xo-controller.mjs';
15
17
  let ServerController = class ServerController extends XoController {
16
18
  // --- abstract methods
@@ -34,6 +36,47 @@ let ServerController = class ServerController extends XoController {
34
36
  getServer(id) {
35
37
  return this.getObject(id);
36
38
  }
39
+ /**
40
+ * @example body {
41
+ * "allowUnauthorized": true,
42
+ * "host": "192.168.1.10",
43
+ * "label": "Example server",
44
+ * "username": "root",
45
+ * "password": "awes0meP4ssword"
46
+ * }
47
+ */
48
+ async addServer(body) {
49
+ const server = await this.restApi.xoApp.registerXenServer(body);
50
+ return { id: server.id };
51
+ }
52
+ /**
53
+ * @example id "f07ab729-c0e8-721c-45ec-f11276377030"
54
+ */
55
+ connectServer(id, sync) {
56
+ const serverId = id;
57
+ const action = async () => {
58
+ await this.restApi.xoApp.connectXenServer(serverId);
59
+ };
60
+ return this.createAction(action, {
61
+ statusCode: noContentResp.status,
62
+ sync,
63
+ taskProperties: { name: 'connect server', objectId: serverId },
64
+ });
65
+ }
66
+ /**
67
+ * @example id "f07ab729-c0e8-721c-45ec-f11276377030"
68
+ */
69
+ disconnectServer(id, sync) {
70
+ const serverId = id;
71
+ const action = async () => {
72
+ await this.restApi.xoApp.disconnectXenServer(serverId);
73
+ };
74
+ return this.createAction(action, {
75
+ statusCode: noContentResp.status,
76
+ sync,
77
+ taskProperties: { name: 'disconnect server', objectId: serverId },
78
+ });
79
+ }
37
80
  };
38
81
  __decorate([
39
82
  Example(serverIds),
@@ -50,6 +93,35 @@ __decorate([
50
93
  Response(notFoundResp.status, notFoundResp.description),
51
94
  __param(0, Path())
52
95
  ], ServerController.prototype, "getServer", null);
96
+ __decorate([
97
+ Example(serverId),
98
+ Post(''),
99
+ Middlewares(json()),
100
+ SuccessResponse(createdResp.status, createdResp.description),
101
+ Response(resourceAlreadyExists.status, resourceAlreadyExists.description),
102
+ Response(invalidParameters.status, invalidParameters.description),
103
+ __param(0, Body())
104
+ ], ServerController.prototype, "addServer", null);
105
+ __decorate([
106
+ Example(taskLocation),
107
+ Post('{id}/actions/connect'),
108
+ SuccessResponse(actionAsyncroneResp.status, actionAsyncroneResp.description, actionAsyncroneResp.produce),
109
+ Response(noContentResp.status, noContentResp.description),
110
+ Response(notFoundResp.status, notFoundResp.description),
111
+ Response(409, 'The server is already connected'),
112
+ __param(0, Path()),
113
+ __param(1, Query())
114
+ ], ServerController.prototype, "connectServer", null);
115
+ __decorate([
116
+ Example(taskLocation),
117
+ Post('{id}/actions/disconnect'),
118
+ SuccessResponse(actionAsyncroneResp.status, actionAsyncroneResp.description, actionAsyncroneResp.produce),
119
+ Response(noContentResp.status, noContentResp.description),
120
+ Response(notFoundResp.status, notFoundResp.description),
121
+ Response(409, 'The server is already disconnected'),
122
+ __param(0, Path()),
123
+ __param(1, Query())
124
+ ], ServerController.prototype, "disconnectServer", null);
53
125
  ServerController = __decorate([
54
126
  Route('servers'),
55
127
  Security('*'),
@@ -0,0 +1 @@
1
+ export {};