Documentation
¶
Index ¶
- Constants
- type Empty
- type ExecStep
- type ID
- type Kind
- type PingMessage
- type ResizeArgs
- type ResponseWithFD
- type RestartPolicy
- type RunTarget
- type ShellSpec
- type StagesSpec
- type SupervisedTerminal
- type SupervisorController
- type SupervisorDoc
- type SupervisorMetadata
- type SupervisorMode
- type SupervisorSpec
- type SupervisorStatus
- type SupervisorStatusMode
- type TerminalController
- type TerminalDoc
- type TerminalKind
- type TerminalMetadata
- type TerminalProfileDoc
- type TerminalProfileMetadata
- type TerminalProfileSpec
- type TerminalSpec
- type TerminalState
- type TerminalStatus
- type TerminalStatusMode
- type Version
Constants ¶
View Source
const ( APIVersionV1Beta1 Version = "sbsh/v1beta1" KindTerminalProfile Kind = "TerminalProfile" KindTerminal Kind = "Terminal" KindSupervisor Kind = "Supervisor" )
View Source
const ( RunTargetLocal RunTarget = "local" // current scope; future: "docker", "kubernetes" RestartExit RestartPolicy = "exit" RestartUnlimited RestartPolicy = "restart-unlimited" RestartOnError RestartPolicy = "restart-on-error" )
View Source
const ( TerminalMethodResize = TerminalService + ".Resize" TerminalMethodPing = TerminalService + ".Ping" TerminalMethodAttach = TerminalService + ".Attach" TerminalMethodDetach = TerminalService + ".Detach" TerminalMethodMetadata = TerminalService + ".Metadata" TerminalMethodState = TerminalService + ".State" )
View Source
const (
SupervisorMethodDetach = SupervisorService + ".Detach"
)
View Source
const SupervisorService = "SupervisorController"
View Source
const TerminalService = "TerminalController"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecStep ¶
type ExecStep struct {
Script string `json:"script" yaml:"script"`
Env map[string]string `json:"env,omitempty" yaml:"env,omitempty"`
}
ExecStep runs a command (argv form via cmd + cmdArgs) before the first attach.
type PingMessage ¶ added in v0.1.2
type PingMessage struct {
Message string
}
type ResizeArgs ¶
type ResponseWithFD ¶
type ResponseWithFD struct {
JSON any // what to JSON-encode into "result"
FDs []int // file descriptors to pass via SCM_RIGHTS
}
ResponseWithFD carries a normal JSON result plus OOB file descriptors.
type RestartPolicy ¶
type RestartPolicy string
type ShellSpec ¶
type ShellSpec struct {
Cwd string `json:"cwd,omitempty" yaml:"cwd,omitempty"`
Cmd string `json:"cmd" yaml:"cmd"`
CmdArgs []string `json:"cmdArgs,omitempty" yaml:"cmdArgs,omitempty"`
Env map[string]string `json:"env,omitempty" yaml:"env,omitempty"`
EnvInherit bool `json:"inheritEnv,omitempty" yaml:"inheritEnv,omitempty"`
Prompt string `json:"prompt,omitempty" yaml:"prompt,omitempty"`
}
ShellSpec describes the base interactive process that owns the terminal lifetime.
type StagesSpec ¶
type StagesSpec struct {
OnInit []ExecStep `json:"onInit,omitempty" yaml:"onInit,omitempty"`
PostAttach []ExecStep `json:"postAttach,omitempty" yaml:"postAttach,omitempty"`
}
StagesSpec groups lifecycle hooks. For this schema we only need onInit.
type SupervisedTerminal ¶ added in v0.3.0
type SupervisedTerminal struct {
Spec *TerminalSpec
Command string
CommandArgs []string // for local: ["bash","-i"]; for ssh: ["ssh","-tt","user@host"]
}
type SupervisorController ¶
type SupervisorDoc ¶ added in v0.6.0
type SupervisorDoc struct {
APIVersion Version `json:"apiVersion" yaml:"apiVersion"`
Kind Kind `json:"kind" yaml:"kind"`
Metadata SupervisorMetadata `json:"metadata"`
Spec SupervisorSpec `json:"spec"`
Status SupervisorStatus `json:"status"`
}
type SupervisorMetadata ¶
type SupervisorMode ¶ added in v0.6.0
type SupervisorMode int
const ( RunNewTerminal SupervisorMode = iota AttachToTerminal )
type SupervisorSpec ¶
type SupervisorSpec struct {
ID ID `json:"id"`
LogFile string `json:"logDir"`
SockerCtrl string `json:"socketCtrl"`
RunPath string `json:"runPath"`
// Only valid when SupervisorMode == RunNewTerminal
TerminalSpec *TerminalSpec `json:"terminal,omitempty"`
// DetachKeystroke controls whether the detach keystroke (^] twice) is enabled.
// When true, users can detach by pressing ^] twice. When false, detach keystroke is disabled.
DetachKeystroke bool `json:"detachKeystroke,omitempty"`
// SupervisorMode determines whether the supervisor runs a new terminal or attaches to an existing one.
SupervisorMode SupervisorMode `json:"supervisorMode,omitempty"`
}
type SupervisorStatus ¶
type SupervisorStatus struct {
Pid int `json:"pid"`
BaseRunPath string `json:"baseRunPath"`
SupervisorRunPath string `json:"supervisorRunPath"`
State SupervisorStatusMode `json:"state"`
}
type SupervisorStatusMode ¶ added in v0.1.4
type SupervisorStatusMode int
const ( SupervisorInitializing SupervisorStatusMode = iota SupervisorReady SupervisorAttached SupervisorExiting SupervisorExited )
func (SupervisorStatusMode) String ¶ added in v0.1.4
func (s SupervisorStatusMode) String() string
type TerminalController ¶ added in v0.3.0
type TerminalController interface {
Run(spec *TerminalSpec) error
WaitReady() error
WaitClose() error
Ping(ping *PingMessage) (*PingMessage, error)
Close(reason error) error
Resize(ResizeArgs)
Detach(id *ID) error
Attach(id *ID, reply *ResponseWithFD) error
Metadata() (*TerminalDoc, error)
State() (*TerminalStatusMode, error)
}
type TerminalDoc ¶ added in v0.6.0
type TerminalDoc struct {
APIVersion Version `json:"apiVersion" yaml:"apiVersion"`
Kind Kind `json:"kind" yaml:"kind"`
Metadata TerminalMetadata `json:"metadata"`
Spec TerminalSpec `json:"spec"`
Status TerminalStatus `json:"status"`
}
type TerminalKind ¶ added in v0.3.0
type TerminalKind int
const ( TerminalLocal TerminalKind = iota TerminalSSH )
type TerminalMetadata ¶ added in v0.3.0
type TerminalProfileDoc ¶ added in v0.3.0
type TerminalProfileDoc struct {
APIVersion Version `json:"apiVersion" yaml:"apiVersion"`
Kind Kind `json:"kind" yaml:"kind"`
Metadata TerminalProfileMetadata `json:"metadata" yaml:"metadata"`
Spec TerminalProfileSpec `json:"spec" yaml:"spec"`
}
TerminalProfileDoc models one YAML document containing a TerminalProfile.
type TerminalProfileMetadata ¶ added in v0.3.0
type TerminalProfileSpec ¶ added in v0.3.0
type TerminalProfileSpec struct {
RunTarget RunTarget `json:"runTarget" yaml:"runTarget"`
RestartPolicy RestartPolicy `json:"restartPolicy" yaml:"restartPolicy"`
Shell ShellSpec `json:"shell" yaml:"shell"`
Stages StagesSpec `json:"stages" yaml:"stages"`
}
type TerminalSpec ¶ added in v0.3.0
type TerminalSpec struct {
ID ID `json:"id"`
Kind TerminalKind `json:"kind"`
Name string `json:"name"`
Labels map[string]string `json:"labels"`
Cwd string `json:"cwd,omitempty"`
Command string `json:"command"`
CommandArgs []string `json:"commandArgs"`
EnvInherit bool `json:"inheritEnv"`
Env []string `json:"env"`
Prompt string `json:"prompt"`
SetPrompt bool `json:"setPrompt,omitempty"`
RunPath string `json:"runPath"`
CaptureFile string `json:"captureFile"`
LogFile string `json:"logFile"`
LogLevel string `json:"logLevel"`
SocketFile string `json:"socketIO"`
ProfileName string `json:"profileName"`
Stages StagesSpec `json:"stages"`
}
TerminalSpec defines how to run a terminal.
type TerminalState ¶ added in v0.3.0
type TerminalState int
const (
TerminalBash TerminalState = iota
)
type TerminalStatus ¶ added in v0.3.0
type TerminalStatus struct {
Pid int `json:"pid"`
Tty string `json:"tty"`
State TerminalStatusMode `json:"state"`
SocketFile string `json:"socketCtrl"`
BaseRunPath string `json:"baseRunPath"`
TerminalRunPath string `json:"terminalRunPath"`
LogFile string `json:"logFile"`
LogLevel string `json:"logLevel"`
CaptureFile string `json:"captureFile"`
Attachers []string `json:"attachers"`
}
type TerminalStatusMode ¶ added in v0.3.0
type TerminalStatusMode int
const ( // Initializing internal state and server startup. Initializing TerminalStatusMode = iota // Starting PTY and command execution. Starting // SettingUp shell environment. SettingUp // OnInit waiting for shell to be initialized. OnInit // Ready terminal is fully initialized and ready for use. Ready // PostAttach waiting for shell to be attached. PostAttach // Exited terminal has exited. Exited )
func (TerminalStatusMode) String ¶ added in v0.3.0
func (s TerminalStatusMode) String() string
Click to show internal directories.
Click to hide internal directories.