-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswagger.yaml
More file actions
1410 lines (1318 loc) · 53.9 KB
/
swagger.yaml
File metadata and controls
1410 lines (1318 loc) · 53.9 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
#
# Webida Restful Api specifiaion
#
# Current api desingn rules
# 1) Any (and only) "reusable" schemas should be placed in #/parameters, #/definitions
# 2) Do not use multiple tags in a single operaion to reduce client code size
# 3) All "real-path" parameters (can contain /) should be "relative".
# An operation can have 0 or 1 real-path parameters, at the end of path params.
# 4) Prefer /some-name-plural/{id} form (except wfs) and don"t mix with sigular noun
# 5) All response should be an object or file. No Plain Text!
# 6) Keep common/starndard http status code semantic, as possible as we can.
# 7) Do not split this document into pieces, for none of standard swagger tools supoorts
# multi-docs spec yet.
# 8) Do not use "polymorphism" with discriminator property. swagger-codegen for JS does
# not support such polymorphism yet.
# notes for swaggerize-routes
# - 1 x-handler impl module for every operation. file name should be same to operation id.
swagger: "2.0"
info:
version: "0.7.1"
title: Webida Restful API
description: Restful API for Webida clients to use server's data & features
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
# Should not include host / schemes in this spec when publishing,
# for server/client implementations 'ALWAYS' tend to override the value to current
# service url.
basePath: /api
produces:
- application/json
- application/octet-stream
consumes:
- application/json
paths:
/auth/login:
post:
x-handler: handlers/auth/login.js
tags: ["auth"]
description: |
A "VERY" basic authentication, required to use webida-simple-auth security scheme.
Service / Product implementations who need better security, should override this operation or add their own login api or some other specs like OAuth2. Simple auth is not suitable for large-sacle, multi-tennant service, for the scheme assumes a single, trusted user only.
Logging-in with master token, the generated access token inherits all restriction from it. On the other hand, normal log-in with login id & password creates an unrestricted access token, with reasonably short expiration time.
Every client should spawn another access token with issueToken API before current access token expires, inheriting session id from current token. To save remote access info, client should create a (restricted but long-ttl) master token to start IDE from remote. The remote client should not use the unrestricted acccess token from login to use any other perpose than finding available workspaces, and should not refresh the token. (Let user log-in again)
Login API does not force any encryption. Server should provide secure transport channel, usually https, to provide remote access, always.
operationId: login
parameters:
- name: body
in: body
required: true
schema:
$ref: "#/definitions/Credential"
responses:
"200":
description: login success
schema:
$ref: "#/definitions/Token"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
/auth/info:
get:
x-handler: handlers/auth/getInfo.js
tags: ["auth"]
description: |
Gets user information of that can be identified with current access token. Implementations should provide a more restful api based on domain data model, not extending this operation. (e.g. GET,PUT and DELETE on /Users/{userId} to read, update and delete user)
operationId: getInfo
security:
- webida-simple-auth: []
responses:
"200":
description: user information
schema:
$ref: "#/definitions/User"
"401":
description: auth failed
schema:
$ref: "#/definitions/RestError"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
/auth/token:
post:
x-handler: handlers/auth/issueToken.js
tags: ["auth"]
description: |
Creates new token from current access token, inheriting workspace id & session id. The duration of generated token is not (and should not be) parameterizable. Server should set proper duration, respecting "reconnect" period of socket.io clients. Remember that most of socket.io client implementations (including official js client) do not provide any ways to change connection parameters (header or query) while reconnecting to server.
Like login API, this endpoint does not provide any encryption. Server should not set any data to harm security in the token & should provide some signinig/encryption mechanism to protect token. Simple JSON Web Token with HMAC-SHA will do.
operationId: issueToken
security:
- webida-simple-auth: []
parameters:
- name: type
in: query
required: true
type: string
enum: ["MASTER", "ACCESS"]
- name: workspaceId
in: query
required: false
type: string
description: Clients to save some remote access info should issue a MASTER type token restricted to specific workspace id.
responses:
"200":
description: new token generated
schema:
$ref: "#/definitions/Token"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# Basic WFS operations , read/write file, create dir, delete, copy, move, ...
# wfs paths starts with /wfs/{wfsId}
# /file/{wfsPath} file CRUD C,U is PUT, not POST
# GET - read file
# PUT - write file
# /dir/{wfsPath} directory CRUD
# GET - list (tree) dir
# PUT - create (can be expanded to import, later)
# /any/{wfsPath}
# GET?{ignoreError} - stat / exists
# PUT?{src} - copy
# POST?{src} - move
# DELETE - remove
# /ops/search?{wfsPathQuery} for search (GET) and replace (POST)
# /ops/replace?{wfsPathQuery} for search (GET) and replace (POST)
# WFS File operations - read/write
/wfs/{wfsId}/file/{wfsPath}:
# readFile.
get:
x-handler: handlers/wfs/readFile.js
tags: ["wfs"]
description: read file data on path
operationId: readFile
security:
- webida-simple-auth: []
parameters:
- $ref: "#/parameters/wfsId"
- $ref: "#/parameters/wfsPath"
- name: If-Modified-Since
in: header
required: false
description: Usual if-modified-since header. So, should be RFC-1123(same to RFC-822) format, not RFC-3339 (same to ISO-8601).
type: string
- name: If-None-Match
in: header
required: false
description: Usual if-non-match header, allowing only 1 e-tag value from previous readFile response. The value of this header can have weak prefix and quotation chars. This header value precedes the value of if-modified-since header. Server should ignore if-modified-since header when if-none-match header exists, as RFC-2616.
type: string
responses:
"200":
description: File contents. Content-Type is application/octet-stream or follows file name extension.
schema:
type: file
headers:
ETag:
description: usual etag header in HTTP 1.1
type: string
Last-Modified:
description: usual last-modified header, in RFC-1123 format.
type: integer
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# writeFile
put:
x-handler: handlers/wfs/writeFile.js
tags: ["wfs"]
description: Creates / updates file with body data. Server should write the file in atomic manner nd should not write down request body into final destination path directly. In other words, wheather writeFile() succeeds or not, the contents of the file should not be corrupted nor half-written.
operationId: writeFile
consumes:
- multipart/form-data
security:
- webida-simple-auth: []
parameters:
- $ref: "#/parameters/wfsId"
- $ref: "#/parameters/wfsPath"
- $ref: "#/parameters/ensureParents"
- name: data
in: formData
required: true
description: file contents to write.
type: file
responses:
"200":
description: OK
schema:
$ref: "#/definitions/RestOK"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# WFS Dir operations - list(tree) and create empty one
/wfs/{wfsId}/dir/{wfsPath}:
# dirTree
get:
x-handler: handlers/wfs/dirTree.js
tags: ["wfs"]
description: Returns a directory tree of given path, the errors while building sub-tree will be ignored and result will not include the path that has errors. Client may have to stat some suspicious paths manually, if listing is not complete.
operationId: dirTree
security:
- webida-simple-auth: []
parameters:
- $ref: "#/parameters/wfsId"
- $ref: "#/parameters/wfsPath"
- name: maxDepth
description: Maximum depth of tree. -1 to build a full tree, 0 to stat, 1 to plain list.
in: query
type: integer
required: true
responses:
"200":
description: A DirEntry, root of the tree, for given path and depth.
schema:
$ref: "#/definitions/DirEntry"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# createDir
put:
x-handler: handlers/wfs/createDir.js
tags: ["wfs"]
description: Creates a directory at the path. When the path is found to be a directory, this api does not return error and does not care it's empty or not. Always creates parent directories if needed.
operationId: createDir
security:
- webida-simple-auth: []
parameters:
- $ref: "#/parameters/wfsId"
- $ref: "#/parameters/wfsPath"
responses:
"200":
description: OK
schema:
$ref: "#/definitions/RestOK"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# WFS Any operations - stat & exist, copy, move, remove
/wfs/{wfsId}/any/{wfsPath}:
# stat
get:
x-handler: handlers/wfs/stat.js
tags: ["wfs"]
description: Get stats of given path. (stat() returns stats object in node and POSIX system). This API should be called only when stats of some file system path is stale for unknown reason (e.g. losting change events). Use dirTree operation and session events to detect stats, if possible. This API can be used to check a path is valid, existing one, but it's not recommended to check existence of individual paths by API. Clients should use dirTree and session events to synchorize some in-app file system with webida file system.
operationId: stat
security:
- webida-simple-auth: []
parameters:
- $ref: "#/parameters/wfsId"
- $ref: "#/parameters/wfsPath"
- name: dummyFor404
in: query
required: false
description: When true, operation ignore ENOENT error and returns DUMMY stats object instead of 404 error.
type: boolean
default: false
responses:
"200":
description: stats object.
schema:
$ref: "#/definitions/Stats"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# copy
put:
x-handler: handlers/wfs/copy.js
tags: ["wfs"]
description: |
Creates a copy of source to given path. Unlike cp command, wfsPath always denotes an exact path of the resource to be created.
So, When destination path exists already,
1) copying file to file : follows noOverwrite flag. (does not return error)
2) copying file to dir : returns 409 error
3) copying dir to file : returns 409 error
4) copying dir to dir : merge srcPath/* to wfsPath, following noOverwite flag.
This operation creates the parents dir of destination path always, and does not roll-back the creation when operation failed. So, clients should roll-back if needed.
operationId: copy
security:
- webida-simple-auth: []
parameters:
- $ref: "#/parameters/wfsId"
- $ref: "#/parameters/wfsPath"
- $ref: "#/parameters/srcPath"
- $ref: "#/parameters/noOverwrite"
- name: followSymbolicLinks
in: query
description: dereference symlinks in source.
required: false
type: boolean
default: false
- name: preserveTimestamps
in: query
description: keep mtime/atime of source file(s) in destination.
required: false
type: boolean
default: false
responses:
"200":
description: OK
schema:
$ref: "#/definitions/RestOK"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# move
post:
x-handler: handlers/wfs/move.js
tags: ["wfs"]
description: Moves source resource to given path. Follows same rule to deal with existing path. So, this operation works like rename rather than mv. Just like copy(), this operations creates paraent dirs if needed and does not roll-back. Symbolic link and timestamp values will be moved without touching.
operationId: move
security:
- webida-simple-auth: []
parameters:
- $ref: "#/parameters/wfsId"
- $ref: "#/parameters/wfsPath"
- $ref: "#/parameters/srcPath"
- $ref: "#/parameters/noOverwrite"
responses:
"200":
description: OK
schema:
$ref: "#/definitions/RestOK"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# remove / delete
delete:
x-handler: handlers/wfs/remove.js
tags: ["wfs"]
description: delete file or directory
operationId: remove
security:
- webida-simple-auth: []
parameters:
- $ref: "#/parameters/wfsId"
- $ref: "#/parameters/wfsPath"
- name: noRecursive
in: query
required: false
description: if set, deleting non-empty directory will return 409 error.
type: boolean
default: false
responses:
"200":
description: OK
schema:
$ref: "#/definitions/RestOK"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# WFS search operation
/wfs/{wfsId}/ops/search:
get:
x-handler: handlers/wfs/search.js
tags: ["wfs"]
description: search files in some path, with given pattern
operationId: search
security:
- webida-simple-auth: []
parameters:
- $ref: "#/parameters/wfsId"
- $ref: "#/parameters/wfsPathList"
- $ref: "#/parameters/pattern"
- $ref: "#/parameters/ignoreCase"
responses:
"200":
description: search
schema:
type: object
additionalProperties:
type: array
items:
$ref: "#/definitions/Match"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# WFS replace operation
/wfs/{wfsId}/ops/replace:
post:
x-handler: handlers/wfs/replace.js
tags: ["wfs"]
description: replace file contents with regex matching
operationId: replace
security:
- webida-simple-auth: []
parameters:
- $ref: "#/parameters/wfsId"
- $ref: "#/parameters/wfsPathList"
- $ref: "#/parameters/pattern"
- $ref: "#/parameters/ignoreCase"
- name: replaceTo
in: query
description: string to replace with
type: string
required: true
responses:
"200":
description: done
schema:
$ref: "#/definitions/RestOK"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# workspace management operations
# workspaces/{workspaceId} - individual local workspaces
# GET : find workspaces
# POST: create workspace
# PUT : update single workspace
# DELETE : delete single workspace
/workspaces/{workspaceId}:
# findWorkspaces
get:
x-handler: handlers/workspace/findWorkspaces.js
tags: ["workspace"]
description: |
Finds workspaces with given id or parameters. if workspaceId = '*', all workspaces in server are returned. No empty workspace id is allowed for it's a path parameter. When workspaceId is not '*', server should return empty array, not 404 Not Found error.
operationId: findWorkspaces
security:
- webida-simple-auth: []
parameters:
- $ref: "#/parameters/workspaceId"
- name: includeEphemeral
in: query
required: false
description: flag to include ephemeral workspaces or not, when workspaceId is '*'. if workspace id is specified, then this flag will be ignored.
type: boolean
default: false
responses:
"200":
description: array of local workspaces found
schema:
type: array
items:
$ref: "#/definitions/Workspace"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# createWorkspace
post:
x-handler: handlers/workspace/createWorkspace.js
tags: ["workspace"]
description: |
Creates a new workspace with given local path. Requires an unrestricted access token. the workspace id parameter is ignored and will be replaced by new, unique value by server. it's recommended to set the value to simple, bogus one, like '*' or '-' (since it's path parameter, empty value is not allowed. excludedPath property is initialized with default values (usually .git/, .node_modules/, ./bower_components) by server.
Needs an unrestricted access token.
operationId: createWorkspace
security:
- webida-simple-auth: []
parameters:
- $ref: "#/parameters/workspaceId"
- name: localPath
in: query
required: true
description: a real, local path of the system (not unixified)
type: string
- name: name
in: query
required: true
description: workspace name property
type: string
- name: description
in: query
required: true
description: workspace name property
type: string
responses:
"200":
description: newly created local workspace
schema:
$ref: "#/definitions/Workspace"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# update workspace
put:
x-handler: handlers/workspace/updateWorkspace.js
tags: ["workspace"]
description: |
Updates workspace. Some protected properties will not be changed by this op. If server cannot apply changed properties before returning workspace, such properties should not be updated with this operation. Clients should not rely on request body for further works, and should always check response to see what's changed actually.
Requires proper access rights.
operationId: updateWorkspace
security:
- webida-simple-auth: []
parameters:
- $ref: "#/parameters/workspaceId"
- name: body
in: body
description: workspace object that contains updates
required: true
schema:
$ref: "#/definitions/Workspace"
responses:
"200":
description: updated Workspace object. some properties may different from input.
schema:
$ref: "#/definitions/Workspace"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# delete workspace
delete:
x-handler: handlers/workspace/removeWorkspace.js
tags: ["workspace"]
description: |
Removes a workspace. If no sessions are connected, this api 'works' before returning result. if some sesions are, workspace will be removed when
1) all sessions are closed for request (will be notified by server)
2) exceeded time limit value in closeAfter parameter
3) server stops after accepting remove request
and willBeRemoved value is set. So, client may 'find' the workspace to be removed after calling this operation.
Requires "unrestricted" access rights.
operationId: removeWorkspace
security:
- webida-simple-auth: []
parameters:
- $ref: "#/parameters/workspaceId"
- name: closeAfter
in: query
description: Time in seconds to wait for all sessions save & close their data.
type: integer
required: false
default: 0
- name: removeDir
in: query
description: flag to delete directory in real file system when removing workspace. Usually, this value should not be set true for user can handle directory persistence manually. Clients need to get explicit confirmation from user.
type: boolean
required: false
responses:
"200":
description: OK. removed
schema:
$ref: "#/definitions/RestOK"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# workspace - exec operations
# workspaces/{workspaceId}/exec
# GET : findProcs
# POST: exec
# DELETE : cancel (for async exec only)
/workspaces/{workspaceId}/procs:
#findProcs
get:
x-handler: handlers/workspace/findProcs.js
tags: ["workspace"]
description: |
Gets process info on this workspace. To find all child processes, set id to '*'. This op does not returns error when no procs found but empty result array. Child process can be created by exec operation and by some other means.
operationId: findProcs
parameters:
- $ref: "#/parameters/workspaceId"
- $ref: "#/parameters/execId"
- name: includeForeground
in: query
description: flag to include 'foreground processes' in result. foreground processes can be created by and only by exec operation without async opetion. normally, this flag will not be used except debugging or diagnostics. foreground processes has 'foreground' property, set to true, always.
type: boolean
required: false
responses:
"200":
description: the child processes found. result does not include 'exited' procs.
schema:
type: array
items:
$ref: "#/definitions/ChildProcess"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
#exec
post:
x-handler: handlers/workspace/execute.js
tags: ["workspace"]
description: Executes a shell command (foreground process) or spawns a background process on this workspace. Requires proper access rights.
operationId: execute
security:
- webida-simple-auth: []
parameters:
- $ref: "#/parameters/workspaceId"
- name: async
in: query
description: Spawns a background process for given command and returns the created child proc info. Actual output (stream of message) will be delivered to web socket channel, using execution id.
type: boolean
required: false
default: false
- name: body
in: body
description: the process to be executed or spawned.
required: true
schema:
$ref: "#/definitions/Execution"
responses:
"200":
description: Execution result with all captured standard ouput and error. If execution is completed without error, the error property in result object should be a falsy value. If some error has happened, then it will be an error message, without stack. A plain RestError will be returned with 4xx or 5xx error code (e.g. insufficient/invalid arguments) when it's found before creating process. So, clients should handle the 'invocation error' and 'errors from the command' differently.
schema:
$ref: "#/definitions/ExecutionResult"
"201":
description: Spawned process infomation created by async execution. If server could not create a child process, error event will be sent to client via socket channel but RestError will not be ruturned from this operation. When a client has got 'error' event from the socket channel, the client should close the channel wheather it receives subsequent exit event or not (with some proper timeout if needed). Server should not send the errors related to 'killing' child processes.
schema:
$ref: '#/definitions/ChildProcess'
default:
description: Error
schema:
$ref: "#/definitions/RestError"
#cancel
delete:
tags: ["workspace"]
description: Cancels executions, killing the spawned processes. To terminate all spawned processes, set execId to '*'. Requires proper access rights. Since killing a process usually takes a little bit long time, this api does not returns actual result but works in async manner. (So, client should listen to web socket channels for the processes). This operation Requires same access rights to execute operation. Server should reject to cancel any forground processes and processes is being killed or has exited already.
operationId: cancel
security:
- webida-simple-auth: []
parameters:
- $ref: "#/parameters/workspaceId"
- $ref: "#/parameters/execId"
responses:
"200":
description: OK
schema:
$ref: "#/definitions/RestOK"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# remote-access operations
# GET : get all remote workspaces" access info, registered to local server
# PUT : put (upsert) a remote workspace access info
# DELETE : delete single remote workspace" access info
/remotes:
# findRemoteAccess
get:
x-handler: handlers/remotes/findRemoteAccesses.js
tags: ["remotes"]
description: Get all access informations See RemoteWorkspaceAccess definition for details (no fancy find / search feature yet)
operationId: findRemoteAccesses
security:
- webida-simple-auth: []
responses:
"200":
description: Array of remote workspaces
schema:
type: array
items:
$ref: "#/definitions/RemoteAccess"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# putRemoteAccess
put:
tags: ["remotes"]
description: Ceates or updates a remote workspace access information
operationId: putRemoteAccess
security:
- webida-simple-auth: []
parameters:
- name: body
in: body
required: true
schema:
$ref: "#/definitions/RemoteAccess"
responses:
"200":
description: OK
schema:
$ref: "#/definitions/RestOK"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# removeRemoteWorkspace
delete:
tags: ["remotes"]
description: Removes remote workspace access information
operationId: removeRemoteAccess
security:
- webida-simple-auth: []
parameters:
- name: workspaceId
in: query
required: true
description: workspace Id of remote workspace
type: string
responses:
"200":
description: removed remote workspace access info
schema:
$ref: "#/definitions/RemoteAccess"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# session management operations
# GET : find session
# DELETE: close session
/sessions/{sessionId}:
# findSessions
get:
x-handler: handlers/session/findSessions.js
tags: ["session"]
description: |
Finds webida sessions established to server. if session id is given, matched session info will be returned and workspace id parameter will be ignored. To find all sessions of some workspace, set session id to '*' and specify workspace id.
This operation requires proper accsss rights.
1) To find all sessions, an unrestricted token is required.
2) To find some workspace sesions, token should have proper access right on the workspace.
operationId: findSessions
security:
- webida-simple-auth: []
parameters:
- $ref: "#/parameters/sessionId"
- $ref: "#/parameters/workspaceIdQuery"
responses:
"200":
description: array of sessions
schema:
type: array
items:
$ref: "#/definitions/Session"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# closeSessions
delete:
x-handler: handlers/session/closeSession.js
tags: ["session"]
description: Closes session with timeout. Targets are selected by same rule to findSessions() op. While targeting multiple sessions, this operation requires same access rights with findSessions(). Closing a single session requires 'same session id' or 'unrestricted workspace acceess'.
operationId: closeSessions
security:
- webida-simple-auth: []
parameters:
- $ref: "#/parameters/sessionId"
- $ref: "#/parameters/workspaceIdQuery"
- name: closeAfter
in: query
type: integer
description: |
Waiting time before actual closing, to let client save files and prevent reconnecting.
required: true
responses:
"200":
description: OK.
schema:
$ref: "#/definitions/RestOK"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# no POST or PUT, for session should be created or updated by web-socket
/aliass/{aliasId}:
# findAliases
get:
x-handler: handlers/alias/findAliasesjs
tags: ["alias"]
description: get alias objects. set aliasId to '*' to find all aliases in some workspace. If alias id is given, only 0 or 1 matched alias object will be returned, ignoring workspaceId and srcPath. To get an alias object of some wfs path, set srcPath value to some path, and to find all aliases in a workspace, set it to '*' (empty value is not allowed by definition)
operationId: findAliases
security:
- webida-simple-auth: []
parameters:
- $ref: "#/parameters/aliasId"
- $ref: "#/parameters/workspaceIdQuery"
- $ref: "#/parameters/srcPath"
responses:
"200":
description: alias list
schema:
type: array
items:
$ref: "#/definitions/Alias"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# putAlias
put:
x-handler: handlers/alias/putAlias.js
tags: ["alias"]
description: create, or update an alias.
operationId: putAlias
security:
- webida-simple-auth: []
parameters:
- $ref: "#/parameters/aliasId"
- name: body
in: body
description: alias object to write. should have same id to aliasId parameter.
required: true
schema:
$ref: "#/definitions/Alias"
responses:
"200":
description: OK.
schema:
$ref: "#/definitions/RestOK"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
# removeAliases
delete:
x-handler: handlers/alias/removeAlias.js
tags: ["alias"]
description: remove alias. targeting rule is same to findAliases() operation.
operationId: removeAliases
security:
- webida-simple-auth: []
parameters:
- $ref: "#/parameters/aliasId"
- $ref: "#/parameters/workspaceIdQuery"
- $ref: "#/parameters/srcPath"
responses:
"200":
description: OK.
schema:
$ref: "#/definitions/RestOK"
default:
description: Error
schema:
$ref: "#/definitions/RestError"
securityDefinitions:
webida-simple-auth:
type: apiKey
name: Authorization
in: header
x-authorize: webida-simple-auth.js
parameters:
wfsId:
name: wfsId
in: path
description: webida file system id (same to workspace id) to access.
required: true
type: string
wfsPath:
name: wfsPath
in: path
description: webida file system path to access. without heading /. should be placed at the end of path arguments
required: true
type: string
pattern: .*
srcPath:
name: srcPath
in: query
description: source data path of some operations, without have heading /
required: true
type: string
wfsPathList:
name: wfsPathList
in: query
description: array of wfsPath, without heading /.
required: true
type: array
items:
type: string
collectionFormat: multi
ensureParents:
name: ensureParents
in: query
description: A flag to create all parent directories to create file or dir, like mkdir -p. This parameter does not create entire path, but ensures 'parent directory' of the wfsPath parameter
type: boolean
required: false
default: false
noOverwrite:
name: noOverwrite
in: query
description: does not overwrites any existing file while copying or moving
required: false
type: boolean
default: false
pattern:
name: pattern
in: query
description: regex pattern to match in search or replace. In replace operation, pattern should be same to the parttern in search operation
type: string
required: true
ignoreCase:
name: ignoreCase
in: query
description: regex matching option to ignore case. In replace operation, this option should be same to one used in search operation
type: boolean
required: false
default: false
workspaceId:
name: workspaceId
in: path
description: webida workspace id (usually same to file system id, wfsId)
required: true
type: string
workspaceIdQuery:
name: workspaceId
in: query
description: webida workspace id in query part
required: true
type: string
execId:
name: execId
in: query
description: the id from execution request (different from pid!)
type: string
required: true
sessionId:
name: sessionId
in: path
description: webida session id (usually different from socket id from sock.io)
required: true
type: string
aliasId:
name: aliasId
in: path
description: url path fragment alias id. should have no '/' as well as any 'unsafe' chars for url path. especially, '*' is reserved for finding operations or some other special case.
required: true
type: string
definitions:
RestOK:
type: object
properties:
message:
description: additional text from server. Clients may use this value to debugging or logging, but should not rely on the value of this property, for server can omit to set message for performance.
type: string
RestError:
type: object
description: Error object with code and message. code is bound to status code, but not always same to standard HTTP status text. For example, some 409 error may have code "Invalid Argument" instead of "Conflic". So, Client should read message property to know what happend exactly, when an error is returned from server. And, some 500 errors can have system errno instead of useless "internal". Like other errors, details are hidden in message.