Pure functions turning a parsed CLI JSON row (a Clojure map with string
keys, as clojure.data.json/read-str produces without :key-fn keyword —
the CLI's JSON is already snake_case) into a kebab-case-keyword map. One
function per row shape, mirroring sdk/ruby/lib/bsdkrun/types.rb.
Also provides the Result-map helpers: since a bsdkrun.sandbox exec/agent
result here is a plain map ({:stdout ... :stderr ... :exit-code ... :command ...}), not an object with methods, ok?, text, json,
lines and throw-if-failed! are given as functions operating on that
map instead.
Pure functions turning a parsed CLI JSON row (a Clojure map with *string*
keys, as `clojure.data.json/read-str` produces without `:key-fn keyword` —
the CLI's JSON is already snake_case) into a kebab-case-keyword map. One
function per row shape, mirroring `sdk/ruby/lib/bsdkrun/types.rb`.
Also provides the `Result`-map helpers: since a bsdkrun.sandbox exec/agent
result here is a plain map (`{:stdout ... :stderr ... :exit-code ...
:command ...}`), not an object with methods, [[ok?]], [[text]], [[json]],
[[lines]] and [[throw-if-failed!]] are given as functions operating on that
map instead.(command-result-from-graphql r)The outcome of a bsdkrun.client lifecycle mutation (stopMachine,
startMachine, removeMachines, updateMachine, commitMachine, ...). A
non-zero :exit-code is a value to inspect, not necessarily a failure —
mirrors daemon/src/graphql.rs's CommandResult.
The outcome of a `bsdkrun.client` lifecycle mutation (`stopMachine`, `startMachine`, `removeMachines`, `updateMachine`, `commitMachine`, ...). A non-zero `:exit-code` is a value to inspect, not necessarily a failure — mirrors `daemon/src/graphql.rs`'s `CommandResult`.
(image-info-from-row row)An image as reported by bsdkrun images --json.
An image as reported by `bsdkrun images --json`.
(json result)A Result's stdout, parsed as JSON.
A Result's stdout, parsed as JSON.
(lines result)A Result's non-empty stdout lines.
A Result's non-empty stdout lines.
(network-info-from-row row)A global network as reported by bsdkrun network ls --json.
A global network as reported by `bsdkrun network ls --json`.
(ok? result)Whether a Result map succeeded (exit 0).
Whether a Result map succeeded (exit 0).
(port-forward-from-row row)A host<->guest TCP port forward, as reported nested under ports in a
ps --json row.
A host<->guest TCP port forward, as reported nested under `ports` in a `ps --json` row.
(read-json-rows s)Parse s (raw CLI stdout) as a JSON array, defaulting to [] for empty
output — mirrors every list-style call site's
JSON.parse(stdout.empty? ? "[]" : stdout).
Parse `s` (raw CLI stdout) as a JSON array, defaulting to `[]` for empty output — mirrors every `list`-style call site's `JSON.parse(stdout.empty? ? "[]" : stdout)`.
(sandbox-info-from-graphql m)A machine as reported by the daemon's GraphQL API — a Machine object
decoded straight from JSON (camelCase string keys), unlike
sandbox-info-from-row's snake_case CLI rows. Same kebab-case-keyword
shape either way, so callers of bsdkrun.sandbox and bsdkrun.client see
identical SandboxInfo maps regardless of transport.
m is a MACHINE_FIELDS-shaped map (see bsdkrun.client), e.g. from
bsdkrun.client/list-machines or bsdkrun.client/get-machine.
A machine as reported by the daemon's GraphQL API — a `Machine` object decoded straight from JSON (camelCase string keys), unlike [[sandbox-info-from-row]]'s snake_case CLI rows. Same kebab-case-keyword shape either way, so callers of `bsdkrun.sandbox` and `bsdkrun.client` see identical `SandboxInfo` maps regardless of transport. `m` is a `MACHINE_FIELDS`-shaped map (see `bsdkrun.client`), e.g. from `bsdkrun.client/list-machines` or `bsdkrun.client/get-machine`.
(sandbox-info-from-row row)A machine as reported by bsdkrun ps --json.
A machine as reported by `bsdkrun ps --json`.
(shell-session-info-from-graphql s)An open interactive shell session, as reported by openShell / the
shellSessions query. Mirrors daemon/src/graphql.rs's
ShellSessionInfo.
An open interactive shell session, as reported by `openShell` / the `shellSessions` query. Mirrors `daemon/src/graphql.rs`'s `ShellSessionInfo`.
(text result)A Result's stdout with trailing newlines trimmed — the common case.
A Result's stdout with trailing newlines trimmed — the common case.
(throw-if-failed! result)Throw errors/command-failed if result exited non-zero; otherwise
return it unchanged.
Throw `errors/command-failed` if `result` exited non-zero; otherwise return it unchanged.
(volume-info-from-row row)A volume as reported by bsdkrun volume ls --json.
A volume as reported by `bsdkrun volume ls --json`.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |