-
Notifications
You must be signed in to change notification settings - Fork 0
/
USER.yaml
2103 lines (2094 loc) · 82.3 KB
/
USER.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: "3.0.2"
info:
title: User API
version: "1.0"
servers:
- url: https://localhost:3000/api
paths:
/combinedData:
get:
description: This request will be fired after authentication in order to get all the data needed in the frontend
responses:
"200":
description: Everything needed for the frontend to work in one request
content:
application/json:
schema:
$ref: "#/components/schemas/UserData"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/instances:
post:
description: Create a new instance
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
rootPassword:
type: string
description: password of the root user in container
projectId:
type: integer
description: Id of project where container should be created
templateId:
type: integer
applicationsToInstall:
type: array
description: Ids of apps that should be installed
items:
type: integer
limits:
description: limits have to be specified when creating container for all resources
$ref: "#/components/schemas/Limits"
required:
- name
- rootPassword
- projectId
- templateId
- applicationsToInstall
- connectToInternet
- limits
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Container"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/instances/createInstanceConfigData:
get:
responses:
"200":
description: Returns all data that are necesarry to create an instance (without project state and limits)
content:
application/json:
schema:
$ref: "#/components/schemas/CreateInstanceConfigData"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/instances/{id}:
get:
parameters:
- in: path
required: true
name: id
schema:
type: integer
description: ID of the container to be querried
responses:
"200":
description: Successful state info return
content:
application/json:
schema:
$ref: "#/components/schemas/Container"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
patch:
description: Change instances settings
parameters:
- in: path
required: true
name: id
schema:
type: integer
description: ID of the container to be querried
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
rootPassword:
type: string
description: password of the root user in container. If this item is null, it means that it has not been changed
connectToInternet:
type: boolean
limits:
description: limits have to be specified when creating container for all resources
$ref: "#/components/schemas/Limits"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Container"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
delete:
parameters:
- in: path
required: true
name: id
schema:
type: integer
description: ID of the container to be deleted
responses:
"200":
description: deleted the container
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/instances/{id}/stateWithHistory:
get:
parameters:
- in: path
required: true
name: id
schema:
type: integer
description: ID of the container which state is requested
responses:
"200":
description: Successful state info return
content:
application/json:
schema:
$ref: "#/components/schemas/ContainerStateWithHistory"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/instances/{instanceId}/console:
get:
parameters:
- in: path
required: true
name: instanceId
schema:
type: integer
description: ID of the container for which we start the console
responses:
"200":
description: OK
content:
application/json:
schema:
type: string
description: socket identifier that clients uses to access terminal - ws:/instances/{id}/console/{consoleId}
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
# ws:/console/{descriptor}: used to connect to the terminal.
#/instances/{id}/files: TODO
# get:
# parameters:
# - in: path
# required: true
# name: id
# schema:
# type: integer
# description: Id kontejneru, ke kterému vztahujeme naši operaci
# responses:
# '200':
# description: OK
/instances/{id}/snapshots:
get:
description: Retreives the list of all snapshots for given container
parameters:
- in: path
required: true
name: id
schema:
type: integer
description: ID of the container to be snapshoted
responses:
"200":
description: OK
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Snapshot"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
post:
parameters:
- in: path
required: true
name: id
description: ID of the container to be snapshotted
schema:
type: integer
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
description: name of snapshot
stateful:
type: boolean
description: true if the snapshot should be created stateful
limits:
description: if part of limits is null it means that current container limit will be maintained. If it is not null, then limits will be set. If current container limit is lower than this snapshot limit, revert is going to fail.
$ref: "#/components/schemas/Limits"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Snapshot"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/instances/{containerId}/snapshots/{snapshotId}:
delete:
parameters:
- in: path
required: true
name: containerId
schema:
type: integer
description: ID of the container where the snapshot is
- in: path
required: true
name: snapshotId
schema:
type: integer
description: ID of the snapshot to be deleted
responses:
"200":
description: OK
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/instances/{id}/restore/{snapshotId}:
patch:
parameters:
- in: path
required: true
name: id
schema:
type: integer
description: ID of the container to be reverted
- in: path
required: true
name: snapshotId
schema:
type: integer
description: ID of the snapshot to be used for updating the container files
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/OperationState"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/instances/{instanceId}/export:
get:
parameters:
- in: path
required: true
name: instanceId
schema:
type: integer
description: ID of the downloaded container
responses:
"200":
description: Running
content:
application/json:
schema:
type: string
description: Stream souboru
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/instances/import:
put:
parameters:
- in: cookie
required: true
name: containerFile
schema:
type: string
format: binary
description: The container file to be uploaded
responses:
"200":
description: File is uploading
content:
application/json:
schema:
type: integer
description: ID to the process
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/instances/{id}/start:
patch:
parameters:
- in: path
required: true
name: id
schema:
type: integer
description: ID of the used container
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Container"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/instances/{id}/stop:
patch:
parameters:
- in: path
required: true
name: id
schema:
type: integer
description: ID of the container to be stopped
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Container"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/instances/{id}/freeze:
patch:
parameters:
- in: path
required: true
name: id
schema:
type: integer
description: ID of the container to be frozen
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Container"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/instances/{id}/unfreeze:
patch:
parameters:
- in: path
required: true
name: id
schema:
type: integer
description: ID of the container to be unfrozen
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Container"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/projects:
get:
responses:
"200":
description: All projects of current user
content:
application/json:
schema:
$ref: "#/components/schemas/UserProjects"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
post:
description: Create a new project
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
limits:
description: limits don't have to be specified when creating project, so it can be null. Null can also be some properties of limits when they are not set
$ref: "#/components/schemas/Limits"
required:
- name
responses:
"200":
description: Successfully created
content:
application/json:
schema:
$ref: "#/components/schemas/Project"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
#/projects/createConfigData:
# get:
# responses:
# "200":
# description: Returns all data that are necesarry to create a project
# content:
# application/json:
# schema:
# type: object
# properties:
# maxLimits:
# $ref: "#/components/schemas/Limits"
/projects/stateWithHistory:
get:
responses:
"200":
description: History of states of all projects of this user
content:
application/json:
schema:
$ref: "#/components/schemas/UserStateWithHistory"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/projects/{id}:
get:
parameters:
- in: path
required: true
name: id
schema:
type: integer
description: ID of the project to be querried
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Project"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
patch:
description: Change settings of existing project
parameters:
- in: path
required: true
name: id
schema:
type: integer
description: ID of the project to be querried
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
limits:
description: limits don't have to be specified when creating project, so it can be null. Null can also be some properties of limits when they are not set
$ref: "#/components/schemas/Limits"
required:
- name
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Project"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
delete:
parameters:
- in: path
required: true
name: id
schema:
type: integer
description: ID of the project to be deleted
responses:
"200":
description: deleted the container
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/projects/{id}/stateWithHistory:
get:
parameters:
- in: path
required: true
name: id
schema:
type: integer
description: ID of the project to be querried
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ProjectStateWithHistory"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/user:
get:
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/User"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/logout:
get:
responses:
"200":
description: OK
components:
schemas:
ErrorResponse:
type: object
properties:
message:
type: string
description: Message that explains what went wrong
example: "This is error message generated by backend"
Image:
type: object
properties:
os:
type: string
version:
type: string
description:
type: string
example:
os: Ubuntu
version: 18.44
description: Ubuntu OS description
Template:
type: object
description: Combination of image and configuration. User can then create instances of these templates
properties:
id:
type: integer
description: Id of a template generatd by database
name:
type: string
createdOn:
type: string
image:
$ref: "#/components/schemas/Image"
description:
type: string
minDiskUsage:
type: integer
description: minimum disk space needed for the container to work in Bytes.
example:
id: 44
name: Ubuntu
createdOn: 2015-06-07T19:07:24.379615253-06:00
image:
os: Ubuntu
version: 18.44
description: Ubuntu OS description
description: default profile for users with Ubuntu image
minDiskUsage: 180_000_000
Limits:
type: object
description: Resources allocated to container/project/user.
properties:
RAM:
type: integer
description: in bytes
CPU:
type: integer
description: in Hz
disk:
type: integer
description: in bytes
internet:
type: object
properties:
download:
type: integer
description: in bits/s
upload:
type: integer
description: in bits/s
ContainerResourceState:
type: object
description: Object representing current state of the container (not history). Each object also contains limit information that were in effect in the time of measuring the state.
properties:
measuredOn:
type: string
description: Date and time when this state was measured
CPU:
type: object
properties:
limit:
description: CPU limit in Hz
type: integer
usedTime:
type: integer
description: Time used by the CPU in nanoseconds from the container start
usage:
type: integer
description: Used Hz in measured time
RAM:
type: object
properties:
limit:
type: integer
description: RAM limit in bytes
usage:
type: integer
description: last measured RAM usage in Bytes
usagePeak:
type: integer
description: maximum measured RAM usage in Bytes from the start of the container
disk:
type: object
properties:
limit:
type: integer
description: disk limit for all devices of this container in bytes
devices:
type: array
items:
type: object
properties:
name:
type: string
description: Name of the device (disk) e.g. root
usage:
type: integer
description: current disk usage in bytes
internet:
$ref: "#/components/schemas/NetworkState"
loopback:
$ref: "#/components/schemas/NetworkState"
networks:
type: array
items:
$ref: "#/components/schemas/NetworkState"
numberOfProcesses:
type: integer
description: Process count
operationState:
$ref: "#/components/schemas/OperationState"
NetworkState:
type: object
properties:
name:
type: string
description: name of the network
limits:
type: object
properties:
download:
type: integer
description: in bits/s
upload:
type: integer
description: in bits/s
addresses:
type: array
items:
type: object
properties:
family:
type: string
address:
type: string
netmask:
type: integer
scope:
type: string
counters:
type: object
properties:
download:
type: object
properties:
usedSpeed:
type: integer
description: number of bytes that were downloaded/1s in bits/s
bytesFromStart:
type: integer
description: number of bytes received from the beginning of the run of this container
packetsFromStart:
type: integer
description: number of packets received from the beginning of the run of this container
upload:
type: object
properties:
usedSpeed:
type: integer
description: number of bytes that were uploaded/1s in bits/s
bytesFromStart:
type: integer
description: number of bytes sent from the beginning of the run of this container
packetsFromStart:
type: integer
description: number of packets sent from the beginning of the run of this container
hwaddr:
type: string
hostName:
type: string
mtu:
type: integer
description: maximum transmission unit
state:
type: string
type:
type: string
Snapshot:
type: object
properties:
name:
type: string
description: Name of the snapshot
createdOn:
type: string
description: The time of creation
stateful:
type: boolean
description: True if state of the container should be maintained
description:
type: string
limits:
description: minimum required limits that are needed in order to revert to this snapshot
$ref: "#/components/schemas/Limits"
OperationState:
type: object
properties:
status:
type: string
statusCode:
type: integer
ContainerStateWithHistory:
type: object
description: LXD container state containing current state and also the history of states
properties:
id:
type: integer
description: id of the container
stateHistory:
type: array
description: history of states - index 0 = current state, index 1 = pre-last state, n-1 = last remembered state.
items:
$ref: "#/components/schemas/ContainerResourceState"
Container:
type: object
description: LXD container with info and state
properties:
id:
type: number
name:
type: string
description: max 30 characters long
url:
type: string
template:
$ref: "#/components/schemas/Template"
createdOn:
type: string
description: Date and time of the creation of the container
lastStartedOn:
type: string
description: Date and time when container was last started
snapshots:
type: array
items:
$ref: "#/components/schemas/Snapshot"
state:
$ref: "#/components/schemas/ContainerResourceState"
example:
id: 51
name: Jobe
url: jobe.moodle.vavra.avava.gyarab.cz
template:
id: 44
name: Ubuntu
createdOn: 2015-06-07T19:07:24.379615253-06:00
image:
os: Ubuntu
version: 18.44
description: Ubuntu OS description
description: default profile for users with Ubuntu image
minDiskUsage: 180_000_000
stateful: true
createdOn: 2015-06-08T19:07:24.379615253-06:00
lastStartedOn: 2015-06-09T19:07:24.379615253-06:00
snapshots:
- name: snapshot (1)
createdOn: 2015-06-08T19:07:24.379615253-06:00
stateful: false
state:
measuredOn: 2015-06-10T19:07:24.379615253-06:00
CPU:
limit: 100_000_001
usedTime: 153_469_541
usage: 30_000_501
RAM:
limit: 4_123_987_456
usage: 128_456_000
usagePeak: 1_400_000_000
disk:
limit: 20_000_000_000
devices:
- name: root
usage: 5_300_000_000
internet:
name: eth0
limits:
download: 200_000_000
upload: 40_000_000
adresses:
- family: inet
adress: 10.237.227.70
netmask: 8
scope: global
- family: inet6
adress: fd42:2d58:d04a:5d07:216:3eff:fece:e2e0
netmask: 64
scope: link
counters:
download:
usedSpeed: 200_000_000
bytesFromStart: 432_000_000_758
packetsFromStart: 123_045_146
upload:
usedSpeed: 0
bytesFromStart: 123_455
packetsFromStart: 752
hwaddr: 00:16:3e:ec:65:a8,
hostName: vethBWTSU5,
mtu: 1400,
state: up,
type: broadcast
loopback:
name: loopback
adresses:
- family: inet
adress: 10.237.227.70
netmask: 8
scope: global
- family: inet6
adress: fd42:2d58:d04a:5d07:216:3eff:fece:e2e0
netmask: 64
scope: link
counters:
download:
usedSpeed: 200_000_000