Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

API Overview

The OpenShell Go SDK exposes typed interfaces through the sub-client pattern. You access each interface through a typed accessor on the concrete Client.

Interface Summary

Top-Level Interfaces

InterfaceAccessorDescription
SandboxInterfaceclient.Sandboxes()Create, manage, and watch sandbox lifecycle
SandboxTemplateInterfaceclient.SandboxTemplates()Manage reusable sandbox templates
ExecInterfaceclient.Exec()Run commands, stream output, interactive sessions
ProviderInterfaceclient.Providers()Manage compute providers and their lifecycle
ServiceInterfaceclient.Services()Expose and manage HTTP services inside sandboxes
FileInterfaceclient.Files()Upload and download files to/from sandboxes
HealthInterfaceclient.Health()Check gateway health status
SSHInterfaceclient.SSH()Create SSH sessions and tunnels to sandboxes
TCPInterfaceclient.TCP()Forward TCP connections to sandbox ports
ConfigInterfaceclient.Config()Read and update sandbox and gateway configuration
PolicyInterfaceclient.Policy()Manage draft policy recommendations

Convenience Packages

PackageEntry PointDescription
gatewaygateway.NewClient(name)Read CLI gateway configs and auto-wire clients

Provider Sub-Interfaces

These are accessed through client.Providers():

InterfaceAccessorDescription
ProfileInterfaceclient.Providers().Profiles()Manage provider type profiles
RefreshInterfaceclient.Providers().Refresh()Configure credential refresh strategies

Interfaces

Each interface has a reference page with method signatures and usage examples:

  • Sandboxes: Create sandboxes, wait for readiness, watch state changes, manage providers, retrieve logs.
  • Sandbox Templates: Create reusable workload templates and launch sandboxes from them.
  • Exec: Execute commands with one-shot, streaming, or interactive modes.
  • Providers: Register and manage compute providers. Includes sub-clients for profiles and credential refresh.
  • Services: Expose and manage HTTP services inside sandboxes.
  • Files: Upload and download files to/from sandboxes.
  • Health: Check gateway health status.
  • SSH: Create SSH sessions and tunnels to sandboxes.
  • TCP: Forward TCP connections to sandbox ports.
  • Config: Read and update sandbox and gateway configuration.
  • Policy: Manage draft policy recommendations.
  • Profiles: Manage provider type profiles (via client.Providers().Profiles()).
  • Refresh: Configure credential refresh strategies (via client.Providers().Refresh()).

Common Patterns

SDK methods follow these conventions:

  • Network operations take context.Context; list constructors return a pager, and each NextPage call accepts the request context
  • Methods that can fail return (result, error)
  • List methods accept variadic options and ListAll is the explicit exhaustive path
  • Errors from the gateway carry a StatusError with a typed code (see Error Handling)