Files
lincodex/api/labd/routes/lab_console_tokens.yml

47 lines
1.7 KiB
YAML

parameters:
- $ref: ../components/parameters.yml#/LabId
post:
operationId: CreateLabConsoleToken
summary: Issue a short-lived console token for one node of a ready lab.
description: |-
The token lets the console gateway of the backend attach to the serial
console of one node. It is random, single-use, bound to the lab and the
node, and valid for at most 120 seconds; `labd` keeps only its SHA-256
digest in memory, so a restart invalidates every unused token. The token
is never a node password or an SSH key, and the response carries no node
address.
Attaching: the gateway opens a WebSocket to `attach_path` on the same
`labd` origin with the service bearer token and sends the console token
in the `X-Lab-Console-Token` header. The WebSocket attach is described
here as the planned interface; until it is implemented, `labd` answers
the attach path with 501 and issuing a token changes nothing else.
A lab that is not `ready` answers 409 `state_conflict`; an unknown node
answers 400 `validation_failed` with the pointer `/node`.
tags:
- consoles
requestBody:
required: true
content:
application/json:
schema:
$ref: ../components/schemas.yml#/ConsoleTokenRequest
responses:
"201":
description: The token was issued.
headers:
Cache-Control:
description: The token must not be stored by any cache.
required: true
schema:
type: string
enum:
- no-store
content:
application/json:
schema:
$ref: ../components/schemas.yml#/ConsoleToken
default:
$ref: ../components/responses.yml#/Problem