Skip to main content

Crate dvm_api

Crate dvm_api 

Source
Expand description

dvm.run’s REST API: what it takes and returns. dvm.run’s controller serves it, and the SDKs and its panel call it; the controller, the panel and the Rust SDK check a sandbox’s spec with the same code.

A type that holds an invariant (a checked spec, an image reference) keeps its fields private; a plain record of what the controller answers has them public.

Structs§

ApiError
What the controller answers instead, when it refuses a request: the body of every response that isn’t a success.
ApiKey
One of a user’s API keys, as they list them: never the key itself, of which the controller keeps only the SHA-256. A request that bears it (Authorization: Bearer <key>) acts as its user.
ByteChunk
Bytes as a program wrote them: base64 in JSON, since they needn’t be UTF-8.
Capacity
CPUs and memory: what a runner hands out, and what a run takes of it (SandboxSpec::footprint).
CliLogin
A login from a terminal, as its page shows it to the user who may approve it.
CollectCliLogin
What a terminal asks for its key with: POST /api/cli-logins/key.
CreatedApiKey
A key just made, and the key itself: shown this once.
EnvironmentVariable
An environment variable the program is given.
Execution
A sandbox’s execution, GET /api/executions/{id}: what it ran, one log from its start to its end, under its sandbox’s id. Its spec, its seed among it; its run, how and when it ended, and its log’s size; and its replays.
ImageReference
A Docker image reference, as docker run takes it: alpine, alpine:3.20, ghcr.io/owner/name:tag, name@sha256:<hex>.
InvalidImageReference
Why a text isn’t an image reference.
InvalidRunAction
An action the run’s state doesn’t allow.
Me
The user signed in: GET /api/me.
NewApiKey
A key to make: POST /api/keys.
NewCliLogin
A login to start from a terminal: POST /api/cli-logins, with no session or key.
OutputAfter
Output after the stdout cursor offset and optional stderr_offset.
Run
A sandbox’s run, of its spec, recorded; or a replay of its recording.
RunId
A run’s id, the controller’s.
RunOutput
What a run’s program has written so far, as bytes.
Sandbox
A sandbox: one run of its spec, recorded, started as it’s made, and the replays of its recording. Its id is its run’s.
SandboxAnswer
SandboxDraft
A sandbox’s spec as a person writes it, unchecked: what the panel’s form holds, and what the controller takes to create a sandbox. Each field but the image may be left out, for dvm run’s defaults.
SandboxExited
SandboxId
A sandbox’s id: its run’s, as its runner and its output know it.
SandboxInput
Appends bytes to POST /api/sandboxes/{id}/input.
SandboxInputState
The input accepted into the runner connection, which may still be in flight.
SandboxRead
SandboxRequest
SandboxRun
SandboxSpec
What a sandbox runs, checked: each value is one dvm run may be given as it is. Only a SandboxDraft that passes becomes one, deserialized too.
SandboxStarted
SandboxStdin
SandboxWrite
SandboxesPage
A page of the sandboxes a user sees, GET /api/sandboxes?before=: the newest before the sandbox before, if given, newest first.
SpecError
Why a draft isn’t a spec: the first field that’s wrong, and how.
StartedCliLogin
A login started: the panel’s page that approves it, the code that page shows, and the token the terminal collects its key with, which only the terminal holds.
Timestamp
A point in time: milliseconds since the Unix epoch, UTC.
UserLimits
What a user who isn’t an admin may use.

Enums§

OutputStream
One of a program’s output streams.
ReplayVerdict
Whether a replay was the run it replayed, as far as can be seen from outside: its exit code, and its output, byte for byte.
RunAction
What an owner may do to a sandbox’s run, besides starting it, as it’s made: the last segment of its path, POST /api/sandboxes/{id}/{action}; a replay may be stopped, POST /api/replays/{id}/stop.
RunState
Where a run is:
SandboxAnswerKind
SandboxProgram
SandboxRequestAction
SpecField
A field of a SandboxDraft.