Sandbox template management — define reusable base images for sandboxes.
Templates are built from a build_spec (a declarative definition of the
base image). Use build_spec_schema/1 to discover the schema, validate/2
to check a spec before creating a template, and create_build/2 to trigger
a build.
Mutating calls (create, create_build) send an Idempotency-Key header
automatically.
Example
client = Miosa.client(System.fetch_env!("MIOSA_API_KEY"))
{:ok, schema} = Miosa.SandboxTemplates.build_spec_schema(client)
{:ok, tmpl} = Miosa.SandboxTemplates.create(client, %{
name: "node-20-base",
build_spec: %{runtime: "node", version: "20", packages: ["curl"]}
})
{:ok, build} = Miosa.SandboxTemplates.create_build(client, tmpl["id"], %{})
Summary
Functions
Get the JSON schema for sandbox build specs.
Create a sandbox template.
Trigger a new build for a sandbox template.
Fetch a sandbox template by ID.
List sandbox templates for the authenticated tenant.
List builds for a sandbox template.
Validate a build spec without creating a template.
Functions
@spec build_spec_schema(Miosa.Client.t()) :: Miosa.Client.result(map())
Get the JSON schema for sandbox build specs.
@spec create(Miosa.Client.t(), map()) :: Miosa.Client.result(map())
Create a sandbox template.
Required: :name, :build_spec (map). Optional: :description, :metadata,
:idempotency_key.
@spec create_build(Miosa.Client.t(), String.t(), map()) :: Miosa.Client.result(map())
Trigger a new build for a sandbox template.
Optional attrs may include build-time overrides. Pass :idempotency_key
to supply your own idempotency key.
@spec get(Miosa.Client.t(), String.t()) :: Miosa.Client.result(map())
Fetch a sandbox template by ID.
@spec list(Miosa.Client.t(), keyword() | map()) :: Miosa.Client.result(map())
List sandbox templates for the authenticated tenant.
Options:
:include_aliases— Include template alias names. Defaults tofalse.
@spec list_builds(Miosa.Client.t(), String.t()) :: Miosa.Client.result(map())
List builds for a sandbox template.
@spec validate(Miosa.Client.t(), map()) :: Miosa.Client.result(map())
Validate a build spec without creating a template.
Returns validation errors or {:ok, result} with the normalized spec.