solari

package module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 19 Imported by: 0

README

solari-sdk-go

Go language binding for the Solari sandbox SDK (core surface): create / connect / kill a sandbox over REST, then drive a live session's Commands, Files, Code, and Git namespaces over the control WebSocket. It behaves identically on the wire to the reference TypeScript (@solarisdk/core) and Python (solari_desktop) SDKs — see ../PROTOCOL.md for the contract.

import "github.com/solari-sdk/solari-sandbox-go"

Module path: github.com/solari-sdk/solari-sandbox-go, package solari. Requires Go 1.23+ and github.com/gorilla/websocket.

Design

  • Context-first. Every network method takes ctx context.Context first.
  • Errors as typed values. *AuthError, *PlanError, *ConcurrencyLimitError, *NoCapacityError, *GatewayError, *ActionError, *ConnectionError, *TimeoutError, all embedding the base *SolariError. Match with errors.As.
  • Two transports. REST to the gateway for session lifecycle + the one-shot /exec fast path; a control WebSocket (newline-delimited JSON RPC) for a live session. The first Commands.Run on an unconnected sandbox uses the warm REST /exec path, skipping the cold WS handshake; call Connect(ctx) to open the WS for streaming/interactive work.

Example: create → run a command → git

package main

import (
	"context"
	"fmt"
	"log"

	solari "github.com/solari-sdk/solari-sandbox-go"
)

func main() {
	ctx := context.Background()

	client, err := solari.NewClient(solari.ClientOptions{
		APIKey:  "slr_live_…",
		BaseURL: "https://gw.example.com",
	})
	if err != nil {
		log.Fatal(err)
	}

	// Create a sandbox.
	sb, err := client.Create(ctx, solari.CreateOptions{Template: "base"})
	if err != nil {
		log.Fatal(err)
	}
	defer sb.Kill(ctx)

	// Run a command (this first call uses the warm REST /exec fast path).
	res, err := sb.Commands.Run(ctx, "echo", solari.CommandOptions{
		Args: []string{"hello", "world"},
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("exit=%d stdout=%q\n", res.ExitCode, res.Stdout)

	// Streaming a long-running command opens the control WebSocket.
	if err := sb.Connect(ctx); err != nil {
		log.Fatal(err)
	}
	_, err = sb.Commands.Run(ctx, "sh", solari.CommandOptions{
		Args:     []string{"-c", "for i in 1 2 3; do echo line $i; done"},
		OnStdout: func(s string) { fmt.Print(s) },
	})
	if err != nil {
		log.Fatal(err)
	}

	// Git: clone, inspect status, commit. Runs as safe, non-shell `git`
	// invocations over the command RPC (no injection surface).
	if err := sb.Git.Clone(ctx, "https://github.com/acme/repo.git", solari.GitCloneOptions{
		Path:  "repo",
		Depth: 1,
	}); err != nil {
		log.Fatal(err)
	}

	st, err := sb.Git.Status(ctx, "repo")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("branch=%s clean=%v staged=%v\n", st.Branch, st.Clean, st.Staged)

	sb.Git.Add(ctx, []string{"."}, "repo")
	hash, err := sb.Git.Commit(ctx, "automated change", solari.GitCommitOptions{
		Cwd:    "repo",
		Author: "Solari Bot",
		Email:  "bot@example.com",
		All:    true,
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println("committed", hash)
}

Typed error handling

_, err := client.Create(ctx, solari.CreateOptions{Template: "base"})
var cap *solari.ConcurrencyLimitError
var auth *solari.AuthError
switch {
case errors.As(err, &cap):
	// org at its live-session cap (HTTP 429) — not retryable
case errors.As(err, &auth):
	// bad/missing API key (HTTP 401/403)
}

Reconnecting to a running sandbox

sb, err := client.Connect(ctx, "sbx_…") // GET /sandboxes/:id, derives controlUrl

Namespaces

Namespace Methods
Commands Run, Start (→ CommandHandle with Stdin/OnData/Wait/Kill)
Files Read, ReadText, Write, List, Stat, Mkdir, Remove, Rename
Code Run (chart flattening), CreateContext
Git Clone, Status, Add, Commit, Push, Pull, Checkout, Branches, Log

Build & test

Offline — no live gateway required (transports are mocked in tests):

go build ./...
go test ./...

Documentation

Overview

Package solari is the Go language binding for the Solari sandbox SDK (core surface): create/connect/get/kill a sandbox over REST, then drive a live session's Commands, Files, Code, and Git namespaces over the control WebSocket. It behaves identically on the wire to the reference TypeScript (@solarisdk/core) and Python (solari_desktop) SDKs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionError

type ActionError struct {
	SolariError
	Method string
	Code   string
}

ActionError is raised when a control-WS JSON-RPC call returns {ok:false}.

func (*ActionError) Error

func (e *ActionError) Error() string

func (*ActionError) Unwrap

func (e *ActionError) Unwrap() error

type AuthError

type AuthError struct{ GatewayError }

AuthError maps HTTP 401/403 — the API key was missing, malformed, or rejected.

func (*AuthError) Unwrap

func (e *AuthError) Unwrap() error

type Chart

type Chart struct {
	Type     ChartType     `json:"type"`
	Title    string        `json:"title,omitempty"`
	XLabel   string        `json:"xLabel,omitempty"`
	YLabel   string        `json:"yLabel,omitempty"`
	X        *ChartAxis    `json:"x,omitempty"`
	Y        *ChartAxis    `json:"y,omitempty"`
	Elements []interface{} `json:"elements,omitempty"`
}

Chart is the structured representation of a matplotlib figure. Elements is kept loose (raw decoded JSON) so new chart types don't require an SDK bump.

type ChartAxis

type ChartAxis struct {
	Label string        `json:"label,omitempty"`
	Ticks []interface{} `json:"ticks,omitempty"`
	Scale string        `json:"scale,omitempty"`
}

ChartAxis is one axis of a 2D chart.

type ChartType

type ChartType string

ChartType is the kind of a structured matplotlib figure.

const (
	ChartLine          ChartType = "line"
	ChartScatter       ChartType = "scatter"
	ChartBar           ChartType = "bar"
	ChartPie           ChartType = "pie"
	ChartBoxAndWhisker ChartType = "box_and_whisker"
	ChartComposite     ChartType = "composite"
	ChartUnknown       ChartType = "unknown"
)

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client talks the SDK ⇆ Gateway REST API and hands back Sandbox handles.

func NewClient

func NewClient(opts ClientOptions) (*Client, error)

NewClient constructs a Client.

func (*Client) Connect

func (c *Client) Connect(ctx context.Context, sandboxID string) (*Sandbox, error)

Connect re-attaches to a running sandbox by id. When the view carries no controlUrl, it is derived by swapping the base URL scheme to ws/wss and appending /control/<id>.

func (*Client) Create

func (c *Client) Create(ctx context.Context, opts CreateOptions) (*Sandbox, error)

Create provisions a new sandbox (POST /sandboxes) and returns a handle. The control channel is NOT opened yet; the first Commands.Run may take the one-shot HTTP fast path, or call Connect() to open the WS.

func (*Client) Get

func (c *Client) Get(ctx context.Context, sandboxID string) (*SandboxView, error)

Get fetches a sandbox's current view (GET /sandboxes/:id).

func (*Client) Kill

func (c *Client) Kill(ctx context.Context, sandboxID string) error

Kill destroys a sandbox (DELETE /sandboxes/:id). Idempotent.

func (*Client) Pause

func (c *Client) Pause(ctx context.Context, sandboxID string) error

Pause snapshots a session's RAM+disk and frees its host slot (POST /sandboxes/:id/pause). The session keeps its id and can be brought back with Resume; its control channel is dead until then.

func (*Client) Resume

func (c *Client) Resume(ctx context.Context, sandboxID string) (string, error)

Resume re-hydrates a paused session (POST /sandboxes/:id/resume) and returns the control URL to re-attach to.

The session comes back on a FRESH slot, so the control URL it had before the pause is stale. The gateway normally returns the new one; when it does not, derive it from the gateway origin exactly as Connect does.

type ClientOptions

type ClientOptions struct {
	// APIKey authenticates every REST request and control-WS upgrade.
	APIKey string
	// BaseURL is the gateway origin, e.g. https://gw.example.com.
	BaseURL string
	// HTTPClient overrides the default HTTP client (mainly for tests).
	HTTPClient *http.Client
	// CallTimeoutMs is the per-call control-WS RPC timeout. Default 300000.
	CallTimeoutMs int
	// MaxRetries caps idempotent-request retries. Default 5.
	MaxRetries int
	// RetryDelayMs, when non-nil, replaces exponential backoff with a fixed
	// delay (0 disables the wait — handy for tests).
	RetryDelayMs *int
}

ClientOptions configure a Client.

type Code

type Code struct {
	// contains filtered or unexported fields
}

Code is the stateful-kernel namespace on a Sandbox (code.run).

func (*Code) CreateContext

func (c *Code) CreateContext(ctx context.Context, language string) (string, error)

CreateContext creates a fresh stateful kernel context (code.context.create), returning its id for reuse across Run calls.

func (*Code) Run

func (c *Code) Run(ctx context.Context, code string, opts RunCodeOptions) (*RunCodeResult, error)

Run executes code in a stateful kernel. Rich outputs come back as Results; OnStdout/OnStderr receive streamed text. Charts is a client-side convenience: every results[i].Chart present, flattened into a top-level slice.

type CodeError

type CodeError struct {
	Name      string `json:"name,omitempty"`
	Message   string `json:"message,omitempty"`
	Traceback string `json:"traceback,omitempty"`
}

CodeError is the structured error form of RunCodeResult.Error.

type CodeResultItem

type CodeResultItem struct {
	Type     string      `json:"type"`
	Text     string      `json:"text,omitempty"`
	PNG      string      `json:"png,omitempty"`
	JPEG     string      `json:"jpeg,omitempty"`
	SVG      string      `json:"svg,omitempty"`
	HTML     string      `json:"html,omitempty"`
	LaTeX    string      `json:"latex,omitempty"`
	JSON     interface{} `json:"json,omitempty"`
	Markdown string      `json:"markdown,omitempty"`
	Chart    *Chart      `json:"chart,omitempty"`
}

CodeResultItem is one rich result object from Code.Run.

type CommandHandle

type CommandHandle struct {
	CmdID string
	// contains filtered or unexported fields
}

CommandHandle is a started command from Commands.Start.

func (*CommandHandle) Kill

func (h *CommandHandle) Kill(ctx context.Context, signal int) error

Kill sends a signal (default SIGTERM when signal <= 0) to the command.

func (*CommandHandle) OnData

func (h *CommandHandle) OnData(cb func(stream, data string))

OnData subscribes to stdout/stderr chunks. Any output buffered before the first subscriber is replayed so early output is never dropped.

func (*CommandHandle) Stdin

func (h *CommandHandle) Stdin(ctx context.Context, data []byte) error

Stdin writes bytes/text to the command's stdin.

func (*CommandHandle) Wait

func (h *CommandHandle) Wait(ctx context.Context) (int, error)

Wait blocks until the command exits (or the channel drops / ctx is cancelled) and returns the exit code.

type CommandOptions

type CommandOptions struct {
	// Args is the argv tail passed to the program (no shell). For shell syntax
	// use Run(ctx, "sh", CommandOptions{Args: []string{"-c", "…"}}).
	Args []string
	Cwd  string
	Env  map[string]string
	User string
	// TimeoutMs bounds the one-shot exec fast path (server-side).
	TimeoutMs int
	// Background returns immediately; caller drives output via OnStdout/OnStderr.
	Background bool
	OnStdout   func(string)
	OnStderr   func(string)
}

CommandOptions configure Commands.Run / Commands.Start.

type CommandResult

type CommandResult struct {
	ExitCode int    `json:"exitCode"`
	Stdout   string `json:"stdout"`
	Stderr   string `json:"stderr"`
}

CommandResult is the terminal result of Commands.Run.

type Commands

type Commands struct {
	// contains filtered or unexported fields
}

Commands is the process-execution namespace on a Sandbox.

func (*Commands) Run

func (c *Commands) Run(ctx context.Context, cmd string, opts CommandOptions) (*CommandResult, error)

Run executes a command to completion and returns its terminal result. OnStdout/OnStderr (if set) receive output as it streams.

func (*Commands) Start

func (c *Commands) Start(ctx context.Context, cmd string, opts CommandOptions) (*CommandHandle, error)

Start launches a command and returns a handle immediately (does not wait for exit). Output streams as cmd.data frames; the handle exposes Stdin, OnData, Wait, and Kill.

type ConcurrencyLimitError

type ConcurrencyLimitError struct{ GatewayError }

ConcurrencyLimitError maps HTTP 429 — the org is at its live-session cap. It is NOT retryable (retrying won't help).

func (*ConcurrencyLimitError) Unwrap

func (e *ConcurrencyLimitError) Unwrap() error

type ConnectionError

type ConnectionError struct{ SolariError }

ConnectionError is raised when the control WebSocket is not open (never connected, closed mid-flight, or the dial failed).

func (*ConnectionError) Error

func (e *ConnectionError) Error() string

func (*ConnectionError) Unwrap

func (e *ConnectionError) Unwrap() error

type CreateOptions

type CreateOptions struct {
	Template     string
	Kind         SandboxKind
	CPU          int
	MemMb        int
	DiskGb       int
	Envs         map[string]string
	Metadata     map[string]string
	TimeoutMs    int
	FromSnapshot string
	Lifecycle    *SandboxLifecycle
	// Resolution is the initial display resolution, e.g. "1280x720". Desktops
	// only (KindDesktop) — a headless sandbox has no display.
	Resolution string
	// Record asks the gateway to record the session server-side; the create
	// response carries a presigned playback URL. Desktops only: `record` on a
	// headless sandbox is rejected (400 RecordingRequiresDesktop).
	//
	// A POINTER, not a bool: the reference SDKs distinguish "unset" (field
	// omitted) from an explicit false (field sent as `record:false`). A plain
	// bool + omitempty cannot express the latter, which would make this SDK the
	// only one unable to explicitly opt out.
	Record *bool
	// Volumes are persistent volumes to mount before the session starts.
	Volumes []VolumeAttachment
}

CreateOptions are the caller-facing options for Client.Create. Only Template is commonly set; everything else is optional (nil/zero fields are omitted from the wire body).

type CreateSandboxResponse

type CreateSandboxResponse struct {
	SandboxID  string      `json:"sandboxId"`
	Kind       SandboxKind `json:"kind"`
	ControlURL string      `json:"controlUrl"`
	ExpiresAt  string      `json:"expiresAt"`
	StreamURL  string      `json:"streamUrl,omitempty"`
}

CreateSandboxResponse is the 201 response from POST /sandboxes.

type Files

type Files struct {
	// contains filtered or unexported fields
}

Files is the filesystem namespace on a Sandbox (fs.* RPCs).

func (*Files) List

func (f *Files) List(ctx context.Context, path string) ([]FsEntry, error)

List returns the directory entries at path.

func (*Files) Mkdir

func (f *Files) Mkdir(ctx context.Context, path string) error

Mkdir creates a directory (and parents).

func (*Files) Read

func (f *Files) Read(ctx context.Context, path string) ([]byte, error)

Read returns the raw bytes of an in-guest file.

func (*Files) ReadText

func (f *Files) ReadText(ctx context.Context, path string) (string, error)

ReadText is Read decoded as UTF-8 text.

func (*Files) Remove

func (f *Files) Remove(ctx context.Context, path string, recursive bool) error

Remove deletes a path; recursive removes a directory tree.

func (*Files) Rename

func (f *Files) Rename(ctx context.Context, from, to string) error

Rename moves/renames a path.

func (*Files) Stat

func (f *Files) Stat(ctx context.Context, path string) (*FsStat, error)

Stat returns metadata for a single path.

func (*Files) Write

func (f *Files) Write(ctx context.Context, path string, data []byte, mode int) error

Write writes bytes to an in-guest path. mode is the unix permission bits (0 means "unset" — omitted from the wire).

type FsEntry

type FsEntry struct {
	Name string `json:"name"`
	Dir  bool   `json:"dir"`
	Size int64  `json:"size"`
}

FsEntry is one directory entry from Files.List. Fields match the guest wire exactly: the JSON key for a directory flag is "dir" (not "isDir").

type FsStat

type FsStat struct {
	Name      string `json:"name"`
	Dir       bool   `json:"dir"`
	Size      int64  `json:"size"`
	Mode      int    `json:"mode"`
	ModTimeMs int64  `json:"modTimeMs"`
}

FsStat is the Files.Stat result. Mirrors the guest wire: "dir" (not "isDir") and "modTimeMs" (unix-millis).

type GatewayError

type GatewayError struct {
	SolariError
	Status int
	Code   string
	Body   *GatewayErrorBody
}

GatewayError is any non-2xx gateway response not otherwise specialized.

func (*GatewayError) Error

func (e *GatewayError) Error() string

func (*GatewayError) Unwrap

func (e *GatewayError) Unwrap() error

type GatewayErrorBody

type GatewayErrorBody struct {
	Code    string `json:"code,omitempty"`
	Error   string `json:"error,omitempty"`
	Message string `json:"message,omitempty"`
	// Retryable is a gateway hint that the failure is transient. The HTTP
	// transport retries idempotent requests when set.
	Retryable bool `json:"retryable,omitempty"`
}

GatewayErrorBody is the JSON shape a gateway error response may carry.

type Git

type Git struct {
	// contains filtered or unexported fields
}

Git is the version-control namespace on a Sandbox. Every method is a safe, non-shell `git` invocation over the command RPC with client-side parsing.

func (*Git) Add

func (g *Git) Add(ctx context.Context, paths []string, cwd string) error

Add stages paths (use ["."] for everything). A no-op on empty paths; the `--` separator guards paths that look like flags.

func (*Git) Branches

func (g *Git) Branches(ctx context.Context, cwd string) ([]GitBranch, error)

Branches lists local branches (name, short commit, whether it's HEAD).

func (*Git) Checkout

func (g *Git) Checkout(ctx context.Context, ref string, cwd string, create bool) error

Checkout checks out an existing ref, or creates a branch with create=true.

func (*Git) Clone

func (g *Git) Clone(ctx context.Context, rawURL string, opts GitCloneOptions) error

Clone clones url into opts.Path (or git's default dir) under opts.Cwd.

func (*Git) Commit

func (g *Git) Commit(ctx context.Context, message string, opts GitCommitOptions) (string, error)

Commit commits staged changes and returns the new commit hash. author/email scope identity to this one commit without mutating repo/global config.

func (*Git) Log

func (g *Git) Log(ctx context.Context, opts GitLogOptions) ([]GitCommit, error)

Log returns recent commits, newest first.

func (*Git) Pull

func (g *Git) Pull(ctx context.Context, opts GitRemoteOptions) error

Pull pulls from a remote (default origin + current branch).

func (*Git) Push

func (g *Git) Push(ctx context.Context, opts GitRemoteOptions) error

Push pushes to a remote (default origin + current branch).

func (*Git) Status

func (g *Git) Status(ctx context.Context, cwd string) (*GitStatus, error)

Status returns the parsed working-tree status.

type GitBranch

type GitBranch struct {
	Name    string `json:"name"`
	Commit  string `json:"commit"`
	Current bool   `json:"current"`
}

GitBranch is one branch entry (git.branches).

type GitCloneOptions

type GitCloneOptions struct {
	Path     string
	Branch   string
	Depth    int
	Username string
	Password string
	Cwd      string
}

GitCloneOptions configure Git.Clone.

type GitCommit

type GitCommit struct {
	Hash    string `json:"hash"`
	Author  string `json:"author"`
	Email   string `json:"email"`
	Date    string `json:"date"`
	Message string `json:"message"`
}

GitCommit is one commit record (git.log).

type GitCommitOptions

type GitCommitOptions struct {
	Cwd    string
	Author string
	Email  string
	All    bool
}

GitCommitOptions configure Git.Commit.

type GitLogOptions

type GitLogOptions struct {
	Cwd      string
	MaxCount int
}

GitLogOptions configure Git.Log.

type GitRemoteOptions

type GitRemoteOptions struct {
	Cwd      string
	Remote   string
	Branch   string
	Username string
	Password string
}

GitRemoteOptions configure Git.Push / Git.Pull.

type GitStatus

type GitStatus struct {
	Branch    string   `json:"branch"`
	Detached  bool     `json:"detached"`
	Ahead     int      `json:"ahead"`
	Behind    int      `json:"behind"`
	Staged    []string `json:"staged"`
	Modified  []string `json:"modified"`
	Untracked []string `json:"untracked"`
	Clean     bool     `json:"clean"`
}

GitStatus is the parsed working-tree status (git.status).

type NoCapacityError

type NoCapacityError struct{ GatewayError }

NoCapacityError maps HTTP 503 (or a no_capacity body) — no host currently available. Retryable.

func (*NoCapacityError) Unwrap

func (e *NoCapacityError) Unwrap() error

type PlanError

type PlanError struct{ GatewayError }

PlanError maps HTTP 402 (or a plan_* body) — the plan doesn't allow this.

func (*PlanError) Unwrap

func (e *PlanError) Unwrap() error

type RunCodeOptions

type RunCodeOptions struct {
	Language  string
	ContextID string
	OnStdout  func(string)
	OnStderr  func(string)
}

RunCodeOptions configure Code.Run.

type RunCodeResult

type RunCodeResult struct {
	Results []CodeResultItem `json:"results"`
	// Error is either a *CodeError (object form) or a string; kept as the raw
	// decoded value so both wire shapes round-trip.
	Error  interface{} `json:"error,omitempty"`
	Charts []Chart     `json:"charts"`
}

RunCodeResult is the result of Code.Run. Charts is a client-side convenience: every results[i].Chart that is present, flattened into a top-level slice.

type Sandbox

type Sandbox struct {
	ID         string
	ControlURL string
	ExpiresAt  string
	Kind       SandboxKind
	// StreamURL is the live-view WebSocket URL. Set for KindDesktop only — the
	// gateway omits it for headless sandboxes, which have no display to stream.
	StreamURL string

	Commands *Commands
	Files    *Files
	Code     *Code
	Git      *Git
	// contains filtered or unexported fields
}

Sandbox is a live session handle exposing the core namespaces.

func (*Sandbox) Close

func (s *Sandbox) Close()

Close closes the control channel locally (does NOT release the remote session).

func (*Sandbox) Connect

func (s *Sandbox) Connect(ctx context.Context) error

Connect opens the control WebSocket. Idempotent.

func (*Sandbox) Connected

func (s *Sandbox) Connected() bool

Connected reports whether the control channel is open.

func (*Sandbox) Kill

func (s *Sandbox) Kill(ctx context.Context) error

Kill destroys the remote session and closes the channel. Idempotent.

func (*Sandbox) Pause

func (s *Sandbox) Pause(ctx context.Context) error

Pause snapshots this session's RAM+disk, frees its host slot, and closes the control channel. The session keeps its id; bring it back with Resume.

Mirrors TS `handle.pause()` / Python `handle.pause()`: the remote call first, then the local channel close.

func (*Sandbox) Reconnect

func (s *Sandbox) Reconnect(ctx context.Context) error

Reconnect re-opens the control channel after a drop.

func (*Sandbox) Resume

func (s *Sandbox) Resume(ctx context.Context) error

Resume re-hydrates this paused session and re-points the control channel at the fresh slot it came back on.

Mirrors TS `handle.resume()` / Python `handle.resume()`: resume, adopt the new control URL, reconnect.

type SandboxKind

type SandboxKind string

SandboxKind is the flavour of a session: headless "sandbox" or GUI "desktop".

const (
	KindSandbox SandboxKind = "sandbox"
	KindDesktop SandboxKind = "desktop"
)

type SandboxLifecycle

type SandboxLifecycle struct {
	OnTimeout  string `json:"onTimeout"`
	AutoResume *bool  `json:"autoResume,omitempty"`
}

SandboxLifecycle is the idle lifecycle policy (pause/kill on timeout).

type SandboxView

type SandboxView struct {
	SandboxID  string            `json:"sandboxId"`
	Kind       SandboxKind       `json:"kind"`
	State      string            `json:"state"`
	Metadata   map[string]string `json:"metadata,omitempty"`
	ExpiresAt  string            `json:"expiresAt"`
	ControlURL string            `json:"controlUrl,omitempty"`
	CPU        int               `json:"cpu,omitempty"`
	MemMb      int               `json:"memMb,omitempty"`
}

SandboxView is the GET /sandboxes/{id} response (used by Connect).

type SolariError

type SolariError struct {
	Message string
}

SolariError is the base type for every error the SDK produces. The typed errors below embed it (directly or transitively), so callers can match broadly with errors.As(&*SolariError) or narrowly on a concrete type.

func (*SolariError) Error

func (e *SolariError) Error() string

type TimeoutError

type TimeoutError struct {
	SolariError
	Method    string
	TimeoutMs int
}

TimeoutError is raised when an RPC (or a connect) does not complete within its deadline. Method is the RPC method name, or "connect".

func (*TimeoutError) Error

func (e *TimeoutError) Error() string

func (*TimeoutError) Unwrap

func (e *TimeoutError) Unwrap() error

type VolumeAttachment

type VolumeAttachment struct {
	// VolumeID is a `vol_…` id belonging to your org.
	VolumeID string `json:"volumeId"`
	// Path is the absolute in-guest mount point, e.g. "/data".
	Path string `json:"path"`
}

VolumeAttachment is one attach-at-create instruction: a persistent volume (created via Client.Volumes) and the absolute path to mount it at inside the guest. The mount is performed host-side before the guest starts, and survives pause/resume and recreate.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL