-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
1179 lines (1129 loc) · 32.2 KB
/
Copy pathopenapi.yaml
File metadata and controls
1179 lines (1129 loc) · 32.2 KB
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.1.0
info:
title: GameAP Files Plugin API
description: API for managing FTP/SFTP users and gameap-files server on GameAP nodes
version: 0.8.0
license:
name: MIT
url: https://opensource.org/licenses/MIT
servers:
- url: /plugins/files
description: Plugin API base path
tags:
- name: Nodes
description: Node setup, status and configuration operations
- name: Users
description: FTP user management
- name: Access Rules
description: User access rules management
- name: Virtual Paths
description: Virtual path mounting
- name: SSH Keys
description: SSH public key management
- name: Admin
description: Cross-node administration (admin only)
paths:
/nodes/{nodeId}/setup:
post:
tags:
- Nodes
summary: Setup gameap-files on node
description: >-
Starts the gameap-files installation, or re-runs the installer on an
already installed node (upgrade: the binary is updated, an older
/etc/gameap-files layout is migrated into <work_path>/.plugins/files,
and every FTP user of the node is re-synced afterwards). Omitted fields
keep the node's stored configuration (defaults when nothing is stored).
Linux and Windows nodes only; any other OS answers 400.
operationId: setupNode
parameters:
- $ref: '#/components/parameters/nodeId'
requestBody:
required: false
description: Optional FTP/SFTP configuration overrides (the stored configuration applies when omitted)
content:
application/json:
schema:
$ref: '#/components/schemas/NodeConfigPatch'
responses:
'200':
description: Setup initiated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/NodeStatus'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'500':
$ref: '#/components/responses/InternalError'
security:
- bearerAuth: []
/nodes/{nodeId}/status:
get:
tags:
- Nodes
summary: Get node status
description: Returns the gameap-files installation status for the specified node
operationId: getNodeStatus
parameters:
- $ref: '#/components/parameters/nodeId'
responses:
'200':
description: Node status retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/NodeStatus'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'500':
$ref: '#/components/responses/InternalError'
security:
- bearerAuth: []
/nodes/{nodeId}/config:
get:
tags:
- Nodes
summary: Get node FTP/SFTP configuration
description: Returns the stored FTP/SFTP configuration for the node (defaults when nothing stored)
operationId: getNodeConfig
parameters:
- $ref: '#/components/parameters/nodeId'
responses:
'200':
description: Configuration retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/NodeConfig'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'500':
$ref: '#/components/responses/InternalError'
security:
- bearerAuth: []
put:
tags:
- Nodes
summary: Update node FTP/SFTP configuration
description: >-
Merges the patch into the stored configuration, patches config.yaml on
the node and restarts the gameap-files service
operationId: updateNodeConfig
parameters:
- $ref: '#/components/parameters/nodeId'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NodeConfigPatch'
responses:
'200':
description: Merged configuration after the update
content:
application/json:
schema:
$ref: '#/components/schemas/NodeConfig'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'500':
$ref: '#/components/responses/InternalError'
security:
- bearerAuth: []
/admin/nodes:
get:
tags:
- Admin
summary: List all nodes with plugin status
operationId: adminListNodes
responses:
'200':
description: Nodes retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/AdminNodesResponse'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'500':
$ref: '#/components/responses/InternalError'
security:
- bearerAuth: []
/admin/users:
get:
tags:
- Admin
summary: List all FTP users grouped by node and server
operationId: adminListUsers
parameters:
- name: search
in: query
required: false
description: Case-insensitive username substring filter
schema:
type: string
- name: node_id
in: query
required: false
schema:
type: integer
format: int64
- name: server_id
in: query
required: false
schema:
type: integer
format: int64
- name: enabled
in: query
required: false
description: '"true" keeps enabled users; any other value keeps disabled users'
schema:
type: string
responses:
'200':
description: Grouped users retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/AdminUsersResponse'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'500':
$ref: '#/components/responses/InternalError'
security:
- bearerAuth: []
/admin/pickers/servers:
get:
tags:
- Admin
summary: Search game servers for the create-user picker
description: >-
Case-insensitive substring search over server names, optionally limited
to one node. Items are sorted by name; total is the match count before
truncation.
operationId: adminPickerServers
parameters:
- name: q
in: query
required: false
description: Case-insensitive server name substring
schema:
type: string
- name: node
in: query
required: false
description: Restrict results to this node
schema:
type: integer
format: int64
- name: limit
in: query
required: false
description: Maximum items returned (default 20, capped at 100)
schema:
type: integer
responses:
'200':
description: Matching servers
content:
application/json:
schema:
$ref: '#/components/schemas/PickerServersResponse'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'500':
$ref: '#/components/responses/InternalError'
security:
- bearerAuth: []
/servers/{serverId}/ftp-users:
get:
tags:
- Users
summary: List FTP users
description: Returns all FTP users for the specified server
operationId: listUsers
parameters:
- $ref: '#/components/parameters/serverId'
responses:
'200':
description: Users retrieved successfully
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'500':
$ref: '#/components/responses/InternalError'
security:
- bearerAuth: []
post:
tags:
- Users
summary: Create FTP user
description: Creates a new FTP user for the specified server. If password is not provided, it will be auto-generated.
operationId: createUser
parameters:
- $ref: '#/components/parameters/serverId'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUserRequest'
responses:
'201':
description: User created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUserResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'409':
description: User already exists
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
$ref: '#/components/responses/InternalError'
security:
- bearerAuth: []
/servers/{serverId}/ftp-users/{username}:
get:
tags:
- Users
summary: Get FTP user
description: Returns the specified FTP user
operationId: getUser
parameters:
- $ref: '#/components/parameters/serverId'
- $ref: '#/components/parameters/username'
responses:
'200':
description: User retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalError'
security:
- bearerAuth: []
put:
tags:
- Users
summary: Update FTP user
description: Updates the specified FTP user
operationId: updateUser
parameters:
- $ref: '#/components/parameters/serverId'
- $ref: '#/components/parameters/username'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateUserRequest'
responses:
'200':
description: User updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalError'
security:
- bearerAuth: []
delete:
tags:
- Users
summary: Delete FTP user
description: Deletes the specified FTP user
operationId: deleteUser
parameters:
- $ref: '#/components/parameters/serverId'
- $ref: '#/components/parameters/username'
responses:
'200':
description: User deleted successfully
content:
application/json:
schema:
type: object
properties:
deleted:
type: boolean
example: true
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalError'
security:
- bearerAuth: []
/servers/{serverId}/ftp-users/{username}/access-rules:
get:
tags:
- Access Rules
summary: Get access rules
description: Returns the access rules for the specified user
operationId: getAccessRules
parameters:
- $ref: '#/components/parameters/serverId'
- $ref: '#/components/parameters/username'
responses:
'200':
description: Access rules retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/AccessRulesResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalError'
security:
- bearerAuth: []
put:
tags:
- Access Rules
summary: Update access rules
description: Replaces the access rules for the specified user
operationId: updateAccessRules
parameters:
- $ref: '#/components/parameters/serverId'
- $ref: '#/components/parameters/username'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AccessRulesRequest'
responses:
'200':
description: Access rules updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/AccessRulesResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalError'
security:
- bearerAuth: []
/servers/{serverId}/ftp-users/{username}/virtual-paths:
get:
tags:
- Virtual Paths
summary: Get virtual paths
description: Returns the virtual paths for the specified user
operationId: getVirtualPaths
parameters:
- $ref: '#/components/parameters/serverId'
- $ref: '#/components/parameters/username'
responses:
'200':
description: Virtual paths retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/VirtualPathsResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalError'
security:
- bearerAuth: []
put:
tags:
- Virtual Paths
summary: Update virtual paths
description: Replaces the virtual paths for the specified user
operationId: updateVirtualPaths
parameters:
- $ref: '#/components/parameters/serverId'
- $ref: '#/components/parameters/username'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/VirtualPathsRequest'
responses:
'200':
description: Virtual paths updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/VirtualPathsResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalError'
security:
- bearerAuth: []
/servers/{serverId}/ftp-users/{username}/ssh-keys:
get:
tags:
- SSH Keys
summary: List SSH keys
description: Returns all SSH public keys for the specified user
operationId: listSSHKeys
parameters:
- $ref: '#/components/parameters/serverId'
- $ref: '#/components/parameters/username'
responses:
'200':
description: SSH keys retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SSHKeysResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalError'
security:
- bearerAuth: []
post:
tags:
- SSH Keys
summary: Add SSH key
description: Adds an SSH public key to the specified user
operationId: addSSHKey
parameters:
- $ref: '#/components/parameters/serverId'
- $ref: '#/components/parameters/username'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AddSSHKeyRequest'
responses:
'201':
description: SSH key added successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SSHKeysResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalError'
security:
- bearerAuth: []
/servers/{serverId}/ftp-users/{username}/ssh-keys/{index}:
delete:
tags:
- SSH Keys
summary: Delete SSH key
description: Removes an SSH public key from the specified user by index
operationId: deleteSSHKey
parameters:
- $ref: '#/components/parameters/serverId'
- $ref: '#/components/parameters/username'
- $ref: '#/components/parameters/keyIndex'
responses:
'200':
description: SSH key deleted successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SSHKeysResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalError'
security:
- bearerAuth: []
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
parameters:
nodeId:
name: nodeId
in: path
required: true
description: Node ID
schema:
type: integer
format: int64
minimum: 1
example: 1
serverId:
name: serverId
in: path
required: true
description: Server ID
schema:
type: integer
format: int64
minimum: 1
example: 1
username:
name: username
in: path
required: true
description: FTP username
schema:
type: string
pattern: '^[a-zA-Z][a-zA-Z0-9_]{2,31}$'
example: server1_user
keyIndex:
name: index
in: path
required: true
description: SSH key index (0-based)
schema:
type: integer
minimum: 0
example: 0
schemas:
NodeConfigPatch:
type: object
description: Partial FTP/SFTP configuration; omitted fields keep their current values
properties:
ftp:
type: object
properties:
address:
type: string
description: Bind address (empty = all interfaces)
port:
type: integer
example: 21
passive_port_min:
type: integer
example: 30000
passive_port_max:
type: integer
example: 30100
public_host:
type: string
description: External IP/host for passive mode
tls_enabled:
type: boolean
tls_implicit_port:
type: integer
example: 990
sftp:
type: object
properties:
port:
type: integer
example: 2222
NodeConfig:
type: object
description: Full stored configuration; sections are null when absent
properties:
ftp:
type:
- object
- 'null'
properties:
address:
type: string
port:
type: integer
passive_port_min:
type: integer
passive_port_max:
type: integer
public_host:
type: string
tls_enabled:
type: boolean
tls_implicit_port:
type: integer
sftp:
type:
- object
- 'null'
properties:
port:
type: integer
AdminNodesResponse:
type: object
properties:
nodes:
type: array
items:
type: object
properties:
id:
type: integer
format: int64
name:
type: string
ip:
type: string
plugin_status:
$ref: '#/components/schemas/NodeStatus'
AdminUsersResponse:
type: object
properties:
grouped:
type: object
description: Node id (as string key) → grouped node
additionalProperties:
type: object
properties:
node_id:
type: integer
format: int64
node_name:
type: string
servers:
type: object
description: Server id (as string key) → grouped server
additionalProperties:
type: object
properties:
server_id:
type: integer
format: int64
server_name:
type: string
game_id:
type: string
users:
type: array
items:
type: object
properties:
username:
type: string
enabled:
type: boolean
home_dir:
type: string
quota_bytes:
type: integer
format: int64
description:
type: string
total:
type: integer
PickerServer:
type: object
properties:
id:
type: integer
format: int64
name:
type: string
node_id:
type: integer
format: int64
enabled:
type: boolean
game_id:
type: string
PickerServersResponse:
type: object
properties:
items:
type: array
items:
$ref: '#/components/schemas/PickerServer'
total:
type: integer
description: Matched count before truncation
NodeStatus:
type: object
properties:
status:
type: string
enum:
- not_installed
- installing
- installed
- failed
description: Installation status
example: installed
version:
type: string
description: Installed version of gameap-files
example: "1.0.0"
task_id:
type: integer
format: int64
description: Installation task ID (if installing)
example: 123
error_message:
type: string
description: Error message (if failed)
last_check:
type: integer
format: int64
description: Last status check timestamp (Unix)
example: 1704067200
required:
- status
User:
type: object
properties:
username:
type: string
description: FTP username
example: server1_user
home_dir:
type: string
description: User's home directory
example: /srv/gameap/server1
quota_bytes:
type: integer
format: int64
description: Disk quota in bytes (0 = unlimited)
example: 10737418240
enabled:
type: boolean
description: Whether the user is enabled
example: true
description:
type: string
description: User description
example: Game server user
ssh_keys_count:
type: integer
description: Number of SSH public keys
example: 2
access_rules:
type: array
items:
$ref: '#/components/schemas/AccessRule'
virtual_paths:
type: array
items:
$ref: '#/components/schemas/VirtualPath'
required:
- username
- home_dir
- enabled
CreateUserRequest:
type: object
properties:
username:
type: string
description: FTP username (alphanumeric with underscores, 3-32 chars)
pattern: '^[a-zA-Z][a-zA-Z0-9_]{2,31}$'
example: server1_user
password:
type: string
description: User password (optional, auto-generated if not provided)
minLength: 8
example: mySecurePassword123
home_dir:
type: string
description: >-
User's home directory. An absolute path is stored as given; a
relative one is resolved under the node's work path. Defaults to
the game server directory (<work_path>/<server dir>).
example: /srv/gameap/servers/server1
quota_bytes:
type: integer
format: int64
description: Disk quota in bytes (0 = unlimited)
default: 0
example: 10737418240
enabled:
type: boolean
description: Whether the user is enabled
default: true
example: true
description:
type: string
description: User description
example: Game server user
required:
- username
CreateUserResponse:
type: object
properties:
username:
type: string
example: server1_user
password:
type: string
description: Generated password (only returned if password was auto-generated)
example: aB3dE5fG7hI9jK1m
home_dir:
type: string
example: /srv/gameap/server1
quota_bytes:
type: integer
format: int64
example: 10737418240
enabled:
type: boolean
example: true
description:
type: string
example: Game server user
required:
- username
- home_dir
- enabled
UpdateUserRequest:
type: object
properties:
password:
type: string
description: New password
minLength: 8
home_dir:
type: string
description: New home directory (absolute, or relative to the node's work path)
quota_bytes:
type: integer
format: int64
description: New disk quota in bytes
enabled:
type: boolean
description: Enable/disable user