Skip to content

Commit d05ba73

Browse files
junweid62Junwei Daidblock
authored
Complete API spec implementation for flow_framework (#565)
* Add some 4xx error test Signed-off-by: Junwei Dai <[email protected]> * 1. Adding API spec for GET /workflow/_steps 2. Adding Test for this API Signed-off-by: Junwei Dai <[email protected]> * 1. Adding API spec for GET /workflow/_status 2. Adding Test for this API Signed-off-by: Junwei Dai <[email protected]> * 1. Adding API spec for POST /workflow/_deprovision 2. Adding Test for this API Signed-off-by: Junwei Dai <[email protected]> * 1. Adding API spec for POST /workflow/_provision 2. Adding Test for this API Signed-off-by: Junwei Dai <[email protected]> * 1. Adding API spec for POST /workflow/_search 2. Adding Test for this API Signed-off-by: Junwei Dai <[email protected]> * 1. Adding API spec for POST/GET /workflow/state/_search 2. Adding Test for this API Signed-off-by: Junwei Dai <[email protected]> * add change log Signed-off-by: Junwei Dai <[email protected]> * Update tests/default/flow_framework/workflow.yaml Co-authored-by: Daniel (dB.) Doubrovkine <[email protected]> Signed-off-by: Junwei Dai <[email protected]> * change searchStateResponse spec. Signed-off-by: Junwei Dai <[email protected]> * update workflow.yaml add new test file seperate test senario Signed-off-by: Junwei Dai <[email protected]> --------- Signed-off-by: Junwei Dai <[email protected]> Signed-off-by: Junwei Dai <[email protected]> Co-authored-by: Junwei Dai <[email protected]> Co-authored-by: Daniel (dB.) Doubrovkine <[email protected]>
1 parent 9d59d92 commit d05ba73

12 files changed

+1033
-31
lines changed

.cspell

+2-1
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,5 @@ vectory
192192
whoamiprotected
193193
wordnet
194194
Yrtsd
195-
reprovision
195+
reprovision
196+
deprovision

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
9292
- Added request and response schemas for `/_cluster/decommission/awareness` ([#524](https://github.com/opensearch-project/opensearch-api-specification/pull/524))
9393
- Added `Bytes` component of type number ([#552](https://github.com/opensearch-project/opensearch-api-specification/pull/552))
9494
- Added `xy_shape` query ([#531](https://github.com/opensearch-project/opensearch-api-specification/pull/531))
95+
- Added `/_plugins/_flow_framework/` ,`_search`,`state/_search`,`_provision`,`_deprovision`,`_steps`,`_status`([#508](https://github.com/opensearch-project/opensearch-api-specification/issues/508))
9596

9697
### Changed
9798

spec/namespaces/flow_framework.yaml

+353-21
Large diffs are not rendered by default.

spec/schemas/flow_framework.common.yaml

+245-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,34 @@ info:
66
paths: { }
77
components:
88
schemas:
9+
AllowDelete:
10+
description: Required when deleting resources involves a high potential for data loss.
11+
type: string
12+
WorkflowID:
13+
type: string
14+
WorkflowStepName:
15+
type: string
16+
Provision:
17+
description: Provision the workflow as part of the request.
18+
type: boolean
19+
default: false
20+
Reprovision:
21+
type: boolean
22+
default: false
23+
UseCase:
24+
type: string
25+
Validation:
26+
description: Validate the workflow. Valid values are all (validate the template) and none (do not validate the template). Default is all.
27+
type: string
28+
default: all
29+
UpdateFields:
30+
description: Update only the fields included in the request body.
31+
type: boolean
32+
default: false
33+
All:
34+
description: The all parameter specifies whether the response should return all fields.
35+
type: boolean
36+
default: false
937
FlowFrameworkCreate:
1038
type: object
1139
properties:
@@ -105,6 +133,82 @@ components:
105133
failed:
106134
type: integer
107135
description: The number of shards where the deletion failed.
136+
query:
137+
type: object
138+
description: The search query to match workflows. Use `match_all` to retrieve all workflows, or `match` to search by specific fields like `use_case`.
139+
properties:
140+
match:
141+
type: object
142+
match_all:
143+
type: object
144+
total:
145+
type: object
146+
properties:
147+
value:
148+
type: integer
149+
description: Total number of matching documents.
150+
relation:
151+
type: string
152+
description: The relation of the total hits.
153+
itemsObject:
154+
type: object
155+
properties:
156+
_index:
157+
type: string
158+
description: The index name where the document resides.
159+
_id:
160+
type: string
161+
description: The document ID.
162+
_version:
163+
type: integer
164+
description: The version of the document.
165+
_seq_no:
166+
type: integer
167+
description: The sequence number of the document.
168+
_primary_term:
169+
type: integer
170+
description: The primary term of the document.
171+
_score:
172+
type: number
173+
format: float
174+
description: The score of the search hit.
175+
_source:
176+
$ref: '#/components/schemas/FlowFrameworkGetResponse'
177+
StateItems:
178+
type: object
179+
properties:
180+
_index:
181+
type: string
182+
description: The index name where the document resides.
183+
_id:
184+
type: string
185+
description: The document ID.
186+
_version:
187+
type: integer
188+
description: The version of the document.
189+
_seq_no:
190+
type: integer
191+
description: The sequence number of the document.
192+
_primary_term:
193+
type: integer
194+
description: The primary term of the document.
195+
_score:
196+
type: number
197+
format: float
198+
description: The score of the search hit.
199+
_source:
200+
$ref: '#/components/schemas/SearchStateResponse'
201+
SearchStateResponse:
202+
type: object
203+
properties:
204+
workflow_id:
205+
type: string
206+
provisioning_progress:
207+
type: string
208+
state:
209+
type: string
210+
user:
211+
$ref: '#/components/schemas/user'
108212
user:
109213
type: object
110214
properties:
@@ -124,4 +228,144 @@ components:
124228
type: string
125229
user_requested_tenant:
126230
type: string
127-
nullable: true
231+
nullable: true
232+
hits:
233+
type: object
234+
properties:
235+
total:
236+
$ref: '#/components/schemas/total'
237+
max_score:
238+
type: number
239+
format: float
240+
description: The maximum score of the search hits.
241+
hits:
242+
type: array
243+
items:
244+
$ref: '#/components/schemas/itemsObject'
245+
StateHits:
246+
type: object
247+
properties:
248+
total:
249+
$ref: '#/components/schemas/total'
250+
max_score:
251+
type: number
252+
format: float
253+
description: The maximum score of the search hits.
254+
hits:
255+
type: array
256+
items:
257+
$ref: '#/components/schemas/StateItems'
258+
WorkflowStep:
259+
type: object
260+
properties:
261+
inputs:
262+
type: array
263+
items:
264+
type: string
265+
description: The list of required inputs for the workflow step
266+
outputs:
267+
type: array
268+
items:
269+
type: string
270+
description: The list of outputs generated by the workflow step
271+
required_plugins:
272+
type: array
273+
items:
274+
type: string
275+
description: The list of plugins required for the workflow step
276+
WorkFlowStatusDefaultResponse:
277+
type: object
278+
properties:
279+
workflow_id:
280+
type: string
281+
description: The ID of the workflow
282+
error:
283+
type: string
284+
description: Any error state associated with the workflow
285+
nullable: true
286+
state:
287+
type: string
288+
description: The current state of the workflow
289+
resources_created:
290+
type: array
291+
items:
292+
type: string
293+
description: A list of resources created by the workflow
294+
WorkFlowStatusFullResponse:
295+
type: object
296+
properties:
297+
workflow_id:
298+
type: string
299+
description: The ID of the workflow
300+
error:
301+
type: string
302+
description: Any error state associated with the workflow
303+
nullable: true
304+
state:
305+
type: string
306+
description: The current state of the workflow
307+
enum:
308+
- COMPLETED
309+
- FAILED
310+
- NOT_STARTED
311+
- PROVISIONING
312+
resources_created:
313+
type: array
314+
items:
315+
type: string
316+
description: A list of resources created by the workflow
317+
provisioning_progress:
318+
type: string
319+
description: The progress of the provisioning process
320+
nullable: true
321+
provision_start_time:
322+
type: string
323+
format: date-time
324+
description: The start time of the provisioning process
325+
provision_end_time:
326+
type: string
327+
format: date-time
328+
description: The end time of the provisioning process
329+
user:
330+
$ref: '#/components/schemas/user'
331+
user_outputs:
332+
type: array
333+
items:
334+
type: string
335+
description: Outputs generated by the user
336+
UserProvidedSubstitutionExpressions:
337+
type: object
338+
additionalProperties:
339+
type: string
340+
description: The value for the user-provided key. Keys represent substitution expressions.
341+
SearchWorkflowRequest:
342+
type: object
343+
properties:
344+
query:
345+
$ref: '#/components/schemas/query'
346+
WorkflowSearchResponse:
347+
type: object
348+
properties:
349+
took:
350+
type: integer
351+
description: Time in milliseconds that the request took to complete.
352+
timed_out:
353+
type: boolean
354+
description: Indicates if the request timed out.
355+
_shards:
356+
$ref: '#/components/schemas/shards'
357+
hits:
358+
$ref: '#/components/schemas/hits'
359+
WorkflowSearchStateResponse:
360+
type: object
361+
properties:
362+
took:
363+
type: integer
364+
description: Time in milliseconds that the request took to complete.
365+
timed_out:
366+
type: boolean
367+
description: Indicates if the request timed out.
368+
_shards:
369+
$ref: '#/components/schemas/shards'
370+
hits:
371+
$ref: '#/components/schemas/StateHits'

spec/schemas/flow_framework.errors.yaml

+80-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ components:
1616
example: This API is disabled. To enable it, set [flow_framework.enabled] to true.
1717
status:
1818
type: integer
19-
BadRequestError:
19+
InvalidParameterError:
2020
content:
2121
application/json:
2222
type: object
@@ -66,6 +66,35 @@ components:
6666
example: Workflow ID can not be null
6767
status:
6868
type: integer
69+
DuplicateKeyError:
70+
type: object
71+
properties:
72+
error:
73+
type: string
74+
description: Error message when a duplicate key is found in the request.
75+
status:
76+
type: integer
77+
description: HTTP status code for the error.
78+
example: 400
79+
InvalidRequestBodyFieldError:
80+
type: object
81+
properties:
82+
error:
83+
type: string
84+
description: Error message when a request body field is not a string.
85+
status:
86+
type: integer
87+
description: HTTP status code for the error.
88+
RequestBodyParsingFailedError:
89+
type: object
90+
properties:
91+
error:
92+
type: string
93+
description: Error message when request body parsing fails.
94+
status:
95+
type: integer
96+
description: HTTP status code for the error.
97+
example: 400
6998
WorkflowSaveError:
7099
content:
71100
application/json:
@@ -95,4 +124,53 @@ components:
95124
type: string
96125
example: Failed to retrieve template (12345) from global context.
97126
code:
98-
type: integer
127+
type: integer
128+
WorkflowStepsRetrieveError:
129+
content:
130+
application/json:
131+
type: object
132+
properties:
133+
message:
134+
type: string
135+
example: Failed to retrieve workflow step json.
136+
code:
137+
type: integer
138+
DeprovisioningError:
139+
type: object
140+
properties:
141+
error:
142+
type: string
143+
description: Describes the deprovisioning error and identifies resources that were not deprovisioned
144+
example: Failed to deprovision some resources [connector_id Lw7PX4wBfVtHp98y06wV].
145+
required:
146+
- error
147+
DeprovisioningForbiddenError:
148+
type: object
149+
properties:
150+
error:
151+
type: string
152+
description: Describes the resources that require the allow_delete parameter for deprovisioning
153+
example: These resources require the allow_delete parameter to deprovision [index_name my-index].
154+
required:
155+
- error
156+
RequestTimeoutError:
157+
type: object
158+
properties:
159+
error:
160+
type: string
161+
description: Error message when the request times out.
162+
status:
163+
type: integer
164+
description: HTTP status code for the error.
165+
example: 408
166+
BadRequestError:
167+
type: object
168+
properties:
169+
error:
170+
type: string
171+
description: Error message when the request body or parameters are invalid.
172+
example: Invalid request body or query parameters.
173+
status:
174+
type: integer
175+
description: HTTP status code for the error.
176+
example: 400

0 commit comments

Comments
 (0)