-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrest.yaml
More file actions
216 lines (214 loc) · 6.35 KB
/
Copy pathrest.yaml
File metadata and controls
216 lines (214 loc) · 6.35 KB
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
openapi: 3.0.3
info:
title: Edge Toolkit REST API
description: |-
ws-server HTTP surface: health probe, module discovery, module assets, and per-agent storage.
The storage routes are an anonymous S3-compatible interface, addressed path-style as
/storage/{agent_id}/{filename} (bucket = agent_id, key = filename), they answer PUT/GET/HEAD with an ETag, so a
standard S3 client can read and write objects without credentials.
version: 0.1.0
servers:
- url: http://localhost:8080
description: Default ws-server bind address
paths:
/health:
get:
tags:
- health
summary: Liveness probe.
description: |-
Returns a small JSON document identifying the service so external
monitors can confirm the server is reachable and serving requests.
operationId: health
responses:
"200":
description: Server is up
content:
application/json:
schema:
$ref: "#/components/schemas/HealthResponse"
/modules/:
get:
tags:
- modules
summary: List the names of every module the server is currently serving.
operationId: list_modules_handler
responses:
"200":
description: Names of available modules
content:
application/json:
schema:
type: array
items:
type: string
/modules/{name}/{path}:
get:
tags:
- modules
summary: Fetch a file from a module's bundled static assets.
description: |-
`path` is resolved relative to the module's bundle root; an unknown
module or missing file returns 404.
operationId: get_module_file
parameters:
- in: path
name: name
description: Module name
required: true
schema:
type: string
style: simple
- in: path
name: path
description: Path of the file within the module bundle
required: true
schema:
type: string
style: simple
responses:
"200":
description: Static module asset
content:
application/octet-stream: {}
"404":
description: No such module or file
/storage/{agent_id}/{filename}:
get:
tags:
- storage
summary: Download a file previously written to the named agent's storage bucket.
operationId: get_file
parameters:
- in: path
name: agent_id
description: Agent identifier
required: true
schema:
type: string
style: simple
- in: path
name: filename
description: Stored filename
required: true
schema:
type: string
style: simple
responses:
"200":
description: Stored file contents
headers:
ETag:
description: Entity tag of the stored object
style: simple
schema:
type: string
content:
application/octet-stream: {}
"404":
description: No such file
put:
tags:
- storage
summary: Upload a file to an agent's storage bucket.
description: |-
Only the agent that owns the bucket may write to it (the agent must
currently be connected); the path component must be a single
filename, not a nested path.
operationId: put_file
parameters:
- in: path
name: agent_id
description: Agent identifier (must be a connected agent)
required: true
schema:
type: string
style: simple
- in: path
name: filename
description: Single-segment filename to write
required: true
schema:
type: string
style: simple
requestBody:
description: Raw file bytes
content:
application/octet-stream:
schema:
description: |-
Phantom type used to label binary request/response bodies as `string`/`binary`.
Never constructed at runtime; only exists under the `openapi-spec` feature
so the `utoipa::ToSchema` derive has something to attach to.
type: string
format: binary
required: true
responses:
"200":
description: File stored
headers:
ETag:
description: Entity tag of the stored object
style: simple
schema:
type: string
"400":
description: Invalid filename
"404":
description: Agent not found
head:
tags:
- storage
summary: Return a stored object's metadata without its body (S3 `HeadObject`).
description: |-
Same addressing and 404 handling as [`get_file`], but the response carries headers only: the object's `ETag`
and its size as `Content-Length`. S3 clients issue `HEAD` to stat an object (existence, size, entity tag)
before downloading, so it reports the same `ETag` a `GET` would.
operationId: head_file
parameters:
- in: path
name: agent_id
description: Agent identifier
required: true
schema:
type: string
style: simple
- in: path
name: filename
description: Stored filename
required: true
schema:
type: string
style: simple
responses:
"200":
description: Object metadata (no body)
headers:
Content-Length:
description: Size of the stored object in bytes
style: simple
schema:
type: integer
format: int64
ETag:
description: Entity tag of the stored object
style: simple
schema:
type: string
"404":
description: No such file
components:
schemas:
HealthResponse:
description: |-
Server liveness probe response.
Returned by `GET /health`.
type: object
properties:
service:
type: string
status:
type: string
required:
- status
- service