Documentation
¶
Overview ¶
Package structs defines the public request, response, option, and enum types used by the CreateOS Sandbox API.
The package contains data contracts only and does not perform network calls.
Index ¶
- type AddSSHPublicKeysRequest
- type AddSSHPublicKeysResponse
- type AttachDiskOptions
- type BandwidthView
- type CommandResult
- type CommandStreamEvent
- type CommandStreamFrame
- type ComputerButtonRequest
- type ComputerClickRequest
- type ComputerClipboard
- type ComputerCreateScreenRequest
- type ComputerDragRequest
- type ComputerLaunchRequest
- type ComputerListWindowsOptions
- type ComputerMouseButton
- type ComputerOpenRequest
- type ComputerPoint
- type ComputerPressRequest
- type ComputerScreen
- type ComputerScreenConnection
- type ComputerScreenGeometry
- type ComputerScreenID
- type ComputerScreenOptions
- type ComputerScreenshotOptions
- type ComputerScrollDirection
- type ComputerScrollRequest
- type ComputerTypeRequest
- type ComputerWindow
- type ComputerWindowGeometry
- type ComputerWindowMoveRequest
- type ComputerWindowResizeRequest
- type CreateSandboxOptions
- type CreateSandboxRequest
- type CreateSandboxResponse
- type DestroyedResponse
- type DetachDiskOptions
- type DiskAttachment
- type DiskConfig
- type DiskCreateRequest
- type DiskCredentials
- type DiskDeletedResponse
- type DiskDetachedResponse
- type DiskKind
- type DiskMountStatus
- type DiskView
- type EgressView
- type ExecOptions
- type ExecStreamEventType
- type ForkSandboxRequest
- type GetTemplateOptions
- type HealthzResponse
- type HostPublic
- type HostStatus
- type IDResponse
- type JSendEnvelope
- type ListSandboxesOptions
- type ManagedProcess
- type ManagedProcessConnectEvent
- type ManagedProcessConnectEventType
- type ManagedProcessConnectFrame
- type ManagedProcessConnectOptions
- type ManagedProcessCreateRequest
- type ManagedProcessDeleteOptions
- type ManagedProcessForeground
- type ManagedProcessInputRequest
- type ManagedProcessInputResponse
- type ManagedProcessKind
- type ManagedProcessListResponse
- type ManagedProcessOutputWindow
- type ManagedProcessSignal
- type ManagedProcessSignalRequest
- type ManagedProcessState
- type ManagedProcessStream
- type ManagedProcessWaitOptions
- type ManagedProcessWaitScope
- type Network
- type NetworkCreateRequest
- type NetworkEntry
- type NetworkMember
- type OKResponse
- type PTYSize
- type PaginatedResponse
- type PaginationMetadata
- type PaginationOptions
- type PatchSandboxRequest
- type ReadyzResponse
- type RechargeBandwidthRequest
- type RequestOptions
- type ResizeSandboxRequest
- type ResizeSandboxResponse
- type RetryOptions
- type RetryReason
- type RootFSData
- type RootFSEntry
- type RotateDiskCredentialsRequest
- type RunCommandRequest
- type RunCommandResponse
- type SandboxAccessTokenCreateResponse
- type SandboxAccessTokenMetadata
- type SandboxDiskView
- type SandboxResponse
- type SandboxStatus
- type SetEgressRequest
- type Shape
- type TemplateCreateRequest
- type TemplateInclude
- type TemplateLogEvent
- type TemplateLogsOptions
- type TemplateStatus
- type TemplateView
- type WaitOptions
- type WhoAmIStatsView
- type WhoAmIView
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddSSHPublicKeysRequest ¶
type AddSSHPublicKeysRequest struct {
Keys []string `json:"keys"`
}
AddSSHPublicKeysRequest adds OpenSSH public keys to a running sandbox.
type AddSSHPublicKeysResponse ¶
type AddSSHPublicKeysResponse struct {
Count int `json:"count"`
}
AddSSHPublicKeysResponse reports the resulting key count.
type AttachDiskOptions ¶
type AttachDiskOptions struct {
// DiskID identifies the registered disk to attach.
DiskID string `json:"-"`
// MountPath is the absolute destination inside the sandbox.
MountPath string `json:"-"`
// SubPath optionally mounts only a path within the disk.
SubPath string `json:"-"`
}
AttachDiskOptions identifies a disk and its guest mount point.
type BandwidthView ¶
type BandwidthView struct {
ID string `json:"id"`
QuotaBytes int64 `json:"quota_bytes"`
UsedBytes int64 `json:"used_bytes"`
IngressBytes int64 `json:"ingress_bytes"`
RemainingBytes int64 `json:"remaining_bytes"`
Capped bool `json:"capped"`
}
BandwidthView contains sandbox quota and usage counters.
type CommandResult ¶
type CommandResult struct {
StandardOutput string `json:"stdout"`
StandardError string `json:"stderr"`
ExitCode int `json:"exit_code"`
ErrorMessage string `json:"error,omitempty"`
}
CommandResult contains buffered command output.
type CommandStreamEvent ¶
type CommandStreamEvent struct {
Type ExecStreamEventType `json:"type"`
Data string `json:"data,omitempty"`
ExitCode *int `json:"exitCode,omitempty"`
ErrorMessage string `json:"message,omitempty"`
}
CommandStreamEvent is a decoded command stream event.
type CommandStreamFrame ¶
type CommandStreamFrame struct {
StandardOutput string `json:"stdout,omitempty"`
StandardError string `json:"stderr,omitempty"`
ExitCode *int `json:"exit_code,omitempty"`
ErrorMessage string `json:"error,omitempty"`
Heartbeat bool `json:"hb,omitempty"`
}
CommandStreamFrame is a raw command NDJSON frame.
type ComputerButtonRequest ¶
type ComputerButtonRequest struct {
Button ComputerMouseButton `json:"button,omitempty"`
}
ComputerButtonRequest describes a mouse button action.
type ComputerClickRequest ¶
type ComputerClickRequest struct {
// Button defaults to the primary mouse button when omitted.
Button ComputerMouseButton `json:"button,omitempty"`
// X and Y optionally move the cursor before clicking. Pointers distinguish
// an explicit zero coordinate from an omitted coordinate.
X *int `json:"x,omitempty"`
Y *int `json:"y,omitempty"`
// Count is the number of clicks; zero uses the API default.
Count int `json:"count,omitempty"`
}
ComputerClickRequest describes a mouse click.
type ComputerClipboard ¶
type ComputerClipboard struct {
Text string `json:"text"`
}
ComputerClipboard contains desktop clipboard text.
type ComputerCreateScreenRequest ¶
type ComputerCreateScreenRequest struct {
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
}
ComputerCreateScreenRequest creates or resizes a desktop screen.
type ComputerDragRequest ¶
type ComputerDragRequest struct {
From ComputerPoint `json:"from"`
To ComputerPoint `json:"to"`
}
ComputerDragRequest describes a mouse drag.
type ComputerLaunchRequest ¶
type ComputerLaunchRequest struct {
Application string `json:"application"`
URI string `json:"uri,omitempty"`
}
ComputerLaunchRequest launches an installed desktop application.
type ComputerListWindowsOptions ¶
type ComputerListWindowsOptions struct {
ComputerScreenOptions
// Application restricts results to windows belonging to this application.
Application string `json:"-"`
}
ComputerListWindowsOptions filters visible desktop windows.
type ComputerMouseButton ¶
type ComputerMouseButton string
ComputerMouseButton identifies a mouse button.
const ( ComputerMouseButtonLeft ComputerMouseButton = "left" ComputerMouseButtonMiddle ComputerMouseButton = "middle" ComputerMouseButtonRight ComputerMouseButton = "right" )
Mouse buttons accepted by mouse operations.
type ComputerOpenRequest ¶
type ComputerOpenRequest struct {
Target string `json:"target"`
}
ComputerOpenRequest opens a URL or desktop target.
type ComputerPoint ¶
ComputerPoint is a coordinate on a desktop screen.
type ComputerPressRequest ¶
type ComputerPressRequest struct {
Keys []string `json:"keys"`
}
ComputerPressRequest describes a key or key-combination press.
type ComputerScreen ¶
type ComputerScreen struct {
ScreenID ComputerScreenID `json:"screen_id"`
Display string `json:"display"`
Width int `json:"width"`
Height int `json:"height"`
VNCPort int `json:"vnc_port"`
NoVNCPort int `json:"novnc_port"`
}
ComputerScreen describes a configured desktop screen.
type ComputerScreenConnection ¶
type ComputerScreenConnection struct {
ScreenID ComputerScreenID `json:"screen_id"`
Port int `json:"port"`
Path string `json:"path"`
Token string `json:"token"`
ExpiresAt time.Time `json:"expires_at"`
URL string `json:"url,omitempty"`
}
ComputerScreenConnection contains temporary noVNC connection details.
type ComputerScreenGeometry ¶
ComputerScreenGeometry describes desktop screen dimensions.
type ComputerScreenID ¶
type ComputerScreenID string
ComputerScreenID identifies one of the eight supported desktop screens.
const ( ComputerScreen0 ComputerScreenID = "screen-0" ComputerScreen1 ComputerScreenID = "screen-1" ComputerScreen2 ComputerScreenID = "screen-2" ComputerScreen3 ComputerScreenID = "screen-3" ComputerScreen4 ComputerScreenID = "screen-4" ComputerScreen5 ComputerScreenID = "screen-5" ComputerScreen6 ComputerScreenID = "screen-6" ComputerScreen7 ComputerScreenID = "screen-7" )
Screen identifiers accepted by desktop operations.
type ComputerScreenOptions ¶
type ComputerScreenOptions struct {
RequestOptions
// ScreenID selects a screen. The zero value lets the API select its default.
ScreenID ComputerScreenID `json:"-"`
}
ComputerScreenOptions scopes a desktop operation to one screen.
type ComputerScreenshotOptions ¶
type ComputerScreenshotOptions struct {
ComputerScreenOptions
// WindowID restricts capture to a window when non-empty.
WindowID string `json:"-"`
// X and Y optionally set the crop origin. Pointers distinguish an explicit
// zero coordinate from an omitted coordinate.
X *int `json:"-"`
Y *int `json:"-"`
// Width and Height set the crop size when greater than zero.
Width int `json:"-"`
Height int `json:"-"`
}
ComputerScreenshotOptions configures screenshot capture and cropping.
type ComputerScrollDirection ¶
type ComputerScrollDirection string
ComputerScrollDirection identifies a vertical scroll direction.
const ( ComputerScrollUp ComputerScrollDirection = "up" ComputerScrollDown ComputerScrollDirection = "down" )
Vertical directions accepted by MouseService.Scroll.
type ComputerScrollRequest ¶
type ComputerScrollRequest struct {
Direction ComputerScrollDirection `json:"direction,omitempty"`
Amount int `json:"amount,omitempty"`
}
ComputerScrollRequest describes a mouse scroll.
type ComputerTypeRequest ¶
type ComputerTypeRequest struct {
// Text is typed exactly as supplied.
Text string `json:"text"`
// DelayInMS is the delay between characters in milliseconds.
DelayInMS int `json:"delay_in_ms,omitempty"`
}
ComputerTypeRequest describes text typed through the keyboard.
type ComputerWindow ¶
ComputerWindow describes a visible desktop window.
type ComputerWindowGeometry ¶
type ComputerWindowGeometry struct {
ID string `json:"id"`
X int `json:"x"`
Y int `json:"y"`
Width int `json:"width"`
Height int `json:"height"`
Screen int `json:"screen"`
}
ComputerWindowGeometry describes a window's position and size.
type ComputerWindowMoveRequest ¶
ComputerWindowMoveRequest moves a desktop window.
type ComputerWindowResizeRequest ¶
ComputerWindowResizeRequest resizes a desktop window.
type CreateSandboxOptions ¶
type CreateSandboxOptions struct {
RequestOptions
}
CreateSandboxOptions configures the create request transport.
type CreateSandboxRequest ¶
type CreateSandboxRequest struct {
// Shape is the required sizing preset identifier.
Shape string `json:"shape"`
// RootFS is a built-in root filesystem name or custom template ID.
RootFS string `json:"rootfs,omitempty"`
// Name is an optional human-readable sandbox name.
Name string `json:"name,omitempty"`
// Networks are overlay networks attached during creation.
Networks []NetworkEntry `json:"networks,omitempty"`
// DiskMiB requests an overlay disk size in mebibytes.
DiskMiB int64 `json:"disk_mib,omitempty"`
// EgressRules is the outbound network allowlist.
EgressRules []string `json:"egress,omitempty"`
// EnvironmentVariables are injected into the sandbox environment.
EnvironmentVariables map[string]string `json:"envs,omitempty"`
// SSHPublicKeys are OpenSSH public keys authorized in the sandbox.
SSHPublicKeys []string `json:"ssh_pubkeys,omitempty"`
// HostID requests placement on a specific worker host.
HostID string `json:"host_id,omitempty"`
// NodeSelector requests placement on a worker matching these labels.
NodeSelector map[string]string `json:"node_selector,omitempty"`
// IngressEnabled enables public preview URLs for the sandbox.
IngressEnabled bool `json:"ingress_enabled,omitempty"`
// Disks are persistent disks mounted during creation.
Disks []DiskAttachment `json:"disks,omitempty"`
// Region requests placement in a specific region.
Region string `json:"region,omitempty"`
// AutoPauseAfterSeconds pauses an idle sandbox after this many seconds.
AutoPauseAfterSeconds int `json:"auto_pause_after_seconds,omitempty"`
}
CreateSandboxRequest is the body used to create a sandbox.
type CreateSandboxResponse ¶
type CreateSandboxResponse struct {
ID string `json:"id"`
Status SandboxStatus `json:"status"`
Name *string `json:"name,omitempty"`
IPAddress string `json:"ip"`
Shape string `json:"shape"`
RootFS *string `json:"rootfs,omitempty"`
VCPU int `json:"vcpu"`
MemoryMiB int `json:"mem_mib"`
DiskMiB int64 `json:"disk_mib"`
SpawnMilliseconds float64 `json:"spawn_ms"`
EgressRules []string `json:"egress"`
BandwidthQuotaBytes int64 `json:"bandwidth_quota_bytes"`
IngressURLTemplate string `json:"ingress_url_template,omitempty"`
}
CreateSandboxResponse records resolved placement and boot timing.
type DestroyedResponse ¶
type DestroyedResponse struct {
ID string `json:"id"`
Status SandboxStatus `json:"status"`
}
DestroyedResponse reports a sandbox destruction result.
type DetachDiskOptions ¶
type DetachDiskOptions struct {
// DiskID identifies the registered disk to detach.
DiskID string `json:"-"`
// MountPath identifies the mount when the same disk has multiple mounts.
MountPath string `json:"-"`
}
DetachDiskOptions identifies one attached disk mount.
type DiskAttachment ¶
type DiskAttachment struct {
// DiskID identifies the registered persistent disk.
DiskID string `json:"disk_id"`
// MountPath is the absolute destination inside the sandbox.
MountPath string `json:"mount_path"`
// SubPath optionally mounts only a path within the disk.
SubPath string `json:"sub_path,omitempty"`
}
DiskAttachment mounts a registered disk into a sandbox.
type DiskConfig ¶
type DiskConfig struct {
Bucket string `json:"bucket"`
Endpoint string `json:"endpoint"`
Region string `json:"region,omitempty"`
UsePathStyle bool `json:"use_path_style,omitempty"`
}
DiskConfig contains non-secret S3 disk configuration.
type DiskCreateRequest ¶
type DiskCreateRequest struct {
Name string `json:"name"`
Kind DiskKind `json:"kind"`
Config DiskConfig `json:"config"`
Credentials DiskCredentials `json:"credentials"`
}
DiskCreateRequest registers a persistent disk.
type DiskCredentials ¶
type DiskCredentials struct {
// AccessKey is the S3-compatible access key ID.
AccessKey string `json:"access_key"`
// SecretKey is the S3-compatible secret access key.
SecretKey string `json:"secret_key"`
}
DiskCredentials contains write-only bucket credentials.
type DiskDeletedResponse ¶
type DiskDeletedResponse struct {
Deleted bool `json:"deleted"`
}
DiskDeletedResponse reports whether a disk was deleted.
type DiskDetachedResponse ¶
type DiskDetachedResponse struct {
Detached bool `json:"detached"`
}
DiskDetachedResponse reports whether a disk was detached.
type DiskKind ¶
type DiskKind string
DiskKind identifies a registered disk backend.
const DiskKindS3 DiskKind = "s3"
DiskKindS3 identifies an S3-compatible persistent disk.
type DiskMountStatus ¶
type DiskMountStatus string
DiskMountStatus is the state of a sandbox disk mount.
const ( DiskMountStatusPending DiskMountStatus = "pending" DiskMountStatusMounted DiskMountStatus = "mounted" DiskMountStatusError DiskMountStatus = "error" DiskMountStatusUnmounting DiskMountStatus = "unmounting" )
Supported states of a sandbox disk mount.
type DiskView ¶
type DiskView struct {
ID string `json:"id"`
Name string `json:"name"`
Kind DiskKind `json:"kind"`
Config DiskConfig `json:"config"`
CreatedAt time.Time `json:"created_at"`
}
DiskView describes a registered persistent disk without credentials.
type EgressView ¶
EgressView contains the current sandbox egress allowlist.
type ExecOptions ¶
type ExecOptions struct {
RequestOptions
// StandardInput replaces RunCommandRequest.StandardInput when non-empty.
StandardInput string `json:"-"`
// EnvironmentVariables replaces RunCommandRequest.EnvironmentVariables
// when non-nil.
EnvironmentVariables map[string]string `json:"-"`
}
ExecOptions configures one buffered or streaming command.
type ExecStreamEventType ¶
type ExecStreamEventType string
ExecStreamEventType identifies a command stream event.
const ( ExecStreamEventStdout ExecStreamEventType = "stdout" ExecStreamEventStderr ExecStreamEventType = "stderr" ExecStreamEventExit ExecStreamEventType = "exit" ExecStreamEventError ExecStreamEventType = "error" ExecStreamEventHeartbeat ExecStreamEventType = "heartbeat" )
Event types emitted by CommandStream.
type ForkSandboxRequest ¶
type ForkSandboxRequest struct {
// StartPaused leaves the fork paused instead of starting it.
StartPaused bool `json:"start_paused,omitempty"`
// SSHPublicKeys replaces the inherited authorized keys when provided.
SSHPublicKeys []string `json:"ssh_pubkeys,omitempty"`
// EgressRules replaces the inherited outbound allowlist when provided.
EgressRules []string `json:"egress,omitempty"`
// IngressEnabled overrides inherited ingress. A pointer permits explicitly
// disabling ingress with false.
IngressEnabled *bool `json:"ingress_enabled,omitempty"`
// EnvironmentVariables replaces inherited environment variables when provided.
EnvironmentVariables map[string]string `json:"envs,omitempty"`
}
ForkSandboxRequest contains optional overrides applied to a fork.
type GetTemplateOptions ¶
type GetTemplateOptions struct {
RequestOptions
// Include requests an optional field in the response.
Include TemplateInclude `json:"-"`
}
GetTemplateOptions configures a template detail request.
type HealthzResponse ¶
type HealthzResponse struct {
Up bool `json:"up"`
}
HealthzResponse is the control-plane liveness result.
type HostPublic ¶
type HostPublic struct {
ID string `json:"id"`
Status HostStatus `json:"status"`
FreeMemoryMiB int `json:"free_mib"`
SandboxCount int `json:"vm_count"`
RootFileSystems []string `json:"rootfses,omitempty"`
}
HostPublic describes a worker host visible to an administrator.
type HostStatus ¶
type HostStatus string
HostStatus is the scheduling state of a worker host.
const ( HostStatusActive HostStatus = "active" HostStatusDraining HostStatus = "draining" HostStatusDead HostStatus = "dead" )
Supported host scheduling states.
type IDResponse ¶
type IDResponse struct {
ID string `json:"id"`
}
IDResponse is the canonical acknowledgement for a mutation of one resource.
type JSendEnvelope ¶
type JSendEnvelope[T any] struct { Status string `json:"status"` Data T `json:"data,omitempty"` Message string `json:"message,omitempty"` Code int `json:"code,omitempty"` }
JSendEnvelope is the generic wrapper used by every JSON API response. Data is the endpoint-specific success or failure payload.
type ListSandboxesOptions ¶
type ListSandboxesOptions struct {
RequestOptions
// Limit is the maximum number of sandboxes returned. Zero returns all
// available sandboxes by walking server-side pages.
Limit int `json:"-"`
// Status restricts results to one lifecycle state. The zero value does not
// filter by status.
Status SandboxStatus `json:"-"`
}
ListSandboxesOptions filters and limits sandbox listing.
type ManagedProcess ¶
type ManagedProcess struct {
ProcessID string `json:"process_id"`
Kind ManagedProcessKind `json:"kind"`
PID int `json:"pid"`
State ManagedProcessState `json:"state"`
LeaderExited bool `json:"leader_exited"`
TreeExited bool `json:"tree_exited"`
CreatedAt time.Time `json:"created_at"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
ExitCode *int `json:"exit_code,omitempty"`
Signal *string `json:"signal,omitempty"`
Command string `json:"cmd,omitempty"`
Arguments []string `json:"args,omitempty"`
WorkingDirectory string `json:"cwd,omitempty"`
Foreground *ManagedProcessForeground `json:"foreground,omitempty"`
Output ManagedProcessOutputWindow `json:"output"`
}
ManagedProcess is the server projection of a persistent process.
type ManagedProcessConnectEvent ¶
type ManagedProcessConnectEvent struct {
Type ManagedProcessConnectEventType `json:"type"`
Sequence int64 `json:"seq,omitempty"`
Stream ManagedProcessStream `json:"stream,omitempty"`
Data []byte `json:"data,omitempty"`
ExitCode *int `json:"exitCode,omitempty"`
Signal *string `json:"signal,omitempty"`
ErrorMessage string `json:"message,omitempty"`
OldestAvailableSequence int64 `json:"oldestAvailableSeq,omitempty"`
}
ManagedProcessConnectEvent is a decoded process connection event.
type ManagedProcessConnectEventType ¶
type ManagedProcessConnectEventType string
ManagedProcessConnectEventType identifies a process connection event.
const ( ManagedProcessConnectEventData ManagedProcessConnectEventType = "data" ManagedProcessConnectEventExit ManagedProcessConnectEventType = "exit" ManagedProcessConnectEventHeartbeat ManagedProcessConnectEventType = "heartbeat" ManagedProcessConnectEventError ManagedProcessConnectEventType = "error" )
Event types emitted by ProcessStream.
type ManagedProcessConnectFrame ¶
type ManagedProcessConnectFrame struct {
Type ManagedProcessConnectEventType `json:"type"`
Sequence int64 `json:"seq,omitempty"`
Stream ManagedProcessStream `json:"stream,omitempty"`
DataBase64 string `json:"data_base64,omitempty"`
ExitCode *int `json:"exit_code,omitempty"`
Signal *string `json:"signal,omitempty"`
ErrorMessage string `json:"error,omitempty"`
OldestAvailableSequence int64 `json:"oldest_available_seq,omitempty"`
}
ManagedProcessConnectFrame is a raw process connection NDJSON frame.
type ManagedProcessConnectOptions ¶
type ManagedProcessConnectOptions struct {
RequestOptions
// AfterSequence replays output strictly after this sequence number. Zero
// starts from the beginning of retained output.
AfterSequence int64 `json:"-"`
}
ManagedProcessConnectOptions configures output replay.
type ManagedProcessCreateRequest ¶
type ManagedProcessCreateRequest struct {
// Command is the executable name or absolute path.
Command string `json:"cmd,omitempty"`
// Arguments are passed directly to Command without shell expansion.
Arguments []string `json:"args,omitempty"`
// WorkingDirectory is the process's initial directory.
WorkingDirectory string `json:"cwd,omitempty"`
// EnvironmentVariables are added to the process environment.
EnvironmentVariables map[string]string `json:"env,omitempty"`
// PTY requests terminal-backed execution when non-nil; nil uses pipes.
PTY *PTYSize `json:"pty,omitempty"`
}
ManagedProcessCreateRequest describes a persistent managed process.
type ManagedProcessDeleteOptions ¶
type ManagedProcessDeleteOptions struct {
RequestOptions
// GracePeriod is the time allowed for graceful termination before the
// process tree is forcibly stopped.
GracePeriod time.Duration `json:"-"`
}
ManagedProcessDeleteOptions configures graceful process deletion.
type ManagedProcessForeground ¶
type ManagedProcessForeground struct {
ProcessID int `json:"pid,omitempty"`
Command string `json:"cmd"`
Arguments []string `json:"args,omitempty"`
}
ManagedProcessForeground describes the foreground command in a PTY.
type ManagedProcessInputRequest ¶
type ManagedProcessInputRequest struct {
DataBase64 string `json:"data_base64"`
}
ManagedProcessInputRequest carries base64-encoded process input.
type ManagedProcessInputResponse ¶
type ManagedProcessInputResponse struct {
InputSequence int64 `json:"input_seq"`
}
ManagedProcessInputResponse acknowledges process input.
type ManagedProcessKind ¶
type ManagedProcessKind string
ManagedProcessKind identifies whether a managed process uses pipes or a PTY.
const ( ManagedProcessKindProcess ManagedProcessKind = "process" ManagedProcessKindPTY ManagedProcessKind = "pty" )
Supported managed process execution modes.
type ManagedProcessListResponse ¶
type ManagedProcessListResponse struct {
Processes []ManagedProcess `json:"processes"`
}
ManagedProcessListResponse contains managed processes in a sandbox.
type ManagedProcessOutputWindow ¶
type ManagedProcessOutputWindow struct {
OldestSequence int64 `json:"oldest_seq"`
NewestSequence int64 `json:"newest_seq"`
Bytes int64 `json:"bytes"`
}
ManagedProcessOutputWindow describes retained output sequence bounds.
type ManagedProcessSignal ¶
type ManagedProcessSignal string
ManagedProcessSignal is a signal accepted by the managed process API.
const ( SignalHangup ManagedProcessSignal = "SIGHUP" SignalInterrupt ManagedProcessSignal = "SIGINT" SignalQuit ManagedProcessSignal = "SIGQUIT" SignalKill ManagedProcessSignal = "SIGKILL" SignalTerminate ManagedProcessSignal = "SIGTERM" SignalUserDefined1 ManagedProcessSignal = "SIGUSR1" SignalUserDefined2 ManagedProcessSignal = "SIGUSR2" SignalWindowChange ManagedProcessSignal = "SIGWINCH" )
Signals accepted by ProcessesService.Signal.
type ManagedProcessSignalRequest ¶
type ManagedProcessSignalRequest struct {
Signal ManagedProcessSignal `json:"signal"`
}
ManagedProcessSignalRequest sends a signal to a managed process.
type ManagedProcessState ¶
type ManagedProcessState string
ManagedProcessState is the lifecycle state of a managed process.
const ( ManagedProcessStateStarting ManagedProcessState = "starting" ManagedProcessStateRunning ManagedProcessState = "running" ManagedProcessStateTerminating ManagedProcessState = "terminating" ManagedProcessStateExited ManagedProcessState = "exited" ManagedProcessStateFailed ManagedProcessState = "failed" )
Supported managed process lifecycle states.
type ManagedProcessStream ¶
type ManagedProcessStream string
ManagedProcessStream identifies an output stream.
const ( ManagedProcessStreamStdout ManagedProcessStream = "stdout" ManagedProcessStreamStderr ManagedProcessStream = "stderr" ManagedProcessStreamPTY ManagedProcessStream = "pty" )
Output streams emitted by a managed process connection.
type ManagedProcessWaitOptions ¶
type ManagedProcessWaitOptions struct {
RequestOptions
// Scope selects whether to wait for the leader or the complete process tree.
Scope ManagedProcessWaitScope `json:"-"`
// WaitTimeout is the server-side long-poll timeout. It is distinct from the
// HTTP request timeout in RequestOptions.
WaitTimeout time.Duration `json:"-"`
}
ManagedProcessWaitOptions configures process waiting.
type ManagedProcessWaitScope ¶
type ManagedProcessWaitScope string
ManagedProcessWaitScope selects which process boundary to wait for.
const ( ManagedProcessWaitScopeLeader ManagedProcessWaitScope = "leader" ManagedProcessWaitScopeTree ManagedProcessWaitScope = "tree" )
Process boundaries accepted by ProcessesService.Wait.
type Network ¶
type Network struct {
ID string `json:"id"`
Name string `json:"name"`
CreatedAt time.Time `json:"created_at"`
MemberCount int `json:"member_count,omitempty"`
Members []NetworkMember `json:"members,omitempty"`
}
Network describes an overlay network.
type NetworkCreateRequest ¶
type NetworkCreateRequest struct {
Name string `json:"name"`
}
NetworkCreateRequest creates an overlay network.
type NetworkEntry ¶
type NetworkEntry struct {
// ID is the overlay network identifier.
ID string `json:"id"`
}
NetworkEntry references an overlay network at sandbox creation time.
type NetworkMember ¶
type NetworkMember struct {
SandboxID string `json:"sandbox_id"`
Status string `json:"status"`
IPAddress string `json:"ip,omitempty"`
Name string `json:"name,omitempty"`
}
NetworkMember describes a sandbox attached to an overlay network.
type OKResponse ¶
type OKResponse struct {
OK bool `json:"ok"`
}
OKResponse is a generic successful acknowledgement.
type PTYSize ¶
type PTYSize struct {
// Rows is the terminal height in character cells.
Rows int `json:"rows,omitempty"`
// Cols is the terminal width in character cells.
Cols int `json:"cols,omitempty"`
}
PTYSize specifies terminal dimensions.
type PaginatedResponse ¶
type PaginatedResponse[T any] struct { Data []T `json:"data"` Pagination PaginationMetadata `json:"pagination"` }
PaginatedResponse contains one page of collection data.
type PaginationMetadata ¶
type PaginationMetadata struct {
Total int `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
Count int `json:"count"`
}
PaginationMetadata describes one server-side collection page.
type PaginationOptions ¶
type PaginationOptions struct {
// Limit is the maximum number of items returned. Zero returns all available
// items by walking server-side pages.
Limit int `json:"-"`
// Offset is the zero-based number of items to skip.
Offset int `json:"-"`
}
PaginationOptions configures a paginated collection request.
type PatchSandboxRequest ¶
type PatchSandboxRequest struct {
// IngressEnabled changes ingress when non-nil.
IngressEnabled *bool `json:"ingress_enabled,omitempty"`
// AutoPauseAfterSeconds changes the idle timeout when non-nil.
AutoPauseAfterSeconds *int `json:"auto_pause_after_seconds,omitempty"`
// DisableAutoPause removes the configured idle timeout.
DisableAutoPause bool `json:"disable_auto_pause,omitempty"`
}
PatchSandboxRequest contains mutable sandbox settings.
type ReadyzResponse ¶
type ReadyzResponse struct {
Ready bool `json:"ready"`
Reason string `json:"reason,omitempty"`
SchedulerLastOKMillisecondsAgo int64 `json:"scheduler_last_ok_ms_ago,omitempty"`
}
ReadyzResponse is the control-plane readiness result.
type RechargeBandwidthRequest ¶
type RechargeBandwidthRequest struct {
// AddBytes is the number of quota bytes to add.
AddBytes int64 `json:"add_bytes"`
}
RechargeBandwidthRequest adds bytes to a sandbox bandwidth quota.
type RequestOptions ¶
type RequestOptions struct {
// Headers are added to this request. They override headers with the same
// name supplied by the SDK, except for authentication.
Headers map[string]string `json:"-"`
// Timeout overrides the client's default timeout when greater than zero.
Timeout time.Duration `json:"-"`
// Retry overrides the client's retry policy when non-nil.
Retry *RetryOptions `json:"-"`
// DisableRetry disables retries and takes precedence over Retry.
DisableRetry bool `json:"-"`
}
RequestOptions contains per-request transport overrides.
type ResizeSandboxRequest ¶
type ResizeSandboxRequest struct {
// DiskMiB is the requested total overlay disk size in mebibytes.
DiskMiB int64 `json:"disk_mib"`
}
ResizeSandboxRequest grows a sandbox overlay disk.
type ResizeSandboxResponse ¶
ResizeSandboxResponse reports the sandbox disk size after a grow.
type RetryOptions ¶
type RetryOptions struct {
// MaxRetries is the number of attempts after the initial request. Zero
// disables retries for this request.
MaxRetries int `json:"-"`
// BaseDelay is the initial exponential-backoff delay.
BaseDelay time.Duration `json:"-"`
// MaxDelay caps an individual exponential-backoff delay.
MaxDelay time.Duration `json:"-"`
}
RetryOptions configures exponential-backoff retry behavior.
type RetryReason ¶
type RetryReason string
RetryReason identifies why an HTTP request is retried.
const ( RetryReasonNetwork RetryReason = "network" RetryReasonStatus RetryReason = "status" RetryReasonRateLimit RetryReason = "rate-limit" )
Reasons reported when the transport retries a request.
type RootFSData ¶
type RootFSData struct {
RootFileSystems []string `json:"rootfs"`
Default string `json:"default"`
Entries []RootFSEntry `json:"entries,omitempty"`
}
RootFSData is the built-in root filesystem catalog.
type RootFSEntry ¶
type RootFSEntry struct {
Name string `json:"name"`
Description *string `json:"description,omitempty"`
Deprecated bool `json:"deprecated,omitempty"`
Successor *string `json:"successor,omitempty"`
}
RootFSEntry describes a built-in root filesystem image.
type RotateDiskCredentialsRequest ¶
type RotateDiskCredentialsRequest struct {
Credentials DiskCredentials `json:"credentials"`
}
RotateDiskCredentialsRequest replaces the write-only credentials of a disk.
type RunCommandRequest ¶
type RunCommandRequest struct {
// Command is the executable name or absolute path.
Command string `json:"cmd"`
// Arguments are passed directly to Command without shell expansion.
Arguments []string `json:"args,omitempty"`
// StandardInput is written to the command before execution.
StandardInput string `json:"stdin,omitempty"`
// EnvironmentVariables are added to the command environment.
EnvironmentVariables map[string]string `json:"env,omitempty"`
// Stream requests an NDJSON response and is normally set by StreamCommand.
Stream bool `json:"stream,omitempty"`
}
RunCommandRequest describes a command to execute inside a sandbox.
type RunCommandResponse ¶
type RunCommandResponse struct {
Result CommandResult `json:"result"`
ExecutionMilliseconds float64 `json:"exec_ms"`
}
RunCommandResponse contains a command result and timing.
type SandboxAccessTokenCreateResponse ¶ added in v0.0.6
type SandboxAccessTokenCreateResponse struct {
Token string `json:"token"`
Enabled bool `json:"enabled"`
CreatedAt time.Time `json:"created_at"`
RotatedAt *time.Time `json:"rotated_at,omitempty"`
}
SandboxAccessTokenCreateResponse contains a delegated credential returned only when it is created or rotated. Store Token securely; it cannot be read again through the metadata endpoint.
type SandboxAccessTokenMetadata ¶ added in v0.0.6
type SandboxAccessTokenMetadata struct {
Enabled bool `json:"enabled"`
TokenHint string `json:"token_hint,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
RotatedAt *time.Time `json:"rotated_at,omitempty"`
}
SandboxAccessTokenMetadata contains token state without credential material.
type SandboxDiskView ¶
type SandboxDiskView struct {
DiskID string `json:"disk_id"`
Name string `json:"name"`
Kind DiskKind `json:"kind"`
Config DiskConfig `json:"config"`
MountPath string `json:"mount_path"`
SubPath string `json:"sub_path,omitempty"`
MountStatus DiskMountStatus `json:"mount_status"`
MountError string `json:"mount_error,omitempty"`
}
SandboxDiskView describes one disk attached to a sandbox.
type SandboxResponse ¶
type SandboxResponse struct {
ID string `json:"id"`
Status SandboxStatus `json:"status"`
IPAddress *string `json:"ip,omitempty"`
VCPU int `json:"vcpu"`
MemoryMiB int `json:"mem_mib"`
DiskMiB int64 `json:"disk_mib"`
CreatedAt time.Time `json:"created_at"`
IngressEnabled bool `json:"ingress_enabled"`
IngressURLTemplate string `json:"ingress_url_template,omitempty"`
Name *string `json:"name,omitempty"`
RunningAt *time.Time `json:"running_at,omitempty"`
DestroyedAt *time.Time `json:"destroyed_at,omitempty"`
SpawnMilliseconds float64 `json:"spawn_ms,omitempty"`
Shape string `json:"shape,omitempty"`
RootFS *string `json:"rootfs,omitempty"`
Region string `json:"region,omitempty"`
EgressRules []string `json:"egress,omitempty"`
EnvironmentVariables []string `json:"envs,omitempty"`
SSHPublicKeys []string `json:"ssh_pubkeys,omitempty"`
CreatedBy string `json:"created_by,omitempty"`
BandwidthIngressBytes int64 `json:"bandwidth_ingress_bytes,omitempty"`
PausedAt *time.Time `json:"paused_at,omitempty"`
LastResumedAt *time.Time `json:"last_resumed_at,omitempty"`
ForkedFrom *string `json:"forked_from,omitempty"`
AutoPauseAfterSeconds *int `json:"auto_pause_after_seconds,omitempty"`
}
SandboxResponse is the full server-side projection of a sandbox.
type SandboxStatus ¶
type SandboxStatus string
SandboxStatus is the lifecycle state of a sandbox.
const ( SandboxStatusCreating SandboxStatus = "creating" SandboxStatusRunning SandboxStatus = "running" SandboxStatusPausing SandboxStatus = "pausing" SandboxStatusPaused SandboxStatus = "paused" SandboxStatusResuming SandboxStatus = "resuming" SandboxStatusForking SandboxStatus = "forking" SandboxStatusError SandboxStatus = "error" SandboxStatusDestroying SandboxStatus = "destroying" SandboxStatusDestroyed SandboxStatus = "destroyed" SandboxStatusFailed SandboxStatus = "failed" )
Supported sandbox lifecycle states.
type SetEgressRequest ¶
type SetEgressRequest struct {
// EgressRules is the replacement allowlist. A pointer distinguishes an
// explicitly empty allowlist from an omitted value.
EgressRules *[]string `json:"egress,omitempty"`
}
SetEgressRequest replaces the sandbox egress allowlist.
type Shape ¶
type Shape struct {
ID string `json:"id"`
VCPU int `json:"vcpu"`
MemoryMiB int `json:"mem_mib"`
DefaultDiskMiB int64 `json:"default_disk_mib"`
CPUQuotaPct int `json:"cpu_quota_pct,omitempty"`
}
Shape describes a sandbox CPU, memory, and disk sizing preset.
type TemplateCreateRequest ¶
type TemplateCreateRequest struct {
// Name is the human-readable template name.
Name string `json:"name"`
// Dockerfile contains the Dockerfile source used for the build.
Dockerfile string `json:"dockerfile"`
// Base optionally overrides the base root filesystem.
Base string `json:"base,omitempty"`
}
TemplateCreateRequest describes a Dockerfile template build.
type TemplateInclude ¶
type TemplateInclude string
TemplateInclude identifies optional template detail fields.
const TemplateIncludeDockerfile TemplateInclude = "dockerfile"
TemplateIncludeDockerfile requests the source Dockerfile in template details.
type TemplateLogEvent ¶
type TemplateLogEvent struct {
Timestamp *time.Time `json:"ts,omitempty"`
Level string `json:"level,omitempty"`
Line string `json:"line,omitempty"`
Attempt int `json:"attempt,omitempty"`
Final bool `json:"final,omitempty"`
Status string `json:"status,omitempty"`
Extra map[string]interface{} `json:"-"`
}
TemplateLogEvent is one template build log frame.
type TemplateLogsOptions ¶
type TemplateLogsOptions struct {
RequestOptions
// Attempt selects a build attempt. Zero selects the current attempt.
Attempt int `json:"-"`
}
TemplateLogsOptions filters template build logs.
type TemplateStatus ¶
type TemplateStatus string
TemplateStatus is the build state of a template.
const ( TemplateStatusPending TemplateStatus = "pending" TemplateStatusBuilding TemplateStatus = "building" TemplateStatusReady TemplateStatus = "ready" TemplateStatusFailed TemplateStatus = "failed" )
Supported template build states.
type TemplateView ¶
type TemplateView struct {
ID string `json:"id"`
Name string `json:"name"`
Base string `json:"base"`
Status TemplateStatus `json:"status"`
Ext4SizeBytes int64 `json:"ext4_size_bytes"`
CreatedAt time.Time `json:"created_at"`
BuiltAt *time.Time `json:"built_at,omitempty"`
Dockerfile string `json:"dockerfile,omitempty"`
}
TemplateView describes a custom root filesystem template.
type WaitOptions ¶
type WaitOptions struct {
// Timeout limits status polling. Zero uses the operation's default timeout.
Timeout time.Duration `json:"-"`
// Request configures each status request made while polling.
Request RequestOptions `json:"-"`
}
WaitOptions configures sandbox status polling.
type WhoAmIStatsView ¶
type WhoAmIStatsView struct {
Running int `json:"running"`
Paused int `json:"paused"`
Other int `json:"other"`
Total int `json:"total"`
}
WhoAmIStatsView contains sandbox counts for the calling identity.
type WhoAmIView ¶
type WhoAmIView struct {
UserID string `json:"user_id"`
Stats WhoAmIStatsView `json:"stats"`
}
WhoAmIView describes the authenticated identity.