1{
2 "consumes": [
3 "application/json"
4 ],
5 "produces": [
6 "application/json"
7 ],
8 "schemes": [
9 "http"
10 ],
11 "swagger": "2.0",
12 "info": {
13 "description": "Documentation for the Interlock API",
14 "title": "Interlock",
15 "version": "1.0.0"
16 },
17 "host": "interlock.interlock.svc.cluster.local",
18 "basePath": "/",
19 "paths": {
20 "/v1/cluster": {
21 "get": {
22 "description": "Retrieve the current cluster state",
23 "tags": [
24 "cluster"
25 ],
26 "operationId": "GetClusterState",
27 "responses": {
28 "200": {
29 "$ref": "#/responses/ClusterStateResponse"
30 },
31 "404": {
32 "$ref": "#/responses/ErrorResponse"
33 },
34 "405": {
35 "$ref": "#/responses/ErrorResponse"
36 },
37 "500": {
38 "$ref": "#/responses/ErrorResponse"
39 }
40 }
41 },
42 "patch": {
43 "description": "Patch the cluster state",
44 "tags": [
45 "cluster"
46 ],
47 "operationId": "PatchClusterState",
48 "parameters": [
49 {
50 "x-go-name": "ClusterState",
51 "description": "The cluster state that the client wants to patch",
52 "name": "state",
53 "in": "body",
54 "schema": {
55 "$ref": "#/definitions/ClusterState"
56 }
57 }
58 ],
59 "responses": {
60 "202": {
61 "$ref": "#/responses/ClusterStateResponse"
62 },
63 "404": {
64 "$ref": "#/responses/ErrorResponse"
65 },
66 "405": {
67 "$ref": "#/responses/ErrorResponse"
68 },
69 "500": {
70 "$ref": "#/responses/ErrorResponse"
71 }
72 }
73 }
74 },
75 "/v1/host": {
76 "get": {
77 "description": "Retrieve the current host state",
78 "tags": [
79 "host"
80 ],
81 "operationId": "GetHostState",
82 "responses": {
83 "200": {
84 "$ref": "#/responses/HostStateResponse"
85 },
86 "404": {
87 "$ref": "#/responses/ErrorResponse"
88 },
89 "405": {
90 "$ref": "#/responses/ErrorResponse"
91 },
92 "500": {
93 "$ref": "#/responses/ErrorResponse"
94 }
95 }
96 },
97 "patch": {
98 "description": "Patch the host state",
99 "tags": [
100 "host"
101 ],
102 "operationId": "PatchHostState",
103 "parameters": [
104 {
105 "x-go-name": "State",
106 "description": "The host state that the client wants to patch",
107 "name": "state",
108 "in": "body",
109 "schema": {
110 "$ref": "#/definitions/HostState"
111 }
112 }
113 ],
114 "responses": {
115 "202": {
116 "$ref": "#/responses/HostStateResponse"
117 },
118 "404": {
119 "$ref": "#/responses/ErrorResponse"
120 },
121 "405": {
122 "$ref": "#/responses/ErrorResponse"
123 },
124 "500": {
125 "$ref": "#/responses/ErrorResponse"
126 }
127 }
128 }
129 },
130 "/v1/host/vnc": {
131 "put": {
132 "description": "Reset and replace the VNC state of the host node",
133 "tags": [
134 "host"
135 ],
136 "operationId": "VNCPut",
137 "parameters": [
138 {
139 "name": "Body",
140 "in": "body",
141 "schema": {
142 "$ref": "#/definitions/putVNCPayloads"
143 }
144 }
145 ],
146 "responses": {
147 "202": {
148 "$ref": "#/responses/HostStateResponse"
149 },
150 "400": {
151 "$ref": "#/responses/ErrorResponse"
152 },
153 "405": {
154 "$ref": "#/responses/ErrorResponse"
155 },
156 "500": {
157 "$ref": "#/responses/ErrorResponse"
158 }
159 }
160 },
161 "post": {
162 "description": "Update the VNC state of the host node",
163 "tags": [
164 "host"
165 ],
166 "operationId": "VNCPost",
167 "parameters": [
168 {
169 "name": "Body",
170 "in": "body",
171 "schema": {
172 "$ref": "#/definitions/postVNCPayload"
173 }
174 }
175 ],
176 "responses": {
177 "202": {
178 "$ref": "#/responses/HostStateResponse"
179 },
180 "400": {
181 "$ref": "#/responses/ErrorResponse"
182 },
183 "405": {
184 "$ref": "#/responses/ErrorResponse"
185 },
186 "500": {
187 "$ref": "#/responses/ErrorResponse"
188 }
189 }
190 }
191 },
192 "/v1/instances": {
193 "get": {
194 "description": "Retrieve the current instances state",
195 "tags": [
196 "instances"
197 ],
198 "operationId": "GetInstancesState",
199 "responses": {
200 "200": {
201 "$ref": "#/responses/InstancesStateResponse"
202 },
203 "404": {
204 "$ref": "#/responses/ErrorResponse"
205 },
206 "405": {
207 "$ref": "#/responses/ErrorResponse"
208 },
209 "500": {
210 "$ref": "#/responses/ErrorResponse"
211 }
212 }
213 }
214 },
215 "/v1/instances/{hostname}": {
216 "get": {
217 "description": "Retrieve the URL for the Interlock pod on the target host node",
218 "tags": [
219 "instances"
220 ],
221 "operationId": "GetInstanceState",
222 "parameters": [
223 {
224 "type": "string",
225 "x-go-name": "Hostname",
226 "description": "Hostname of the target interlock instance",
227 "name": "hostname",
228 "in": "path",
229 "required": true
230 }
231 ],
232 "responses": {
233 "200": {
234 "$ref": "#/responses/InstanceResponse"
235 },
236 "404": {
237 "$ref": "#/responses/ErrorResponse"
238 },
239 "405": {
240 "$ref": "#/responses/ErrorResponse"
241 },
242 "500": {
243 "$ref": "#/responses/ErrorResponse"
244 }
245 }
246 }
247 },
248 "/v1/subscribe": {
249 "get": {
250 "description": "Subscribe to topics to receive event driven updates about state changes",
251 "tags": [
252 "subscribe"
253 ],
254 "operationId": "SubscribeToTopics",
255 "parameters": [
256 {
257 "type": "array",
258 "items": {
259 "type": "string"
260 },
261 "example": [
262 "host"
263 ],
264 "x-go-name": "Topics",
265 "description": "The topics to subscribe to. Defaults to all",
266 "name": "topic",
267 "in": "query"
268 }
269 ],
270 "responses": {
271 "500": {
272 "$ref": "#/responses/ErrorResponse"
273 },
274 "default": {
275 "$ref": "#/responses/EventResponse"
276 }
277 }
278 }
279 }
280 },
281 "definitions": {
282 "ClusterState": {
283 "description": "State contains information about the D-SDS cluster",
284 "type": "object",
285 "properties": {
286 "name": {
287 "description": "Name of the cluster. This field is read only and will be kept up to date internally by Interlock",
288 "type": "string",
289 "x-go-name": "Name",
290 "readOnly": true,
291 "example": "store-123"
292 }
293 },
294 "x-go-name": "State",
295 "x-go-package": "edge-infra.dev/pkg/sds/interlock/topic/cluster"
296 },
297 "Error": {
298 "description": "Error represents an individual error returned by the API",
299 "type": "object",
300 "required": [
301 "detail"
302 ],
303 "properties": {
304 "detail": {
305 "description": "A description of the error",
306 "type": "string",
307 "x-go-name": "Detail",
308 "example": "X is a read-only field"
309 }
310 },
311 "x-go-package": "edge-infra.dev/pkg/sds/interlock/internal/errors"
312 },
313 "Errors": {
314 "description": "Errors returned on API failures",
315 "type": "object",
316 "properties": {
317 "errors": {
318 "type": "array",
319 "items": {
320 "$ref": "#/definitions/Error"
321 },
322 "x-go-name": "Errors"
323 }
324 },
325 "x-go-package": "edge-infra.dev/pkg/sds/interlock"
326 },
327 "Event": {
328 "description": "Event represents an update event to a topics state",
329 "type": "object",
330 "required": [
331 "topic",
332 "data"
333 ],
334 "properties": {
335 "data": {
336 "description": "The current state for the topic",
337 "x-go-name": "Data",
338 "example": "{\"hostname\": \"s2-worker-7\",\"network\": {\"lan-outage-detected\": true,\"lan-outage-mode\": true}}"
339 },
340 "topic": {
341 "description": "The topic that the update event was triggered for",
342 "type": "string",
343 "x-go-name": "Topic",
344 "example": "host"
345 }
346 },
347 "x-go-package": "edge-infra.dev/pkg/sds/interlock/websocket"
348 },
349 "HostState": {
350 "description": "State contains information about the local node",
351 "type": "object",
352 "properties": {
353 "hostname": {
354 "description": "Hostname of the host node. This field is read only and will be kept up to date internally by Interlock",
355 "type": "string",
356 "x-go-name": "Hostname",
357 "readOnly": true,
358 "example": "s1-master-1"
359 },
360 "network": {
361 "$ref": "#/definitions/Network"
362 },
363 "node-uid": {
364 "description": "UID of the host node. This field is read only and will be kept up to date internally by Interlock",
365 "type": "string",
366 "x-go-name": "NodeUID",
367 "readOnly": true,
368 "example": "abcdefgh-3aee-438b-a2a8-b4de3a8f470f"
369 },
370 "vnc": {
371 "$ref": "#/definitions/VNCStates"
372 }
373 },
374 "x-go-name": "State",
375 "x-go-package": "edge-infra.dev/pkg/sds/interlock/topic/host"
376 },
377 "Instance": {
378 "description": "Instance contains information for a specific Interlock pod",
379 "type": "object",
380 "properties": {
381 "url": {
382 "description": "URL of the Interlock pod",
383 "type": "string",
384 "x-go-name": "URL",
385 "readOnly": true,
386 "example": "http://1.2.3.4:80"
387 }
388 },
389 "x-go-package": "edge-infra.dev/pkg/sds/interlock/topic/instances"
390 },
391 "InstancesState": {
392 "description": "State contains information about the Interlock services running on the\ncluster",
393 "type": "object",
394 "properties": {
395 "instances": {
396 "description": "Information about the different Interlock pods running on the cluster.\nThis field is read only and will be kept up to date internally by\nInterlock",
397 "type": "object",
398 "additionalProperties": {
399 "$ref": "#/definitions/Instance"
400 },
401 "x-go-name": "Instances",
402 "readOnly": true,
403 "example": {
404 "node-name": {
405 "url": "http://1.2.3.4:80"
406 }
407 }
408 }
409 },
410 "x-go-name": "State",
411 "x-go-package": "edge-infra.dev/pkg/sds/interlock/topic/instances"
412 },
413 "Network": {
414 "description": "Network contains information about the network status of the local\nnode",
415 "type": "object",
416 "required": [
417 "lan-outage-detected",
418 "lan-outage-mode"
419 ],
420 "properties": {
421 "lan-outage-detected": {
422 "description": "Whether or not a current LAN outage has been detected",
423 "type": "boolean",
424 "x-go-name": "LANOutageDetected"
425 },
426 "lan-outage-mode": {
427 "description": "Whether or not the host node is currently in LAN outage mode",
428 "type": "boolean",
429 "x-go-name": "LANOutageMode"
430 }
431 },
432 "x-go-package": "edge-infra.dev/pkg/sds/interlock/topic/host"
433 },
434 "VNC": {
435 "description": "VNC represents a VNC state for a request",
436 "type": "object",
437 "properties": {
438 "connections": {
439 "description": "Connections is the number of active connections on the VNC request",
440 "type": "integer",
441 "format": "int64",
442 "x-go-name": "Connections"
443 },
444 "requestId": {
445 "description": "RequestID is the ID of the VNC request",
446 "type": "string",
447 "x-go-name": "RequestID"
448 },
449 "status": {
450 "description": "Status is the status of the VNC request\nREQUESTED Requested\nACCEPTED Accepted\nSUSPENDED Suspended\nREJECTED Rejected\nDROPPED Dropped\nCONNECTED Connected",
451 "type": "string",
452 "enum": [
453 "REQUESTED",
454 "ACCEPTED",
455 "SUSPENDED",
456 "REJECTED",
457 "DROPPED",
458 "CONNECTED"
459 ],
460 "x-go-enum-desc": "REQUESTED Requested\nACCEPTED Accepted\nSUSPENDED Suspended\nREJECTED Rejected\nDROPPED Dropped\nCONNECTED Connected",
461 "x-go-name": "Status"
462 },
463 "timestamp": {
464 "description": "TimeStamp is the time when the VNC state was last updated",
465 "type": "string",
466 "x-go-name": "TimeStamp"
467 }
468 },
469 "x-go-package": "edge-infra.dev/pkg/sds/interlock/topic/host"
470 },
471 "VNCStates": {
472 "description": "VNC states is a slice of VNC objects",
473 "type": "array",
474 "items": {
475 "$ref": "#/definitions/VNC"
476 },
477 "x-go-package": "edge-infra.dev/pkg/sds/interlock/topic/host"
478 },
479 "postVNCPayload": {
480 "type": "object",
481 "properties": {
482 "connections": {
483 "description": "Number of active connections on the VNC request. Only expected alongside a CONNECTED status.",
484 "type": "integer",
485 "format": "int64",
486 "x-go-name": "Connections",
487 "example": 2
488 },
489 "requestId": {
490 "description": "RequestID is the ID of the VNC request",
491 "type": "string",
492 "x-go-name": "RequestID",
493 "example": "11asd123a"
494 },
495 "status": {
496 "description": "VNC status of the node\nREQUESTED Requested\nACCEPTED Accepted\nSUSPENDED Suspended\nREJECTED Rejected\nDROPPED Dropped\nCONNECTED Connected",
497 "type": "string",
498 "enum": [
499 "REQUESTED",
500 "ACCEPTED",
501 "SUSPENDED",
502 "REJECTED",
503 "DROPPED",
504 "CONNECTED"
505 ],
506 "x-go-enum-desc": "REQUESTED Requested\nACCEPTED Accepted\nSUSPENDED Suspended\nREJECTED Rejected\nDROPPED Dropped\nCONNECTED Connected",
507 "x-go-name": "Status",
508 "example": "ACCEPTED"
509 },
510 "timestamp": {
511 "description": "Timestamp of VNC state",
512 "type": "string",
513 "format": "date-time",
514 "x-go-name": "TimeStamp",
515 "example": "\"2006-01-02T15:04:05Z07:00\""
516 }
517 },
518 "x-go-package": "edge-infra.dev/pkg/sds/interlock/topic/host"
519 },
520 "putVNCPayload": {
521 "type": "object",
522 "properties": {
523 "connections": {
524 "description": "Number of active connections on the VNC request. Only expected alongside a CONNECTED status.",
525 "type": "integer",
526 "format": "int64",
527 "x-go-name": "Connections",
528 "example": 2
529 },
530 "requestId": {
531 "description": "RequestID is the ID of the VNC request",
532 "type": "string",
533 "x-go-name": "RequestID",
534 "example": "11asd123a"
535 },
536 "status": {
537 "description": "VNC status of the node\nin: body\nREQUESTED Requested\nACCEPTED Accepted\nSUSPENDED Suspended\nREJECTED Rejected\nDROPPED Dropped\nCONNECTED Connected",
538 "type": "string",
539 "enum": [
540 "REQUESTED",
541 "ACCEPTED",
542 "SUSPENDED",
543 "REJECTED",
544 "CONNECTED"
545 ],
546 "x-go-enum-desc": "REQUESTED Requested\nACCEPTED Accepted\nSUSPENDED Suspended\nREJECTED Rejected\nDROPPED Dropped\nCONNECTED Connected",
547 "x-go-name": "Status",
548 "example": "ACCEPTED"
549 },
550 "timestamp": {
551 "description": "Timestamp of VNC state",
552 "type": "string",
553 "format": "date-time",
554 "x-go-name": "TimeStamp",
555 "example": "\"2006-01-02T15:04:05Z07:00\""
556 }
557 },
558 "x-go-package": "edge-infra.dev/pkg/sds/interlock/topic/host"
559 },
560 "putVNCPayloads": {
561 "type": "array",
562 "items": {
563 "$ref": "#/definitions/putVNCPayload"
564 },
565 "x-go-package": "edge-infra.dev/pkg/sds/interlock/topic/host"
566 }
567 },
568 "responses": {
569 "ClusterStateResponse": {
570 "description": "The request was successful",
571 "schema": {
572 "$ref": "#/definitions/ClusterState"
573 }
574 },
575 "ErrorResponse": {
576 "description": "The request has failed",
577 "schema": {
578 "$ref": "#/definitions/Errors"
579 }
580 },
581 "EventResponse": {
582 "description": "The request was successful",
583 "schema": {
584 "$ref": "#/definitions/Event"
585 }
586 },
587 "HostStateResponse": {
588 "description": "The request was successful",
589 "schema": {
590 "$ref": "#/definitions/HostState"
591 }
592 },
593 "InstanceResponse": {
594 "description": "The request was successful",
595 "schema": {
596 "$ref": "#/definitions/Instance"
597 }
598 },
599 "InstancesStateResponse": {
600 "description": "The request was successful",
601 "schema": {
602 "$ref": "#/definitions/InstancesState"
603 }
604 }
605 }
606}
View as plain text