Help us shape the future of Go! Take the 2026 Go Developer Survey

client

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MPL-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	StatusRunning  = "Running"
	StatusBusy     = "Busy"
	StatusStopped  = "Stopped"
	StatusNotFound = "NotFound"
)
View Source
const (
	DescriptionNotFound = "{}"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseClient

type BaseClient interface {
	// Provider returns the name of the provider
	Provider() string

	// Context returns the context of the provider
	Context() string

	// RefreshOptions updates the options
	RefreshOptions(ctx context.Context, userOptions []string, reconfigure bool) error

	// Status retrieves the workspace status
	Status(ctx context.Context, options StatusOptions) (Status, error)

	// Stop stops the workspace
	Stop(ctx context.Context, options StopOptions) error

	// Delete deletes the workspace
	Delete(ctx context.Context, options DeleteOptions) error
}

type BaseWorkspaceClient

type BaseWorkspaceClient interface {
	BaseClient

	// Workspace returns the workspace of this provider
	Workspace() string

	// WorkspaceConfig returns the workspace config
	WorkspaceConfig() *provider.Workspace

	// Lock locks the workspace. This is a file lock, which means
	// the workspace is locked across processes.
	Lock(ctx context.Context) error

	// Unlock unlocks the workspace.
	Unlock()
}

type Client

type Client interface {
	BaseClient

	// AgentLocal returns if the agent runs locally
	AgentLocal() bool

	// AgentPath returns the agent path
	AgentPath() string

	// AgentURL returns the agent download url
	AgentURL() string

	// Create creates a new workspace
	Create(ctx context.Context) error

	// Describe retrieves the virtual machine description
	Describe(ctx context.Context) (string, error)

	// Start starts the workspace
	Start(ctx context.Context) error

	// Command creates an SSH tunnel into the workspace
	Command(ctx context.Context, options CommandOptions) error
}

type CommandOptions

type CommandOptions struct {
	Command string
	Stdin   io.Reader
	Stdout  io.Writer
	Stderr  io.Writer
}

type DaemonClient

type DaemonClient interface {
	BaseWorkspaceClient

	// Create creates a new remote workspace
	Create(ctx context.Context, stdin io.Reader, stdout io.Writer, stderr io.Writer) error

	// Up start a new remote workspace
	Up(ctx context.Context, options UpOptions) (*config.Result, error)

	// SSHClients returns an SSH client for the tool and one for the actual user
	SSHClients(ctx context.Context, user string) (*ssh.Client, *ssh.Client, error)

	// CheckWorkspaceReachable checks if the given workspace is reachable from the current machine
	CheckWorkspaceReachable(ctx context.Context) error

	// DirectTunnel forwards stdio to the workspace
	DirectTunnel(ctx context.Context, stdin io.Reader, stdout io.Writer) error

	// Ping tries to ping a workspace and prints results to stdout
	Ping(ctx context.Context, stdout io.Writer) error
}

DaemonClient connects to workspaces through a shared daemon.

type DeleteOptions

type DeleteOptions struct {
	Platform devsy.PlatformOptions `json:"platform"`

	IgnoreNotFound bool   `json:"ignoreNotFound,omitempty"`
	Force          bool   `json:"force,omitempty"`
	GracePeriod    string `json:"gracePeriod,omitempty"`
	RemoveVolumes  bool   `json:"removeVolumes,omitempty"`
}

type MachineClient

type MachineClient interface {
	Client

	// Machine returns the machine of this client
	Machine() string

	// MachineConfig returns the machine config
	MachineConfig() *provider.Machine
}

type ProxyClient

type ProxyClient interface {
	BaseWorkspaceClient

	// Create creates a new remote workspace
	Create(ctx context.Context, stdin io.Reader, stdout io.Writer, stderr io.Writer) error

	// Up creates a new remote workspace
	Up(ctx context.Context, options UpOptions) error

	// Ssh starts an ssh tunnel to the workspace container
	Ssh(ctx context.Context, options SshOptions) error
}

ProxyClient executes it's commands on the platform.

type SshOptions

type SshOptions struct {
	User string

	Stdin  io.Reader
	Stdout io.Writer
}

type Status

type Status string

func ParseStatus

func ParseStatus(in string) (Status, error)

type StatusOptions

type StatusOptions struct {
	ContainerStatus bool `json:"containerStatus,omitempty"`
}

type StopOptions

type StopOptions struct {
	Platform devsy.PlatformOptions `json:"platform"`
}

type UpOptions

type UpOptions struct {
	provider.CLIOptions

	Debug bool

	Stdin  io.Reader
	Stdout io.Writer
}

type User

type User struct {
	Name string `json:"name,omitempty"`
	UID  string `json:"uid,omitempty"`
}

type WorkspaceClient

type WorkspaceClient interface {
	BaseWorkspaceClient
	Client

	// AgentInjectGitCredentials returns if the credentials helper should get injected
	AgentInjectGitCredentials(options provider.CLIOptions) bool

	// AgentInjectDockerCredentials returns if the credentials helper should get injected
	AgentInjectDockerCredentials(options provider.CLIOptions) bool

	// AgentInfo returns the info to send to the agent
	AgentInfo(options provider.CLIOptions) (string, *provider.AgentWorkspaceInfo, error)
}

type WorkspaceStatus

type WorkspaceStatus struct {
	ID       string `json:"id,omitempty"`
	Context  string `json:"context,omitempty"`
	Provider string `json:"provider,omitempty"`
	State    string `json:"state,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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