client

package
v0.7.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: MPL-2.0 Imports: 7 Imported by: 34

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseClient added in v0.2.0

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 added in v0.2.0

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, options CreateOptions) error

	// Start starts the workspace
	Start(ctx context.Context, options StartOptions) 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 CreateOptions

type CreateOptions struct{}

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)

	// 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 {
	IgnoreNotFound bool   `json:"ignoreNotFound,omitempty"`
	Force          bool   `json:"force,omitempty"`
	GracePeriod    string `json:"gracePeriod,omitempty"`
}

type ImportWorkspaceOptions added in v0.3.5

type ImportWorkspaceOptions map[string]string

type InitOptions

type InitOptions struct{}

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 deprecated added in v0.2.0

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

Deprecated: Use DaemonClient instead

type SshOptions added in v0.2.0

type SshOptions struct {
	User string

	Stdin  io.Reader
	Stdout io.Writer
}

type StartOptions

type StartOptions struct{}

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{}

type UpOptions added in v0.2.0

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 ValidateOptions

type ValidateOptions struct{}

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 added in v0.2.0

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