Skip to content

Commit

Permalink
moved tasks to common schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderegg committed Aug 26, 2022
1 parent 087ca07 commit 8518652
Show file tree
Hide file tree
Showing 6 changed files with 238 additions and 29 deletions.
File renamed without changes.
63 changes: 63 additions & 0 deletions api/specs/storage/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ tags:
- name: location
- name: dataset
- name: file
- name: tasks
paths:
/:
get:
Expand Down Expand Up @@ -640,6 +641,68 @@ paths:
$ref: "#/components/schemas/FileMetaEnvelope"
default:
$ref: "#/components/responses/DefaultErrorResponse"

/tasks:
get:
operationId: list_tasks
tags:
- tasks
responses:
"200":
description: Returns the list of active tasks (running and/or done)
content:
application/json:
schema:
type: array
items:
$ref: "../common/schemas/task.yaml#/TaskEnveloped"
/tasks/{task_id}:
parameters:
- name: task_id
in: path
required: true
schema:
type: string
get:
operationId: get_task_status
tags:
- tasks
responses:
"200":
description: Returns the task status
content:
application/json:
schema:
$ref: "../common/schemas/task.yaml#/TaskStatusEnveloped"
default:
$ref: "#/components/responses/DefaultErrorResponse"
delete:
operationId: cancel_and_delete_task
description: Aborts and remove the task
tags:
- tasks
responses:
"204":
description: Task was successfully aborted
default:
$ref: "#/components/responses/DefaultErrorResponse"

/tasks/{task_id}/result:
parameters:
- name: task_id
in: path
required: true
schema:
type: string
get:
operationId: get_task_result
tags:
- tasks
responses:
"2XX":
description: Retrieve the task result and returns directly its HTTP code
default:
$ref: "#/components/responses/DefaultErrorResponse"
components:
schemas:
HealthCheckEnveloped:
Expand Down
2 changes: 1 addition & 1 deletion api/specs/webserver/openapi-projects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ paths:
content:
application/json:
schema:
$ref: "./components/schemas/task.yaml#/TaskEnveloped"
$ref: "../common/schemas/task.yaml#/TaskEnveloped"
links:
CreationStatus:
operationId: get_task_status
Expand Down
4 changes: 2 additions & 2 deletions api/specs/webserver/openapi-tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ paths:
schema:
type: array
items:
$ref: "./components/schemas/task.yaml#/TaskEnveloped"
$ref: "../common/schemas/task.yaml#/TaskEnveloped"

/tasks/{task_id}:
parameters:
Expand All @@ -31,7 +31,7 @@ paths:
content:
application/json:
schema:
$ref: "./components/schemas/task.yaml#/TaskStatusEnveloped"
$ref: "../common/schemas/task.yaml#/TaskStatusEnveloped"
default:
$ref: "#/components/responses/DefaultErrorResponse"
delete:
Expand Down
146 changes: 146 additions & 0 deletions services/storage/src/simcore_service_storage/api/v0/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,19 @@ servers:
enum:
- v0
default: v0
tags:
- name: maintenance
- name: location
- name: dataset
- name: file
- name: tasks
paths:
/:
get:
summary: Service health-check endpoint
description: Some general information on the API and state of the service behind
tags:
- maintenance
operationId: health_check
responses:
'200':
Expand All @@ -42,13 +50,17 @@ paths:
get:
summary: checks status of self and connected services
operationId: get_status
tags:
- maintenance
responses:
'200':
description: returns app status check
/locations:
get:
summary: Lists available storage locations
operationId: get_storage_locations
tags:
- location
parameters:
- name: user_id
in: query
Expand All @@ -68,6 +80,8 @@ paths:
post:
summary: Manually triggers the synchronisation of the file meta data table in the database
operationId: synchronise_meta_data_table
tags:
- location
parameters:
- name: location_id
in: path
Expand Down Expand Up @@ -99,6 +113,8 @@ paths:
get:
summary: Lists all dataset's metadata
operationId: get_datasets_metadata
tags:
- dataset
parameters:
- name: location_id
in: path
Expand All @@ -123,6 +139,8 @@ paths:
get:
summary: Lists all file's metadata
operationId: get_files_metadata
tags:
- file
parameters:
- name: location_id
in: path
Expand Down Expand Up @@ -152,6 +170,8 @@ paths:
get:
summary: Get dataset metadata
operationId: get_files_metadata_dataset
tags:
- dataset
parameters:
- name: location_id
in: path
Expand Down Expand Up @@ -181,6 +201,8 @@ paths:
get:
summary: Get file metadata
operationId: get_file_metadata
tags:
- file
parameters:
- name: file_id
in: path
Expand Down Expand Up @@ -210,6 +232,8 @@ paths:
get:
summary: Gets download link for file at location
operationId: download_file
tags:
- file
parameters:
- name: file_id
in: path
Expand Down Expand Up @@ -247,6 +271,8 @@ paths:
put:
summary: Returns upload object
operationId: upload_file
tags:
- file
parameters:
- name: file_id
in: path
Expand Down Expand Up @@ -307,6 +333,8 @@ paths:
delete:
summary: Deletes file
operationId: delete_file
tags:
- file
parameters:
- name: file_id
in: path
Expand All @@ -332,6 +360,8 @@ paths:
post:
summary: Asks the server to abort the upload and revert to the last valid version if any
operationId: abort_upload_file
tags:
- file
parameters:
- name: file_id
in: path
Expand All @@ -357,6 +387,8 @@ paths:
post:
summary: Asks the server to complete the upload
operationId: complete_upload_file
tags:
- file
parameters:
- name: file_id
in: path
Expand Down Expand Up @@ -415,6 +447,8 @@ paths:
post:
summary: Check for upload completion
operationId: is_completed_upload_file
tags:
- file
parameters:
- name: future_id
in: path
Expand Down Expand Up @@ -449,6 +483,8 @@ paths:
post:
summary: Returns the temporary access credentials for the user storage space
operationId: get_or_create_temporary_s3_access
tags:
- file
parameters:
- name: user_id
in: query
Expand All @@ -468,6 +504,8 @@ paths:
post:
summary: Returns metadata for all files matching a pattern
operationId: search_files_starting_with
tags:
- file
parameters:
- name: user_id
in: query
Expand All @@ -493,6 +531,8 @@ paths:
post:
summary: Deep copies of all data from source to destination project in s3
operationId: copy_folders_from_project
tags:
- file
parameters:
- name: user_id
in: query
Expand Down Expand Up @@ -527,6 +567,8 @@ paths:
delete:
summary: Deletes all objects within a node_id or within a project_id if node_id is omitted
operationId: delete_folders_of_project
tags:
- file
parameters:
- name: folder_id
in: path
Expand All @@ -550,6 +592,8 @@ paths:
post:
summary: Copy as soft link
operationId: copy_as_soft_link
tags:
- file
parameters:
- name: file_id
in: path
Expand Down Expand Up @@ -580,6 +624,108 @@ paths:
$ref: '#/components/schemas/FileMetaEnvelope'
default:
$ref: '#/components/responses/DefaultErrorResponse'
/tasks:
get:
operationId: list_tasks
tags:
- tasks
responses:
'200':
description: Returns the list of active tasks (running and/or done)
content:
application/json:
schema:
type: array
items:
type: object
required:
- data
properties:
data:
type: object
properties:
task_id:
type: string
status_href:
type: string
result_href:
type: string
required:
- task_id
- status_href
- result_href
error:
nullable: true
default: null
'/tasks/{task_id}':
parameters:
- name: task_id
in: path
required: true
schema:
type: string
get:
operationId: get_task_status
tags:
- tasks
responses:
'200':
description: Returns the task status
content:
application/json:
schema:
type: object
required:
- data
properties:
data:
type: object
required:
- task_progress
- done
- started
properties:
task_progress:
type: number
minimum: 0
maximum: 1
done:
type: boolean
started:
type: string
pattern: '\d{4}-(12|11|10|0?[1-9])-(31|30|[0-2]?\d)T(2[0-3]|1\d|0?[0-9])(:(\d|[0-5]\d)){2}(\.\d{3})?Z'
example: '2018-07-01T11:13:43Z'
error:
nullable: true
default: null
default:
$ref: '#/components/responses/DefaultErrorResponse'
delete:
operationId: cancel_and_delete_task
description: Aborts and remove the task
tags:
- tasks
responses:
'204':
description: Task was successfully aborted
default:
$ref: '#/components/responses/DefaultErrorResponse'
'/tasks/{task_id}/result':
parameters:
- name: task_id
in: path
required: true
schema:
type: string
get:
operationId: get_task_result
tags:
- tasks
responses:
2XX:
description: Retrieve the task result and returns directly its HTTP code
default:
$ref: '#/components/responses/DefaultErrorResponse'
components:
schemas:
HealthCheckEnveloped:
Expand Down
Loading

0 comments on commit 8518652

Please sign in to comment.