workspace

package
v1.3.0-rc.18 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: MPL-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const ProjectLabel = "devsy.sh/project"

Variables

View Source
var ErrNoWorkspaceFound = errors.New("no workspace found")

Functions

func AddProvider

func AddProvider(
	devsyConfig *config.Config,
	providerName, providerSourceRaw string,
) (*provider.ProviderConfig, error)

func AddProviderRaw

func AddProviderRaw(p ProviderParams) (*provider.ProviderConfig, error)

func CheckProviderUpdate

func CheckProviderUpdate(
	devsyConfig *config.Config,
	proInstance *provider2.ProInstance,
) error

CheckProviderUpdate currently only ensures the local provider is in sync with the remote for Devsy Pro instances. Potentially auto-upgrade other providers in the future.

func Delete

func Delete(ctx context.Context, opts DeleteOptions) (string, error)

Delete deletes a workspace, handling imported workspaces, single-machine cleanup, and force-deletion of broken workspaces.

func Exists

func Exists(
	ctx context.Context,
	devsyConfig *config.Config,
	args []string,
	workspaceID string,
	owner platform.OwnerFilter,
) string

Exists checks if the given workspace already exists.

func FindProviderProInstance

func FindProviderProInstance(
	proInstances []*provider2.ProInstance,
	providerName string,
) (*provider2.ProInstance, bool)

func Get

Get tries to retrieve an already existing workspace.

func GetMachine

func GetMachine(
	devsyConfig *config.Config,
	args []string,
) (client.MachineClient, error)

GetMachine creates a machine client.

func GetProInstance

func GetProInstance(
	devsyConfig *config.Config,
	providerName string,
) *provider2.ProInstance

GetProInstance returns the ProInstance associated with the given provider name, or nil if not found.

func List

func List(
	ctx context.Context,
	devsyConfig *config.Config,
	skipPro bool,
	owner platform.OwnerFilter,
) ([]*providerpkg.Workspace, error)

func ListLocalWorkspaces

func ListLocalWorkspaces(
	contextName string,
	skipPro bool,
) ([]*providerpkg.Workspace, error)

func ListMachines

func ListMachines(devsyConfig *config.Config) ([]*providerpkg.Machine, error)

ListMachines returns all machines configured in the given Devsy context.

func ListProInstances

func ListProInstances(
	devsyConfig *config.Config,
) ([]*provider2.ProInstance, error)

func LoadAllProviders

func LoadAllProviders(
	devsyConfig *config.Config,
) (map[string]*ProviderWithOptions, error)

func MachineExists

func MachineExists(devsyConfig *config.Config, args []string) string

MachineExists checks if the given workspace already exists.

func MoveProvider

func MoveProvider(devsyConfig *config.Config, oldName, newName string) error

MoveProvider renames a provider's directory on disk and migrates its state in config.json. This preserves all options, initialized flag, and other state that CloneProvider would lose.

func ProviderFromHost

func ProviderFromHost(
	ctx context.Context,
	devsyConfig *config.Config,
	proHost string,
) (*provider.ProviderConfig, error)

func Rename added in v1.3.0

func Rename(ctx context.Context, opts RenameOptions) error

Rename performs the workspace rename: auto-stops if running, moves the workspace directory, updates the config ID, and removes the old SSH config entry. If any step after the directory move fails, the entire operation is rolled back.

func Resolve

func Resolve(
	ctx context.Context,
	devsyConfig *config.Config,
	params ResolveParams,
) (client.BaseWorkspaceClient, error)

func ResolveMachine

func ResolveMachine(
	devsyConfig *config.Config,
	args []string,
	userOptions []string,
) (client.Client, error)

func ResolveProvider

func ResolveProvider(
	providerSource string,
) ([]byte, *provider.ProviderSource, error)

func ResolveProviderSource

func ResolveProviderSource(
	devsyConfig *config.Config,
	providerName string,
) (string, error)

func SingleMachineName

func SingleMachineName(devsyConfig *config.Config, provider string) string

func SwitchProvider

func SwitchProvider(
	ctx context.Context,
	devsyConfig *config.Config,
	workspace *provider.Workspace,
	newProviderName string,
) error

SwitchProvider updates the provider name for the given workspace with client locking. It persists the new provider name before resolving the client so that FindProvider can locate the already-renamed provider directory.

func ToID

func ToID(str string) string

func UpdateProvider

func UpdateProvider(
	devsyConfig *config.Config,
	providerName, providerSourceRaw string,
) (*provider.ProviderConfig, error)

Types

type DeleteOptions

type DeleteOptions struct {
	DevsyConfig    *config.Config
	Args           []string
	IgnoreNotFound bool
	Force          bool
	ClientDelete   client2.DeleteOptions
	Owner          platform.OwnerFilter
}

DeleteOptions holds the parameters for deleting a workspace.

type GetOptions

type GetOptions struct {
	DevsyConfig    *config.Config
	Args           []string
	ChangeLastUsed bool
	Owner          platform.OwnerFilter
	LocalOnly      bool
}

GetOptions holds the parameters for retrieving an existing workspace.

type ProviderParams

type ProviderParams struct {
	DevsyConfig  *config.Config
	ProviderName string
	Raw          []byte
	Source       *provider.ProviderSource
}

type ProviderWithOptions

type ProviderWithOptions struct {
	Config *provider.ProviderConfig `json:"config,omitempty"`
	State  *config.ProviderConfig   `json:"state,omitempty"`
}

func CloneProvider

func CloneProvider(
	devsyConfig *config.Config,
	providerName, providerSourceRaw string,
) (*ProviderWithOptions, error)

func FindProvider

func FindProvider(
	devsyConfig *config.Config,
	name string,
) (*ProviderWithOptions, error)

func LoadProviders

func LoadProviders(
	devsyConfig *config.Config,
) (*ProviderWithOptions, map[string]*ProviderWithOptions, error)

LoadProviders loads all known providers for the given context.

type RemoteCreator

type RemoteCreator interface {
	Create(ctx context.Context, stdin io.Reader, stdout, stderr io.Writer) error
}

RemoteCreator defines the interface for clients that support remote workspace creation. This interface is implemented by ProxyClient and DaemonClient to enable workspace creation on remote platforms.

type RenameOptions added in v1.3.0

type RenameOptions struct {
	DevsyConfig *config.Config
	OldName     string
	NewName     string
}

RenameOptions holds parameters for renaming a workspace.

type ResolveParams

type ResolveParams struct {
	IDE                  string
	IDEOptions           []string
	Args                 []string
	DesiredID            string
	DesiredMachine       string
	ProviderUserOptions  []string
	ReconfigureProvider  bool
	DevContainerImage    string
	DevContainerPath     string
	SSHConfigPath        string
	SSHConfigIncludePath string
	Source               *providerpkg.WorkspaceSource
	UID                  string
	ChangeLastUsed       bool
	Owner                platform.OwnerFilter
}

Resolve takes the `devsy up|build` CLI input and either finds an existing workspace or creates a new one.

Jump to

Keyboard shortcuts

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