Skip to content

Commit 3f88ad3

Browse files
authored
✨ Storage: allow creation of multipart presigned upload links (ITISFoundation#3021)
1 parent aed99b7 commit 3f88ad3

File tree

92 files changed

+4184
-1291
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+4184
-1291
lines changed

.env-devel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ SMTP_PORT=25
7070

7171
SIMCORE_SERVICES_NETWORK_NAME=interactive_services_subnet
7272

73+
# NOTE: STORAGE_ENDPOINT is needed by director-v0
7374
STORAGE_ENDPOINT=storage:8080
75+
STORAGE_HOST=storage
76+
STORAGE_PORT=8080
7477

7578
SWARM_STACK_NAME=master-simcore
7679

api/specs/storage/openapi.yaml

Lines changed: 229 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -47,36 +47,6 @@ paths:
4747
"200":
4848
description: returns app status check
4949

50-
/check/{action}:
51-
post:
52-
summary: Test checkpoint to ask server to fail or echo back the transmitted data
53-
parameters:
54-
- in: path
55-
required: true
56-
name: action
57-
schema:
58-
type: string
59-
default: "echo"
60-
enum: ["fail", "echo"]
61-
- in: query
62-
name: data
63-
schema:
64-
type: string
65-
requestBody:
66-
content:
67-
application/json:
68-
schema:
69-
$ref: "#/components/schemas/Fake"
70-
responses:
71-
"200":
72-
description: Echoes response based on action
73-
content:
74-
application/json:
75-
schema:
76-
$ref: "#/components/schemas/FakeEnveloped"
77-
default:
78-
$ref: "#/components/responses/DefaultErrorResponse"
79-
8050
/locations:
8151
get:
8252
summary: Lists available storage locations
@@ -244,32 +214,6 @@ paths:
244214
default:
245215
$ref: "#/components/responses/DefaultErrorResponse"
246216

247-
/locations/{location_id}/files/{file_id}:abort:
248-
post:
249-
summary: Asks the server to abort the upload and revert to the last valid version if any
250-
operationId: abort_upload_file
251-
parameters:
252-
- name: file_id
253-
in: path
254-
required: true
255-
schema:
256-
type: string
257-
- name: location_id
258-
in: path
259-
required: true
260-
schema:
261-
type: string
262-
- name: user_id
263-
in: query
264-
required: true
265-
schema:
266-
type: string
267-
responses:
268-
"204":
269-
description: Abort OK
270-
default:
271-
$ref: "#/components/responses/DefaultErrorResponse"
272-
273217
/locations/{location_id}/files/{file_id}:
274218
get:
275219
summary: Gets download link for file at location
@@ -337,19 +281,36 @@ paths:
337281
enum:
338282
- presigned
339283
- s3
284+
- name: file_size
285+
in: query
286+
required: false
287+
description: will be required once all legacy services are gone or updated. if null returns the PresignedLinkEnveloped, else returns FileUploadEnveloped
288+
schema:
289+
type: integer
290+
format: int64
291+
minimum: 0
340292
responses:
341293
"200":
342-
description: "Returns presigned link"
294+
description: "Creates and returns file upload object"
343295
content:
344296
application/json:
345297
schema:
346-
$ref: "#/components/schemas/PresignedLinkEnveloped"
298+
oneOf:
299+
- $ref: "#/components/schemas/PresignedLinkEnveloped"
300+
- $ref: "#/components/schemas/FileUploadEnveloped"
347301
links:
302+
CompleteUpload:
303+
operationId: complete_upload_file
304+
parameters:
305+
path.location_id: "$request.path.location_id"
306+
path.file_id: "$request.path.file_id"
307+
query.user_id: "$request.query.user_id"
348308
AbortUpload:
349309
operationId: abort_upload_file
350310
parameters:
351311
path.location_id: "$request.path.location_id"
352312
path.file_id: "$request.path.file_id"
313+
query.user_id: "$request.query.user_id"
353314
default:
354315
$ref: "#/components/responses/DefaultErrorResponse"
355316
delete:
@@ -377,6 +338,126 @@ paths:
377338
default:
378339
$ref: "#/components/responses/DefaultErrorResponse"
379340

341+
/locations/{location_id}/files/{file_id}:abort:
342+
post:
343+
summary: Asks the server to abort the upload and revert to the last valid version if any
344+
operationId: abort_upload_file
345+
parameters:
346+
- name: file_id
347+
in: path
348+
required: true
349+
schema:
350+
type: string
351+
- name: location_id
352+
in: path
353+
required: true
354+
schema:
355+
type: string
356+
- name: user_id
357+
in: query
358+
required: true
359+
schema:
360+
type: string
361+
responses:
362+
"204":
363+
description: Abort OK
364+
default:
365+
$ref: "#/components/responses/DefaultErrorResponse"
366+
367+
/locations/{location_id}/files/{file_id}:complete:
368+
post:
369+
summary: Asks the server to complete the upload
370+
operationId: complete_upload_file
371+
parameters:
372+
- name: file_id
373+
in: path
374+
required: true
375+
schema:
376+
type: string
377+
- name: location_id
378+
in: path
379+
required: true
380+
schema:
381+
type: string
382+
- name: user_id
383+
in: query
384+
required: true
385+
schema:
386+
type: string
387+
requestBody:
388+
content:
389+
application/json:
390+
schema:
391+
type: object
392+
required:
393+
- parts
394+
properties:
395+
parts:
396+
type: array
397+
items:
398+
type: object
399+
required:
400+
- number
401+
- e_tag
402+
properties:
403+
number:
404+
type: integer
405+
minimum: 1
406+
e_tag:
407+
type: string
408+
responses:
409+
"202":
410+
description: Completion of upload is accepted
411+
content:
412+
application/json:
413+
schema:
414+
$ref: "#/components/schemas/FileUploadCompleteEnveloped"
415+
links:
416+
CompleteUploadStatus:
417+
operationId: is_completed_upload_file
418+
parameters:
419+
path.location_id: "$request.path.location_id"
420+
path.file_id: "$request.path.file_id"
421+
path.future_id: "$response.body.data.links.state"
422+
query.user_id: "$request.query.user_id"
423+
default:
424+
$ref: "#/components/responses/DefaultErrorResponse"
425+
426+
/locations/{location_id}/files/{file_id}:complete/futures/{future_id}:
427+
post:
428+
summary: Check for upload completion
429+
operationId: is_completed_upload_file
430+
parameters:
431+
- name: future_id
432+
in: path
433+
required: true
434+
schema:
435+
type: string
436+
- name: file_id
437+
in: path
438+
required: true
439+
schema:
440+
type: string
441+
- name: location_id
442+
in: path
443+
required: true
444+
schema:
445+
type: string
446+
- name: user_id
447+
in: query
448+
required: true
449+
schema:
450+
type: string
451+
responses:
452+
"200":
453+
description: returns state of upload completion
454+
content:
455+
application/json:
456+
schema:
457+
$ref: "#/components/schemas/FileUploadCompleteFutureEnveloped"
458+
default:
459+
$ref: "#/components/responses/DefaultErrorResponse"
460+
380461
/simcore-s3:access:
381462
post:
382463
summary: Returns the temporary access credentials for the user storage space
@@ -408,7 +489,7 @@ paths:
408489
schema:
409490
type: integer
410491
- name: startswith
411-
description: matches starting string of the file_uuid
492+
description: matches starting string of the file_id
412493
in: query
413494
schema:
414495
type: string
@@ -874,6 +955,95 @@ components:
874955
example:
875956
link: "example_link"
876957

958+
FileUploadEnveloped:
959+
type: object
960+
required:
961+
- data
962+
- error
963+
properties:
964+
data:
965+
$ref: "#/components/schemas/FileUploadSchema"
966+
error:
967+
nullable: true
968+
default: null
969+
970+
FileUploadSchema:
971+
type: object
972+
required:
973+
- chunk_size
974+
- urls
975+
- links
976+
properties:
977+
chunk_size:
978+
type: integer
979+
format: int64
980+
minimum: 0
981+
urls:
982+
type: array
983+
items:
984+
type: string
985+
links:
986+
type: object
987+
required:
988+
- abort_upload
989+
- complete_upload
990+
properties:
991+
abort_upload:
992+
type: string
993+
complete_upload:
994+
type: string
995+
996+
FileUploadCompleteEnveloped:
997+
type: object
998+
required:
999+
- data
1000+
- error
1001+
properties:
1002+
data:
1003+
$ref: "#/components/schemas/FileUploadComplete"
1004+
error:
1005+
nullable: true
1006+
default: null
1007+
1008+
FileUploadComplete:
1009+
type: object
1010+
required:
1011+
- links
1012+
properties:
1013+
links:
1014+
type: object
1015+
required:
1016+
- state
1017+
properties:
1018+
state:
1019+
type: string
1020+
1021+
FileUploadCompleteFutureEnveloped:
1022+
type: object
1023+
required:
1024+
- data
1025+
- error
1026+
properties:
1027+
data:
1028+
$ref: "#/components/schemas/FileUploadCompleteFuture"
1029+
error:
1030+
nullable: true
1031+
default: null
1032+
1033+
FileUploadCompleteFuture:
1034+
type: object
1035+
required:
1036+
- state
1037+
properties:
1038+
state:
1039+
type: string
1040+
enum:
1041+
- ok
1042+
- nok
1043+
e_tag:
1044+
type: string
1045+
nullable: true
1046+
8771047
S3AccessCredentialsEnveloped:
8781048
type: object
8791049
required:

0 commit comments

Comments
 (0)