-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathswagger.yaml
More file actions
735 lines (735 loc) · 18 KB
/
swagger.yaml
File metadata and controls
735 lines (735 loc) · 18 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
basePath: /api/v1
definitions:
handlers.ConcurrencyStatus:
properties:
available_slots:
type: integer
slots_acquired_total:
type: integer
slots_released_total:
type: integer
total_active_slots:
type: integer
type: object
handlers.HealthResponse:
properties:
service:
type: string
status:
type: string
timestamp:
type: string
uptime:
type: string
version:
type: string
type: object
handlers.ReadinessResponse:
properties:
checks:
additionalProperties:
type: string
type: object
status:
type: string
timestamp:
type: string
type: object
handlers.WorkerManagerStatus:
properties:
is_healthy:
type: boolean
is_running:
type: boolean
type: object
handlers.WorkerPoolStatus:
properties:
active_workers:
type: integer
average_task_time:
example: 1m30s
type: string
idle_workers:
type: integer
pool_size:
type: integer
total_tasks_failed:
type: integer
total_tasks_processed:
type: integer
total_tasks_successful:
type: integer
unhealthy_workers:
type: integer
type: object
handlers.WorkerStatusResponse:
properties:
concurrency:
$ref: '#/definitions/handlers.ConcurrencyStatus'
status:
type: string
timestamp:
type: string
worker_manager:
$ref: '#/definitions/handlers.WorkerManagerStatus'
worker_pool:
$ref: '#/definitions/handlers.WorkerPoolStatus'
type: object
models.AuthResponse:
properties:
access_token:
type: string
expires_in:
type: integer
refresh_token:
type: string
token_type:
type: string
user:
$ref: '#/definitions/models.UserResponse'
type: object
models.CreateTaskRequest:
properties:
description:
maxLength: 1000
type: string
metadata:
$ref: '#/definitions/models.JSONB'
name:
maxLength: 255
minLength: 1
type: string
priority:
maximum: 10
minimum: 0
type: integer
script_content:
maxLength: 65535
minLength: 1
type: string
script_type:
$ref: '#/definitions/models.ScriptType'
timeout_seconds:
maximum: 3600
minimum: 1
type: integer
required:
- name
- script_content
- script_type
type: object
models.ErrorResponse:
properties:
details:
type: string
error:
type: string
validation_errors:
items:
$ref: '#/definitions/models.ValidationError'
type: array
type: object
models.ExecutionStatus:
enum:
- pending
- running
- completed
- failed
- timeout
- cancelled
type: string
x-enum-varnames:
- ExecutionStatusPending
- ExecutionStatusRunning
- ExecutionStatusCompleted
- ExecutionStatusFailed
- ExecutionStatusTimeout
- ExecutionStatusCancelled
models.JSONB:
additionalProperties: true
type: object
models.LoginRequest:
properties:
email:
type: string
password:
type: string
required:
- email
- password
type: object
models.RefreshTokenRequest:
properties:
refresh_token:
type: string
required:
- refresh_token
type: object
models.RegisterRequest:
properties:
email:
type: string
name:
maxLength: 255
minLength: 1
type: string
password:
minLength: 8
type: string
required:
- email
- name
- password
type: object
models.ScriptType:
enum:
- python
- javascript
- bash
- go
type: string
x-enum-varnames:
- ScriptTypePython
- ScriptTypeJavaScript
- ScriptTypeBash
- ScriptTypeGo
models.TaskExecutionResponse:
properties:
completed_at:
type: string
created_at:
type: string
execution_time_ms:
type: integer
id:
type: string
memory_usage_bytes:
type: integer
return_code:
type: integer
started_at:
type: string
status:
$ref: '#/definitions/models.ExecutionStatus'
stderr:
type: string
stdout:
type: string
task_id:
type: string
type: object
models.TaskListResponse:
properties:
limit:
type: integer
offset:
type: integer
tasks:
items:
$ref: '#/definitions/models.TaskResponse'
type: array
total:
type: integer
type: object
models.TaskResponse:
properties:
created_at:
type: string
description:
type: string
id:
type: string
metadata:
$ref: '#/definitions/models.JSONB'
name:
type: string
priority:
type: integer
script_content:
type: string
script_type:
$ref: '#/definitions/models.ScriptType'
status:
$ref: '#/definitions/models.TaskStatus'
timeout_seconds:
type: integer
updated_at:
type: string
user_id:
type: string
type: object
models.TaskStatus:
enum:
- pending
- running
- completed
- failed
- timeout
- cancelled
type: string
x-enum-varnames:
- TaskStatusPending
- TaskStatusRunning
- TaskStatusCompleted
- TaskStatusFailed
- TaskStatusTimeout
- TaskStatusCancelled
models.UserResponse:
properties:
created_at:
type: string
email:
type: string
id:
type: string
name:
type: string
updated_at:
type: string
type: object
models.ValidationError:
properties:
field:
type: string
message:
type: string
tag:
type: string
value:
type: string
type: object
host: localhost:8080
info:
contact:
email: support@voidrunner.com
name: VoidRunner Support
url: https://github.com/voidrunnerhq/voidrunner
description: VoidRunner is a distributed task execution platform that allows users
to create, manage, and execute code tasks securely in isolated containers.
license:
name: MIT
url: https://opensource.org/licenses/MIT
termsOfService: https://voidrunner.com/terms
title: VoidRunner API
version: 1.0.0
paths:
/api:
get:
description: Returns an HTML page with links to various API documentation formats
produces:
- text/html
responses:
"200":
description: HTML documentation index
schema:
type: string
summary: API Documentation Index
tags:
- Documentation
/auth/login:
post:
consumes:
- application/json
description: Authenticates a user with email and password, returns access and
refresh tokens
parameters:
- description: User login credentials
in: body
name: request
required: true
schema:
$ref: '#/definitions/models.LoginRequest'
produces:
- application/json
responses:
"200":
description: Login successful
schema:
$ref: '#/definitions/models.AuthResponse'
"400":
description: Invalid request format or validation error
schema:
$ref: '#/definitions/models.ErrorResponse'
"401":
description: Invalid credentials
schema:
$ref: '#/definitions/models.ErrorResponse'
"429":
description: Rate limit exceeded
schema:
$ref: '#/definitions/models.ErrorResponse'
summary: Authenticate user
tags:
- Authentication
/auth/logout:
post:
consumes:
- application/json
description: Logs out the current user (client-side token removal)
produces:
- application/json
responses:
"200":
description: Logout successful
schema:
additionalProperties:
type: string
type: object
summary: Logout user
tags:
- Authentication
/auth/me:
get:
consumes:
- application/json
description: Returns information about the currently authenticated user
produces:
- application/json
responses:
"200":
description: User information retrieved successfully
schema:
additionalProperties:
$ref: '#/definitions/models.UserResponse'
type: object
"401":
description: Unauthorized
schema:
$ref: '#/definitions/models.ErrorResponse'
security:
- BearerAuth: []
summary: Get current user
tags:
- Authentication
/auth/refresh:
post:
consumes:
- application/json
description: Generates a new access token using a valid refresh token
parameters:
- description: Refresh token request
in: body
name: request
required: true
schema:
$ref: '#/definitions/models.RefreshTokenRequest'
produces:
- application/json
responses:
"200":
description: Token refreshed successfully
schema:
$ref: '#/definitions/models.AuthResponse'
"400":
description: Invalid request format
schema:
$ref: '#/definitions/models.ErrorResponse'
"401":
description: Invalid refresh token
schema:
$ref: '#/definitions/models.ErrorResponse'
"429":
description: Rate limit exceeded
schema:
$ref: '#/definitions/models.ErrorResponse'
summary: Refresh access token
tags:
- Authentication
/auth/register:
post:
consumes:
- application/json
description: Creates a new user account with email and password
parameters:
- description: User registration details
in: body
name: request
required: true
schema:
$ref: '#/definitions/models.RegisterRequest'
produces:
- application/json
responses:
"201":
description: User registered successfully
schema:
$ref: '#/definitions/models.AuthResponse'
"400":
description: Invalid request format or validation error
schema:
$ref: '#/definitions/models.ErrorResponse'
"409":
description: User already exists
schema:
$ref: '#/definitions/models.ErrorResponse'
"429":
description: Rate limit exceeded
schema:
$ref: '#/definitions/models.ErrorResponse'
summary: Register a new user
tags:
- Authentication
/docs:
get:
description: Redirects to the Swagger UI interface
responses:
"302":
description: Redirect to Swagger UI
schema:
type: string
summary: Redirect to Swagger UI
tags:
- Documentation
/docs/swagger.json:
get:
description: Returns the OpenAPI specification in JSON format
produces:
- application/json
responses:
"200":
description: OpenAPI specification
schema:
additionalProperties: true
type: object
summary: Get OpenAPI JSON specification
tags:
- Documentation
/docs/swagger.yaml:
get:
description: Returns the OpenAPI specification in YAML format
produces:
- text/yaml
responses:
"200":
description: OpenAPI specification in YAML
schema:
type: string
summary: Get OpenAPI YAML specification
tags:
- Documentation
/health:
get:
consumes:
- application/json
description: Returns the health status of the API service
produces:
- application/json
responses:
"200":
description: Service is healthy
schema:
$ref: '#/definitions/handlers.HealthResponse'
summary: Health check
tags:
- Health
/health/workers:
get:
description: Returns detailed status information about the embedded worker system
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handlers.WorkerStatusResponse'
"503":
description: Service Unavailable
schema:
additionalProperties:
type: string
type: object
summary: Worker status
tags:
- Health
/ready:
get:
consumes:
- application/json
description: Returns the readiness status of the API service and its dependencies
produces:
- application/json
responses:
"200":
description: Service is ready
schema:
$ref: '#/definitions/handlers.ReadinessResponse'
"503":
description: Service is not ready
schema:
$ref: '#/definitions/handlers.ReadinessResponse'
summary: Readiness check
tags:
- Health
/tasks:
get:
consumes:
- application/json
description: Retrieves a paginated list of tasks owned by the authenticated
user
parameters:
- default: 20
description: Maximum number of tasks to return
in: query
name: limit
type: integer
- default: 0
description: Number of tasks to skip
in: query
name: offset
type: integer
produces:
- application/json
responses:
"200":
description: Tasks retrieved successfully
schema:
$ref: '#/definitions/models.TaskListResponse'
"400":
description: Invalid query parameters
schema:
$ref: '#/definitions/models.ErrorResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/models.ErrorResponse'
"429":
description: Rate limit exceeded
schema:
$ref: '#/definitions/models.ErrorResponse'
security:
- BearerAuth: []
summary: List user's tasks
tags:
- Tasks
post:
consumes:
- application/json
description: Creates a new task with the specified script content and configuration
parameters:
- description: Task creation details
in: body
name: request
required: true
schema:
$ref: '#/definitions/models.CreateTaskRequest'
produces:
- application/json
responses:
"201":
description: Task created successfully
schema:
$ref: '#/definitions/models.TaskResponse'
"400":
description: Invalid request format or validation error
schema:
$ref: '#/definitions/models.ErrorResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/models.ErrorResponse'
"429":
description: Rate limit exceeded
schema:
$ref: '#/definitions/models.ErrorResponse'
security:
- BearerAuth: []
summary: Create a new task
tags:
- Tasks
/tasks/{id}:
get:
consumes:
- application/json
description: Retrieves detailed information about a specific task
parameters:
- description: Task ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: Task retrieved successfully
schema:
$ref: '#/definitions/models.TaskResponse'
"400":
description: Invalid task ID
schema:
$ref: '#/definitions/models.ErrorResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/models.ErrorResponse'
"403":
description: Forbidden
schema:
$ref: '#/definitions/models.ErrorResponse'
"404":
description: Task not found
schema:
$ref: '#/definitions/models.ErrorResponse'
"429":
description: Rate limit exceeded
schema:
$ref: '#/definitions/models.ErrorResponse'
security:
- BearerAuth: []
summary: Get task details
tags:
- Tasks
/tasks/{task_id}/executions:
post:
consumes:
- application/json
description: Starts execution of the specified task
parameters:
- description: Task ID
in: path
name: task_id
required: true
type: string
produces:
- application/json
responses:
"201":
description: Execution started successfully
schema:
$ref: '#/definitions/models.TaskExecutionResponse'
"400":
description: Invalid task ID
schema:
$ref: '#/definitions/models.ErrorResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/models.ErrorResponse'
"403":
description: Forbidden
schema:
$ref: '#/definitions/models.ErrorResponse'
"404":
description: Task not found
schema:
$ref: '#/definitions/models.ErrorResponse'
"409":
description: Task is already running
schema:
$ref: '#/definitions/models.ErrorResponse'
"429":
description: Rate limit exceeded
schema:
$ref: '#/definitions/models.ErrorResponse'
security:
- BearerAuth: []
summary: Start task execution
tags:
- Executions
securityDefinitions:
BearerAuth:
description: Type "Bearer" followed by a space and JWT token.
in: header
name: Authorization
type: apiKey
swagger: "2.0"