List Commands
List the UUIDs of all commands, in the order they were started.
This operation is also the plugin's readiness probe: it takes no
parameters, changes nothing, and answers on an empty sandbox, so a client
can call it to establish that the plugin is serving before it sends any
real work. Hence x-unikraft-plugin-readiness, which the SDK generators
read to render their readiness helpers against this operation.
List Commands › Responses
The UUIDs of all known commands.
statusThe status of the response.
The response data for this request.
op_time_usThe operation time in microseconds.
messageAn optional message providing additional information about the status.
A list of errors which may have occurred during the request.
Start Command
Start a command in the sandbox, and with req_timeout_s wait for it, so
that starting, waiting, inspecting and fetching the output take one
request. 500 is returned when the command could not be spawned, and
400 when cols or rows are given without pty or are zero, when
req_timeout_s is not between 0 (exclusive) and 55 seconds, or when
logs_limit or forget are given without req_timeout_s.
Start Command › Request Body
The command to run: a command line interpreted by the shell, or an argument
vector executed directly. A bare program name in a vector is looked up in
the PATH of env, falling back to the sandbox's own PATH. 400 is
returned if the vector is empty, the program cannot be resolved or run,
cwd is not a directory, an environment variable name is empty or has a
= in it, or the request holds what exec will not take (NUL bytes, an
argument list past the kernel's limit).
cwd(OPTIONAL) Current working directory
(OPTIONAL) Environment variables: the command's whole environment,
unless the sandbox is configured with inherit_env, when they are laid
over the environment the sandbox itself was started with.
pty(OPTIONAL) Run the command on a pseudo-terminal instead of pipes. Its
output, stdout and stderr merged as a terminal shows them, is served as
stdout; input fed to it is echoed by the terminal; an eof on stdin
types the terminal's end-of-input character rather than closing anything;
and deleting the logs hangs the terminal up, which ends most commands.
TERM is set to xterm-256color unless env provides one.
cols(OPTIONAL) The terminal's width in columns. Needs pty; 80 by default.
rows(OPTIONAL) The terminal's height in rows. Needs pty; 24 by default.
stdin(OPTIONAL) Bytes to feed into standard input before anything else,
base64-encoded, exactly as a POST .../stdin right after the start would.
stdin_eof(OPTIONAL) Whether to close standard input after stdin (at once when
there is none). Defaults to true when req_timeout_s is given, since
nothing can be fed until the request answers, and to false otherwise.
req_timeout_s(OPTIONAL) Block until the command exits or this many seconds have
passed, then answer with the command's state and output (logs). More
than 0 and at most 55: a proxy in front cuts a silent request at about a
minute. A timeout is not an error: the answer has exitcode: null, the
output so far, and the command keeps running, addressable by UUID as any
other. Absent: answer as soon as the command has started.
logs_limit(OPTIONAL) With req_timeout_s: at most this many bytes of each stream in
the answer, the rest staying at GET .../logs. Whole streams by default.
forget(OPTIONAL) With req_timeout_s: forget the command once it has finished,
as DELETE .../{uuid} would, so that one request is the whole exchange.
Does nothing on a timeout, when the UUID is still needed, nor when the
answer had to leave output behind short of what was asked (no
logs_limit, or one past the bound): a persisted log that spilled past
the ceiling is answered up to what memory could have held (a little
over 18 MiB), and the command then stays for GET .../logs,
stdout_available/stderr_available past what the answer carries
showing it.
Start Command › Responses
The command that was started, as GET .../{uuid} describes it, plus its output (logs) when req_timeout_s was given.
statusThe status of the response.
The response data for this request.
op_time_usThe operation time in microseconds.
messageAn optional message providing additional information about the status.
A list of errors which may have occurred during the request.
Get Command by UUID
Inspect a command by UUID. 404 is returned, with an empty body, when no
such command exists.
path Parameters
uuidGet Command by UUID › Responses
The command line and exit status of the command.
statusThe status of the response.
The response data for this request.
op_time_usThe operation time in microseconds.
messageAn optional message providing additional information about the status.
A list of errors which may have occurred during the request.
Delete Command by UUID
Forget a command by UUID. 404 is returned, with an empty body, when no
such command exists, and 409 when the command has not finished
executing: commands which are still running cannot be forgotten.
path Parameters
uuidDelete Command by UUID › Responses
The outcome of forgetting the command.
statusThe status of the response.
dataThe response data for this request.
op_time_usThe operation time in microseconds.
messageAn optional message providing additional information about the status.
A list of errors which may have occurred during the request.
Get Command Logs
Fetch the collected output of a command; this changes nothing, releasing
is POST .../logs/release. Both streams are base64-encoded; use the raw
log endpoint for binary output. 404 is returned, with an empty body,
when no such command exists. 410 is returned, with an empty body, if the
command's logs have been deleted. 416 is returned, with a message naming
the first byte still available, when an offset is below what was
released. With persistence, output past the ceiling is in the log file
while the command runs, read as one stream with memory; unread output
there is bounded (a quarter of the volume, 4 GiB at most, never into its
last quarter), past which the command is held as without a volume.
path Parameters
uuidGet Command Logs › Request Body optional
The part of the standard output stream to return.
The part of the standard error stream to return.
Get Command Logs › Responses
The requested parts of the two output streams.
statusThe status of the response.
The response data for this request.
op_time_usThe operation time in microseconds.
messageAn optional message providing additional information about the status.
A list of errors which may have occurred during the request.
Delete Command Logs
Forget the output logs of an existing command, freeing up memory.
The stdin/out/err pipes of running commands will be closed. Idempotent.
404 is returned, with an empty body, when no such command exists.
With persistence, the log files go first; should neither go (500),
nothing is deleted and the logs stay.
path Parameters
uuidDelete Command Logs › Responses
The outcome of forgetting command logs.
statusThe status of the response.
dataThe response data for this request.
op_time_usThe operation time in microseconds.
messageAn optional message providing additional information about the status.
A list of errors which may have occurred during the request.
Get Raw Command Log
Fetch an output stream of a command as raw bytes. A single contiguous
Range header is honoured, as described in RFC 9110. Once part of the
stream was released (see POST .../logs/release), a request without a Range is
answered with 206 and what is still available, or 416 once all of it
was released, and a Range into the released part with 416. A stream
longer than what memory can hold, on a volume while the command runs, is
answered a page of that size at a time, 206 with a Content-Range.
path Parameters
uuidstreamThe output stream to read raw bytes from.
Headers
RangeA single contiguous byte range, e.g. bytes=0-1023.
Get Raw Command Log › Responses
An output stream of a command, returned verbatim and unenveloped. A request
carrying no Range header is answered with 200 and the whole stream (or,
once part of it was released, with 206 and what is still available, and
with 416 once all of it was); a
satisfiable Range is answered with 206, the requested bytes and a
Content-Range header. 404 is returned when the command or the stream does
not exist, 410 is returned, with an empty body, if the command's logs have been
deleted, and 416 — with a Content-Range header reporting the total length —
when the range cannot be satisfied.
Release Command Logs
Release what the client has of a command's output; a read never does.
404 is returned, with an empty body, when no such command exists, 410
if the command's logs have been deleted, and 400 when the body is not
offsets. With persistence, output past the ceiling is in the log file
while the command runs, and a release frees it there too.
path Parameters
uuidRelease Command Logs › Request Body
stdoutFree the standard output stream below this byte: the client has it and
will not ask for it again. A command held at its output ceiling
(capped) carries on once there is room. More than there is frees what
there is; no more than was released already does nothing, so a retry is
harmless. Released bytes are gone, from memory and from the log file
where some had spilled to it: a read's stdout_first says where what is
left starts, and an offset below it is a 416. Once the command has
exited and its log is a file, a release does nothing: the file is the
archive, and stdout_first stays where releases left it while it ran.
stderrThe same for the standard error stream.
Release Command Logs › Responses
The outcome of releasing the output.
statusThe status of the response.
dataThe response data for this request.
op_time_usThe operation time in microseconds.
messageAn optional message providing additional information about the status.
A list of errors which may have occurred during the request.
Resize Command Terminal
Resize a command's terminal; the foreground job is told with SIGWINCH.
404 is returned, with an empty body, when no such command exists, 400
when the command has no terminal or the size is zero, and 409 once the
command has finished.
path Parameters
uuidResize Command Terminal › Request Body
colsThe new width, in columns.
rowsThe new height, in rows.
Resize Command Terminal › Responses
The outcome of resizing the terminal.
statusThe status of the response.
dataThe response data for this request.
op_time_usThe operation time in microseconds.
messageAn optional message providing additional information about the status.
A list of errors which may have occurred during the request.
Signal Command
Send a signal to a command. 404 is returned, with an empty body, when no
such command exists, and 400 when the signal is not one: a number the
kernel does not have, or a name that is not a signal's.
path Parameters
uuidSignal Command › Request Body
The signal to send, either as a number or as a name, with or without the
SIG prefix, e.g. 15, TERM or SIGTERM. 0 sends nothing and only
checks that the command can be signalled. Real-time signals go by number:
where SIGRTMIN sits is up to the program's libc (34 on glibc, 35 on
musl), so they have no names here.
Signal Command › Responses
The outcome of sending the signal.
statusThe status of the response.
dataThe response data for this request.
op_time_usThe operation time in microseconds.
messageAn optional message providing additional information about the status.
A list of errors which may have occurred during the request.
Write Command Stdin
Feed data into the standard input of a command. 404 is returned, with an
empty body, when no such command exists, 410 if the command's logs have been
deleted, 400 when data is not valid base64, 409 when the command has
finished or its standard input is closed (an eof alone is still fine),
and 429 when the command has not yet read what it was already given
(its stdin queue holds 8 MiB; on a terminal an eof counts as the byte
it types).
path Parameters
uuidWrite Command Stdin › Request Body
dataThe bytes to feed into standard input, base64-encoded.
eofWhether to close standard input after injecting data.
Write Command Stdin › Responses
The outcome of feeding the data into standard input.
statusThe status of the response.
dataThe response data for this request.
op_time_usThe operation time in microseconds.
messageAn optional message providing additional information about the status.
A list of errors which may have occurred during the request.
Wait for Command
Wait for a command to finish, for up to timeout_s seconds, 55 when
absent, which is the most there is. 408 is returned when the time is up
with the command still running, 404, with an empty body, when no such
command exists, and 400 when timeout_s is not between 0 and 55 or the
body does not parse.
path Parameters
uuidWait for Command › Request Body optional
timeout_sThe longest to wait, in seconds; decimals are accepted, 0 only asks.
At most 55, and 55 when absent: a proxy in front cuts a silent request
at about a minute, so a longer wait is a loop on 408.
Wait for Command › Responses
Returned once the command has finished, within the timeout.
statusThe status of the response.
dataThe response data for this request.
op_time_usThe operation time in microseconds.
messageAn optional message providing additional information about the status.
A list of errors which may have occurred during the request.
Wait for Command with Timeout
The old name for POST .../wait with a body: the same wait, 408 when
the time is up with the command still running, 404, with an empty body,
when no such command exists, and 400 when timeout_s is not between 0
and 55.
path Parameters
uuidWait for Command with Timeout › Request Body
timeout_sThe maximum time to wait, in seconds, at most 55. Decimals are accepted.
Wait for Command with Timeout › Responses
Returned once the command has finished, within the timeout.
statusThe status of the response.
dataThe response data for this request.
op_time_usThe operation time in microseconds.
messageAn optional message providing additional information about the status.
A list of errors which may have occurred during the request.