forked from siemens/wfx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wfx.swagger.yml
1102 lines (1053 loc) · 29.5 KB
/
wfx.swagger.yml
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
# SPDX-FileCopyrightText: 2023 Siemens AG
#
# SPDX-License-Identifier: Apache-2.0
---
# see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md
swagger: "2.0"
basePath: /api/wfx/v1
info:
title: "Workflow Executor"
version: "1.0.0"
license:
name: Apache 2.0
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
x-visibility: "external"
schemes:
# possible values: http, https, unix
- http
x-definitions-templates:
Limits:
maxStateCount: &maxStateCount
maxItems: 4096
maxGroupCount: &maxGroupCount
maxItems: 1024
maxTransitionCount: &maxTransitionCount
maxItems: 16384
maxTagsCount: &maxTagsCount
maxItems: 16
maxHistoryCount: &maxHistoryCount
maxItems: 8192
maxErrorCount: &maxErrorCount
maxItems: 128
maxItemsCount: &maxItemsCount
maxItems: 1024
Pagination: &pageProperties
pagination:
type: object
properties:
limit:
type: integer
format: int32
description: the maximum number of items to return
example: 20
offset:
type: integer
format: int64
description: the number of items to skip before starting to return results
example: 0
total:
type: integer
format: int64
description: the total number of items
example: 1000
definitions:
PaginatedWorkflowList:
type: object
description: Paginated list of workflows
properties:
content:
type: array
items:
$ref: "#/definitions/Workflow"
<<: *pageProperties
Workflow:
type: object
required:
- name
properties:
name:
type: string
minLength: 1
maxLength: 64
pattern: "^[a-zA-Z0-9\\-\\.]+$"
description: User provided unique workflow name
example: wfx.workflow.dau.direct
x-nullable: false
description:
type: string
maxLength: 1024
description: Description of the workflow
example: This is a workflow
states:
type: array
x-omitempty: true
<<: *maxStateCount
items:
$ref: "#/definitions/State"
groups:
type: array
x-omitempty: true
<<: *maxGroupCount
items:
$ref: "#/definitions/Group"
transitions:
type: array
x-omitempty: true
<<: *maxTransitionCount
items:
$ref: "#/definitions/Transition"
State:
type: object
required:
- name
properties:
name:
type: string
example: START
x-nullable: false
description:
type: string
example: Description of the state
Group:
type: object
required:
- name
- states
properties:
name:
type: string
example: OPEN
x-nullable: false
description:
type: string
example: Description of the group
states:
type: array
description: A list of states belonging to this group
minItems: 1
<<: *maxStateCount
items:
type: string
Transition:
type: object
required:
- from
- to
- eligible
properties:
from:
type: string
example: START
x-nullable: false
to:
type: string
example: END
x-nullable: false
description:
type: string
example: Description of the transition
eligible:
description: The entity that may execute the transition
$ref: "#/definitions/EligibleEnum"
example: CLIENT
action:
description: "The transition execution action (default: WAIT)"
$ref: "#/definitions/ActionEnum"
example: WAIT
EligibleEnum:
type: string
x-nullable: false
enum:
- CLIENT
- WFX
ActionEnum:
type: string
enum:
- IMMEDIATE
- WAIT
JobRequest:
type: object
required:
- clientId
- workflow
properties:
clientId:
type: string
description: Create job for the given client ID
example: client42
x-nullable: false
workflow:
type: string
description: Workflow name
example: wfx.workflow.dau.direct
x-nullable: false
tags:
type: array
items:
type: string
example: EUROPE_WEST
<<: *maxTagsCount
definition:
description: The existing job definition will be replaced with this if this property is not empty.
type: object
additionalProperties:
type: object
example: |
{ "userDefined": {} }
JobStatus:
type: object
description: Job status information
required:
- state
properties:
state:
type: string
x-nullable: false
example: END
description: Name of the new workflow state
clientId:
type: string
x-nullable: false
example: client42
description: Client which sent the status update
progress:
description: Current job progress percentage
type: number
format: int32
maximum: 100
message:
type: string
description: Reason message/info, free text from client
maxLength: 1024
definitionHash:
type: string
description: Job definition hash
readOnly: true
maxLength: 64
context:
type: object
description: Client-specific JSON object to report additional context information such as error details, stack traces, etc
minLength: 0
maxLength: 20000
additionalProperties:
type: object
example: |
{
"lines": [ "line1", "line2" ]
}
Job:
type: object
properties:
id:
type: string
description: Unique job ID (wfx-generated)
example: "3307e5cb-074c-49b7-99d4-5e61839a4c2d"
readOnly: true
x-nullable: false
maxLength: 36
clientId:
type: string
example: client42
x-nullable: false
workflow:
$ref: "#/definitions/Workflow"
tags:
type: array
x-omitempty: true
items:
type: string
<<: *maxTagsCount
definition:
type: object
additionalProperties:
type: object
example: |
{ "userDefined": {} }
status:
$ref: "#/definitions/JobStatus"
stime:
description: Date and time (ISO8601) when the job was created (set by wfx). Although stime conceptually always exists, it's nullable because we don't want to serialize stime in some cases (e.g. for job events).
type: string
format: date-time
readOnly: true
x-nullable: true
mtime:
description: Date and time (ISO8601) when the job was last modified (set by wfx)
type: string
format: date-time
readOnly: true
x-nullable: true
history:
description: |
The job's history. Last in, first out (LIFO). Array is truncated if its length exceeds the maximum allowed length.
By default, the job history is omitted from responses unless explicitly requested by the client (see the `history` URL parameter).
type: array
x-omitempty: true
<<: *maxHistoryCount
items:
$ref: "#/definitions/History"
History:
type: object
properties:
mtime:
description: Date and time (ISO8601) when the job was modified (set by wfx)
type: string
format: date-time
readOnly: true
status:
$ref: "#/definitions/JobStatus"
description: A previous job status
definition:
type: object
additionalProperties:
type: object
example: |
{ "userDefined": {} }
PaginatedJobList:
type: object
description: Paginated list of jobs
properties:
content:
type: array
items:
$ref: "#/definitions/Job"
<<: *pageProperties
ErrorResponse:
type: object
properties:
errors:
type: array
<<: *maxErrorCount
items:
$ref: "#/definitions/Error"
Error:
type: object
properties:
code:
type: string
description: Identifier code for the reason of the error
logref:
type: string
description: Log correlation ID
message:
type: string
description: Error message
parameters:
state:
name: state
in: query
description: Filter jobs based on the current state value
required: false
type: string
group:
name: group
in: query
description: Filter jobs based on the group they are in
required: false
type: array
items:
type: string
clientId:
name: clientId
in: query
description: Filter jobs belonging to a specific client with clientId
required: false
type: string
workflow:
name: workflow
in: query
description: Filter jobs matching by workflow
required: false
type: string
history:
name: history
in: query
description: Boolean flag to include the transition history of the job
required: false
type: boolean
jobId:
name: id
in: path
description: Job ID
required: true
type: string
tag:
name: tag
in: query
description: Filter jobs by tags
required: false
type: array
items:
type: string
sort:
name: sort
in: query
type: string
enum: [asc, desc]
default: asc
required: false
description: the order of returned elements
limit:
name: limit
in: query
type: integer
format: int32
description: the maximum number of items to return
default: 10
<<: *maxItemsCount
offset:
name: offset
in: query
type: integer
format: int64
default: 0
description: the number of items to skip before starting to return results
x-paths-templates:
Errors:
invalidRequestError: &invalidRequestError
code: wfx.invalidRequest
logref: 96a37ea1f7d205ffbfa12334c6812727
message: The request was invalid and could not be completed by the storage
jobNotFoundError: &jobNotFoundError
code: wfx.jobNotFound
logref: 11cc67762090e15b79a1387eca65ba65
message: Job ID was not found
jobTerminalStateError: &jobTerminalStateError
code: wfx.jobTerminalState
logref: 916f0a913a3e4a52a96bd271e029c201
message: The request was invalid because the job is in a terminal state
workflowNotFoundError: &workflowNotFoundError
code: wfx.workflowNotFound
logref: c452719774086b6e803bb8f6ecea9899
message: Workflow not found for given name
workflowNotUniqueError: &workflowNotUniqueError
code: wfx.workflowNotUnique
logref: e1ee1f2aea859b9dd34579610e386da6
message: Workflow with name already exists
workflowInvalidError: &workflowInvalidError
code: wfx.workflowInvalid
logref: 18f57adc70dd79c7fb4f1246be8a6e04
message: Workflow validation failed
paths:
/workflows:
get:
summary: List of available workflows
description: List of available workflows
tags:
- workflows
- northbound
- southbound
consumes:
- application/json
produces:
- application/json
parameters:
- $ref: "#/parameters/limit"
- $ref: "#/parameters/offset"
- $ref: "#/parameters/sort"
responses:
"default":
description: Other error with any status code and response body format.
"200":
description: A list of workflows
schema:
$ref: "#/definitions/PaginatedWorkflowList"
post:
summary: Add a new workflow
description: Add a new workflow
tags:
- workflows
- northbound
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: Workflow
description: Workflow object to be added
required: true
schema:
$ref: "#/definitions/Workflow"
responses:
"default":
description: Other error with any status code and response body format.
"201":
description: Workflow was created
schema:
$ref: "#/definitions/Workflow"
"400":
description: Bad Request
schema:
$ref: "#/definitions/ErrorResponse"
examples:
Error responses occurring at this operation for invalid requests:
errors:
- <<: *workflowNotUniqueError
- <<: *workflowInvalidError
/workflows/{name}:
get:
summary: Workflow description for a given name
description: Workflow description for a given name
tags:
- workflows
- northbound
- southbound
consumes:
- application/json
produces:
- application/json
parameters:
- name: name
in: path
description: Unique name for the workflow
required: true
type: string
responses:
"default":
description: Other error with any status code and response body format.
"200":
description: Workflow description with the provided key
schema:
$ref: "#/definitions/Workflow"
"400":
description: If request is invalid
schema:
$ref: "#/definitions/ErrorResponse"
examples:
Error responses occurring at this operation for invalid requests:
errors:
- <<: *invalidRequestError
"404":
description: Not Found
schema:
$ref: "#/definitions/ErrorResponse"
examples:
Error responses occurring at this operation while querying a non-existent workflow:
errors:
- <<: *workflowNotFoundError
delete:
summary: Delete an existing workflow
description: >
Delete an existing workflow
tags:
- workflows
- northbound
consumes:
- application/json
produces:
- application/json
parameters:
- name: name
in: path
description: Workflow name
required: true
type: string
responses:
"default":
description: Other error with any status code and response body format.
"204":
description: The workflow has been deleted.
"404":
description: Not Found
schema:
$ref: "#/definitions/ErrorResponse"
examples:
Error responses occurring at this operation while querying a non-existent workflow:
errors:
- <<: *workflowNotFoundError
/jobs:
post:
summary: Add a new job
description: >
Add a new job
tags:
- jobs
- northbound
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: Job
description: Job which shall be created
required: true
schema:
$ref: "#/definitions/JobRequest"
responses:
"default":
description: Other error with any status code and response body format.
"201":
description: Job was created
schema:
$ref: "#/definitions/Job"
"400":
description: Bad Request
schema:
$ref: "#/definitions/ErrorResponse"
examples:
Error responses occurring at this operation for invalid requests:
errors:
- <<: *invalidRequestError
get:
summary: List of job descriptions
description: >
List of job descriptions
By default, this endpoint returns the list of jobs in a specific
order and predetermined paging properties.
These defaults are:
- Ascending sort on stime
- 10 entries per page
tags:
- jobs
- southbound
- northbound
consumes:
- application/json
produces:
- application/json
parameters:
- $ref: "#/parameters/offset"
- $ref: "#/parameters/limit"
- $ref: "#/parameters/sort"
# filtering
- $ref: "#/parameters/state"
- $ref: "#/parameters/group"
- $ref: "#/parameters/clientId"
- $ref: "#/parameters/workflow"
- $ref: "#/parameters/tag"
responses:
"default":
description: Other error with any status code and response body format.
"200":
description: A paginated job list.
schema:
$ref: "#/definitions/PaginatedJobList"
"400":
description: If request is invalid
schema:
$ref: "#/definitions/ErrorResponse"
examples:
Error responses occurring at this operation for invalid requests:
errors:
- <<: *invalidRequestError
/jobs/events:
get:
summary: Subscribe to job-related events such as status updates
description: >
Obtain instant notifications when there are job changes matching the criteria.
This endpoint utilizes server-sent events (SSE), where responses are "chunked" with double newline breaks.
For example, a single event might look like this:
data: {"clientId":"example_client","state":"INSTALLING"}\n\n
tags:
- jobs
- northbound
- southbound
produces:
- application/json
- text/event-stream
parameters:
- name: clientIds
in: query
description: The job's clientId must be one of these clientIds (comma-separated).
required: false
type: string
- name: jobIds
in: query
description: The job's id must be one of these ids (comma-separated).
required: false
type: string
- name: workflows
in: query
description: The job's workflow must be equal to one of the provided workflow names (comma-separated).
required: false
type: string
- name: tags
in: query
description: >
A (comma-separated) list of tags to include into each job event.
This can be used to aggregrate events from multiple wfx instances.
required: false
type: string
responses:
"default":
description: Other error with any status code and response body format
"200":
description: A stream of server-sent events
"400":
description: Bad Request
schema:
$ref: "#/definitions/ErrorResponse"
examples:
Error responses occurring at this operation for invalid requests:
errors:
- <<: *jobTerminalStateError
"404":
description: Not Found
schema:
$ref: "#/definitions/ErrorResponse"
examples:
Error responses occurring at this operation while updating a non-existent job:
errors:
- <<: *jobNotFoundError
/jobs/{id}:
get:
summary: Job description for a given ID
description: >
Job description for a given ID
tags:
- jobs
- southbound
- northbound
consumes:
- application/json
produces:
- application/json
parameters:
- $ref: "#/parameters/jobId"
- $ref: "#/parameters/history"
responses:
"default":
description: Other error with any status code and response body format.
"200":
description: Job description for for a given ID
schema:
$ref: "#/definitions/Job"
"400":
description: Bad Request
schema:
$ref: "#/definitions/ErrorResponse"
examples:
Error responses occurring at this operation for invalid requests:
errors:
- <<: *invalidRequestError
"404":
description: Not Found
schema:
$ref: "#/definitions/ErrorResponse"
examples:
Error responses occurring at this operation while querying a non-existent job:
errors:
- <<: *jobNotFoundError
delete:
summary: Delete an existing job
description: >
Delete an existing job
tags:
- jobs
- northbound
consumes:
- application/json
produces:
- application/json
parameters:
- $ref: "#/parameters/jobId"
responses:
"default":
description: Other error with any status code and response body format.
"204":
description: The job has been deleted.
"404":
description: Not Found
schema:
$ref: "#/definitions/ErrorResponse"
examples:
Error responses occurring at this operation while querying a non-existent workflow:
errors:
- <<: *workflowNotFoundError
/jobs/{id}/status:
get:
summary: Get job status
description: Retrieve the job status
tags:
- jobs
- northbound
- southbound
consumes:
- application/json
produces:
- application/json
parameters:
- $ref: "#/parameters/jobId"
responses:
"default":
description: Other error with any status code and response body format.
"200":
description: Job status
schema:
$ref: "#/definitions/JobStatus"
"404":
description: Not Found
schema:
$ref: "#/definitions/ErrorResponse"
examples:
Error responses occurring at this operation while updating a non-existent job:
errors:
- <<: *jobNotFoundError
put:
summary: Modify status of an existing job
description: >
Modify status of an existing job
tags:
- jobs
- southbound
- northbound
consumes:
- application/json
produces:
- application/json
parameters:
- $ref: "#/parameters/jobId"
- in: body
name: New job status
description: This contains the new job status
required: true
schema:
$ref: "#/definitions/JobStatus"
responses:
"default":
description: Other error with any status code and response body format.
"200":
description: Job modified successfully
schema:
$ref: "#/definitions/JobStatus"
"400":
description: Bad Request
schema:
$ref: "#/definitions/ErrorResponse"
examples:
Error responses occurring at this operation for invalid requests:
errors:
- <<: *invalidRequestError
"404":
description: Not Found
schema:
$ref: "#/definitions/ErrorResponse"
examples:
Error responses occurring at this operation while updating a non-existent job:
errors:
- <<: *jobNotFoundError
/jobs/{id}/definition:
get:
summary: Get job definition
description: Retrieve the job definition
tags:
- jobs
- northbound
- southbound
consumes:
- application/json
produces:
- application/json
parameters:
- $ref: "#/parameters/jobId"
responses:
"default":
description: Other error with any status code and response body format.
"200":
description: Job definition
schema:
type: object
additionalProperties:
type: object
example: |
{ "userDefined": {} }
"404":
description: Not Found
schema:
$ref: "#/definitions/ErrorResponse"
examples:
Error responses occurring at this operation while updating a non-existent job:
errors:
- <<: *jobNotFoundError
put:
summary: Modify job definition
description: >
Modify the job definition of an existing job
tags:
- jobs
- southbound
- northbound
consumes:
- application/json
produces:
- application/json
parameters:
- $ref: "#/parameters/jobId"
- in: body
name: JobDefinition
description: How to modify the job
required: true
schema:
type: object
additionalProperties:
type: object
example: |
{ "userDefined": {} }
responses:
"default":
description: Other error with any status code and response body format.
"200":
description: Job modified successfully
schema:
type: object
additionalProperties:
type: object
example: |
{ "userDefined": {} }
"400":
description: Bad Request
schema:
$ref: "#/definitions/ErrorResponse"
examples:
Error responses occurring at this operation for invalid requests:
errors:
- <<: *invalidRequestError
"404":
description: Not Found
schema:
$ref: "#/definitions/ErrorResponse"
examples:
Error responses occurring at this operation while updating a non-existent job:
errors:
- <<: *jobNotFoundError
/jobs/{id}/tags:
get:
summary: Get tags
description: Get the tags of a job
tags:
- jobs
- northbound
- southbound
consumes:
- application/json
produces:
- application/json
parameters:
- $ref: "#/parameters/jobId"
responses:
"default":
description: Other error with any status code and response body format.
"200":
description: Job tags
schema:
type: array
items:
type: string
example: EUROPE_WEST
"404":
description: Not Found
schema:
$ref: "#/definitions/ErrorResponse"
examples:
Error responses occurring at this operation while updating a non-existent job:
errors:
- <<: *jobNotFoundError
post:
summary: Add a tag
description: >
Add a tag to an existing job
tags:
- jobs
- northbound
consumes:
- application/json
produces: