Documentation
¶
Index ¶
- Constants
- Variables
- func AddProvider(devsyConfig *config.Config, providerName, providerSourceRaw string) (*provider.ProviderConfig, error)
- func AddProviderRaw(p ProviderParams) (*provider.ProviderConfig, error)
- func CheckProviderUpdate(devsyConfig *config.Config, proInstance *provider2.ProInstance) error
- func Delete(ctx context.Context, opts DeleteOptions) (string, error)
- func Exists(ctx context.Context, devsyConfig *config.Config, args []string, ...) string
- func FindProviderProInstance(proInstances []*provider2.ProInstance, providerName string) (*provider2.ProInstance, bool)
- func Get(ctx context.Context, opts GetOptions) (client.BaseWorkspaceClient, error)
- func GetMachine(devsyConfig *config.Config, args []string) (client.MachineClient, error)
- func GetProInstance(devsyConfig *config.Config, providerName string) *provider2.ProInstance
- func List(ctx context.Context, devsyConfig *config.Config, skipPro bool, ...) ([]*providerpkg.Workspace, error)
- func ListLocalWorkspaces(contextName string, skipPro bool) ([]*providerpkg.Workspace, error)
- func ListMachines(devsyConfig *config.Config) ([]*providerpkg.Machine, error)
- func ListProInstances(devsyConfig *config.Config) ([]*provider2.ProInstance, error)
- func LoadAllProviders(devsyConfig *config.Config) (map[string]*ProviderWithOptions, error)
- func MachineExists(devsyConfig *config.Config, args []string) string
- func MoveProvider(devsyConfig *config.Config, oldName, newName string) error
- func ProviderFromHost(ctx context.Context, devsyConfig *config.Config, proHost string) (*provider.ProviderConfig, error)
- func Rename(ctx context.Context, opts RenameOptions) error
- func Resolve(ctx context.Context, devsyConfig *config.Config, params ResolveParams) (client.BaseWorkspaceClient, error)
- func ResolveMachine(devsyConfig *config.Config, args []string, userOptions []string) (client.Client, error)
- func ResolveProvider(providerSource string) ([]byte, *provider.ProviderSource, error)
- func ResolveProviderSource(devsyConfig *config.Config, providerName string) (string, error)
- func SingleMachineName(devsyConfig *config.Config, provider string) string
- func SwitchProvider(ctx context.Context, devsyConfig *config.Config, workspace *provider.Workspace, ...) error
- func ToID(str string) string
- func UpdateProvider(devsyConfig *config.Config, providerName, providerSourceRaw string) (*provider.ProviderConfig, error)
- type DeleteOptions
- type GetOptions
- type ProviderParams
- type ProviderWithOptions
- func CloneProvider(devsyConfig *config.Config, providerName, providerSourceRaw string) (*ProviderWithOptions, error)
- func FindProvider(devsyConfig *config.Config, name string) (*ProviderWithOptions, error)
- func LoadProviders(devsyConfig *config.Config) (*ProviderWithOptions, map[string]*ProviderWithOptions, error)
- type RemoteCreator
- type RenameOptions
- type ResolveParams
Constants ¶
const ProjectLabel = "devsy.sh/project"
Variables ¶
var ErrNoWorkspaceFound = errors.New("no workspace found")
Functions ¶
func AddProvider ¶
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 ¶
func Get(ctx context.Context, opts GetOptions) (client.BaseWorkspaceClient, error)
Get tries to retrieve an already existing workspace.
func GetMachine ¶
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 ¶
MachineExists checks if the given workspace already exists.
func MoveProvider ¶
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 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 ResolveProvider ¶
func ResolveProvider( providerSource string, ) ([]byte, *provider.ProviderSource, error)
func ResolveProviderSource ¶
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 UpdateProvider ¶
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 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
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.