-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhttp_spec.yaml
151 lines (151 loc) · 4.18 KB
/
http_spec.yaml
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
# OpenAPI specification of the HTTP interface to stored.
openapi: "3.0.0"
info:
title: Stored
version: 0.1.0
description: Stored (pronounced store-daemon, or just stored) is a distributed
immutable value store. Stored is not a key-value store, as the key isn't the
decided by the user but by the checksum of the stored value.
paths:
/blob:
post:
summary: Store a blob.
requestBody:
description: Blob to store.
required: true
content:
'*/*':
schema:
$ref: '#/components/schemas/Blob'
parameters:
- in: header
name: Content-Length
schema:
type: integer
required: true
responses:
'201':
description: Blob was stored.
headers:
Location:
description: Location at which the blob can be retrieved.
schema:
type: string
format: uri
'400':
$ref: '#/components/responses/BadRequest'
'411':
description: '"Content-Length" header is missing.'
content:
text/plain:
schema:
type: string
'413':
description: Body too large.
content:
text/plain:
schema:
type: string
'500':
$ref: '#/components/responses/ServerError'
/blob/{key}:
get:
summary: Retrieves a blob.
description: 'Note that "HEAD" requests are also supported.'
parameters:
- name: key
in: path
description: Key of the blob to retrieve.
required: true
schema:
$ref: '#/components/schemas/Key'
responses:
'200':
description: Returns the blob.
headers:
'Last-Modified':
description: 'Time at which the blob was stored. Format is the same as the "Date" header.'
schema:
type: string
format: date-time
content:
'*/*':
schema:
$ref: '#/components/schemas/Blob'
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
'410':
$ref: '#/components/responses/Removed'
'500':
$ref: '#/components/responses/ServerError'
delete:
summary: Removes a blob.
parameters:
- name: key
in: path
description: Key of the blob to remove.
required: true
schema:
$ref: '#/components/schemas/Key'
responses:
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
'410':
$ref: '#/components/responses/Removed'
'500':
$ref: '#/components/responses/ServerError'
/health:
get:
summary: Runs a health check.
responses:
'200':
description: 'The string "OK".'
content:
text/plain:
schema:
type: string
'500':
$ref: '#/components/responses/ServerError'
components:
schemas:
Key:
description: SHA-512 hash of the stored blob used as key.
type: string
format: SHA-512 hash
minLength: 128
maxLength: 128
Blob:
description: Binary Large OBject (BLOB) stored by the client.
type: string
format: binary
responses:
BadRequest:
description: Bad request, see error message in the body for details.
content:
text/plain:
schema:
type: string
NotFound:
description: Blob not found.
content:
text/plain:
schema:
type: string
ServerError:
description: Internal server error.
content:
text/plain:
schema:
type: string
Removed:
description: Blob was removed (but previously stored).
headers:
'Last-Modified':
description: 'Time at which the blob was removed. Format is the same as the "Date" header.'
schema:
type: string
format: date-time