provider

package
v0.6.2-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MPL-2.0 Imports: 22 Imported by: 6

Documentation

Index

Constants

View Source
const (
	WorkspaceConfigFile   = "workspace.json"
	WorkspaceResultFile   = "workspace_result.json"
	MachineConfigFile     = "machine.json"
	ProInstanceConfigFile = "pro.json"
	ProviderConfigFile    = "provider.json"
)
View Source
const (
	// general
	DEVPOD      = "DEVPOD"
	DEVPOD_OS   = "DEVPOD_OS"
	DEVPOD_ARCH = "DEVPOD_ARCH"

	// workspace
	WORKSPACE_ID       = "WORKSPACE_ID"
	WORKSPACE_UID      = "WORKSPACE_UID"
	WORKSPACE_PICTURE  = "WORKSPACE_PICTURE"
	WORKSPACE_FOLDER   = "WORKSPACE_FOLDER"
	WORKSPACE_CONTEXT  = "WORKSPACE_CONTEXT"
	WORKSPACE_ORIGIN   = "WORKSPACE_ORIGIN"
	WORKSPACE_SOURCE   = "WORKSPACE_SOURCE"
	WORKSPACE_PROVIDER = "WORKSPACE_PROVIDER"

	// machine
	MACHINE_ID       = "MACHINE_ID"
	MACHINE_CONTEXT  = "MACHINE_CONTEXT"
	MACHINE_FOLDER   = "MACHINE_FOLDER"
	MACHINE_PROVIDER = "MACHINE_PROVIDER"

	// provider
	PROVIDER_ID      = "PROVIDER_ID"
	PROVIDER_CONTEXT = "PROVIDER_CONTEXT"
	PROVIDER_FOLDER  = "PROVIDER_FOLDER"

	// pro
	LOFT_PROJECT         = "LOFT_PROJECT"
	LOFT_FILTER_BY_OWNER = "LOFT_FILTER_BY_OWNER"
)
View Source
const (
	DockerDriver = "docker"
	CustomDriver = "custom"
)
View Source
const (
	CommandEnv = "COMMAND"
)
View Source
const (
	DEVCONTAINER_ID = "DEVCONTAINER_ID"
)

Variables

View Source
var (
	WorkspaceSourceGit       = "git:"
	WorkspaceSourceLocal     = "local:"
	WorkspaceSourceImage     = "image:"
	WorkspaceSourceContainer = "container:"
)
View Source
var ProviderNameRegEx = regexp.MustCompile(`[^a-z0-9\-]+`)

Functions

func CombineOptions

func CombineOptions(workspace *Workspace, machine *Machine, options map[string]config.OptionValue) map[string]config.OptionValue

func GetBaseEnvironment

func GetBaseEnvironment(context, provider string) map[string]string

func GetLocksDir added in v0.1.10

func GetLocksDir(context string) (string, error)

func GetMachineDir

func GetMachineDir(context, machineID string) (string, error)

func GetMachinesDir

func GetMachinesDir(context string) (string, error)

func GetProInstanceDir added in v0.3.5

func GetProInstanceDir(context, proInstanceHost string) (string, error)

func GetProInstancesDir added in v0.3.5

func GetProInstancesDir(context string) (string, error)

func GetProviderBinariesDir

func GetProviderBinariesDir(context, providerName string) (string, error)

func GetProviderDir

func GetProviderDir(context, providerName string) (string, error)

func GetProviderOptions

func GetProviderOptions(workspace *Workspace, server *Machine, devConfig *config.Config) map[string]config.OptionValue

func GetProvidersDir

func GetProvidersDir(context string) (string, error)

func GetWorkspaceDir

func GetWorkspaceDir(context, workspaceID string) (string, error)

func GetWorkspacesDir

func GetWorkspacesDir(context string) (string, error)

func LoadWorkspaceResult added in v0.5.0

func LoadWorkspaceResult(context, workspaceID string) (*config2.Result, error)

func MachineExists

func MachineExists(context, machineID string) bool

func Merge

func Merge(m1 map[string]string, m2 map[string]string) map[string]string

func ParseOptions

func ParseOptions(options []string) (map[string]string, error)

func ProInstanceExists added in v0.3.5

func ProInstanceExists(context, proInstanceID string) bool

func ProviderExists added in v0.5.0

func ProviderExists(context, provider string) bool

func SaveMachineConfig

func SaveMachineConfig(machine *Machine) error

func SaveProInstanceConfig added in v0.3.5

func SaveProInstanceConfig(context string, proInstance *ProInstance) error

func SaveProviderConfig

func SaveProviderConfig(context string, provider *ProviderConfig) error

func SaveWorkspaceConfig

func SaveWorkspaceConfig(workspace *Workspace) error

func SaveWorkspaceResult added in v0.5.0

func SaveWorkspaceResult(workspace *Workspace, result *config2.Result) error

func ToEnvironment

func ToEnvironment(workspace *Workspace, machine *Machine, options map[string]config.OptionValue, extraEnv map[string]string) []string

func ToOptions

func ToOptions(workspace *Workspace, machine *Machine, options map[string]config.OptionValue) map[string]string

func ToOptionsMachine

func ToOptionsMachine(machine *Machine) map[string]string

func ToOptionsWorkspace

func ToOptionsWorkspace(workspace *Workspace) map[string]string

func ToProInstanceID added in v0.3.5

func ToProInstanceID(url string) string

func WorkspaceExists

func WorkspaceExists(context, workspaceID string) bool

Types

type AgentWorkspaceInfo

type AgentWorkspaceInfo struct {
	// WorkspaceOrigin is the path where this workspace config originated from
	WorkspaceOrigin string `json:"workspaceOrigin,omitempty"`

	// Workspace holds the workspace info
	Workspace *Workspace `json:"workspace,omitempty"`

	// LastDevContainerConfig can be used as a fallback if the workspace was already started
	// and we lost track of the devcontainer.json
	LastDevContainerConfig *devcontainerconfig.DevContainerConfigWithPath `json:"lastDevContainerConfig,omitempty"`

	// Machine holds the machine info
	Machine *Machine `json:"machine,omitempty"`

	// Agent holds the agent info
	Agent ProviderAgentConfig `json:"agent,omitempty"`

	// CLIOptions holds the cli options
	CLIOptions CLIOptions `json:"cliOptions,omitempty"`

	// Options holds the filled provider options for this workspace
	Options map[string]config.OptionValue `json:"options,omitempty"`

	// ContentFolder holds the folder where the content is stored
	ContentFolder string `json:"contentFolder,omitempty"`

	// Origin holds the folder where this config was loaded from
	Origin string `json:"-"`

	// InjectTimeout specifies how long to wait for the agent to be injected into the dev container
	InjectTimeout time.Duration `json:"injectTimeout,omitempty"`

	// RegistryCache defines the registry to use for caching builds
	RegistryCache string `json:"registryCache,omitempty"`
}

func CloneAgentWorkspaceInfo added in v0.3.0

func CloneAgentWorkspaceInfo(agentWorkspaceInfo *AgentWorkspaceInfo) *AgentWorkspaceInfo

type BuildOptions added in v0.5.0

type BuildOptions struct {
	CLIOptions

	Platform      string
	RegistryCache string
	ExportCache   bool
	NoBuild       bool
}

type CLIOptions added in v0.3.0

type CLIOptions struct {
	// up options
	flags.GitCredentialsFlags `json:",inline"`
	ID                        string            `json:"id,omitempty"`
	Source                    string            `json:"source,omitempty"`
	IDE                       string            `json:"ide,omitempty"`
	IDEOptions                []string          `json:"ideOptions,omitempty"`
	PrebuildRepositories      []string          `json:"prebuildRepositories,omitempty"`
	DevContainerImage         string            `json:"devContainerImage,omitempty"`
	DevContainerPath          string            `json:"devContainerPath,omitempty"`
	DevContainerSource        string            `json:"devContainerSource,omitempty"`
	EnvironmentTemplate       string            `json:"environmentTemplate,omitempty"`
	WorkspaceEnv              []string          `json:"workspaceEnv,omitempty"`
	WorkspaceEnvFile          []string          `json:"workspaceEnvFile,omitempty"`
	InitEnv                   []string          `json:"initEnv,omitempty"`
	Recreate                  bool              `json:"recreate,omitempty"`
	Reset                     bool              `json:"reset,omitempty"`
	Proxy                     bool              `json:"proxy,omitempty"`
	DisableDaemon             bool              `json:"disableDaemon,omitempty"`
	DaemonInterval            string            `json:"daemonInterval,omitempty"`
	ForceCredentials          bool              `json:"forceCredentials,omitempty"`
	GitCloneStrategy          git.CloneStrategy `json:"gitCloneStrategy,omitempty"`
	FallbackImage             string            `json:"fallbackImage,omitempty"`
	GitSSHSigningKey          string            `json:"gitSshSigningKey,omitempty"`

	// build options
	Repository string   `json:"repository,omitempty"`
	SkipPush   bool     `json:"skipPush,omitempty"`
	Platform   []string `json:"platform,omitempty"`

	ForceBuild            bool   `json:"forceBuild,omitempty"`
	ForceDockerless       bool   `json:"forceDockerless,omitempty"`
	ForceInternalBuildKit bool   `json:"forceInternalBuildKit,omitempty"`
	SSHKey                string `json:"sshkey,omitempty"`
}

type ContainerWorkspaceInfo added in v0.4.0

type ContainerWorkspaceInfo struct {
	// IDE holds the ide config options
	IDE WorkspaceIDEConfig `json:"ide,omitempty"`

	// CLIOptions holds the cli options
	CLIOptions CLIOptions `json:"cliOptions,omitempty"`

	// Dockerless holds custom dockerless configuration
	Dockerless ProviderDockerlessOptions `json:"dockerless,omitempty"`

	// ContainerTimeout is the timeout in minutes to wait until the agent tries
	// to delete the container.
	ContainerTimeout string `json:"containerInactivityTimeout,omitempty"`

	// Source is a WorkspaceSource to be used inside the container
	Source WorkspaceSource `json:"source,omitempty"`

	// ContentFolder holds the folder where the content is stored
	ContentFolder string `json:"contentFolder,omitempty"`

	// PullFromInsideContainer determines if project should be pulled from Source when container starts
	PullFromInsideContainer types.StrBool `json:"pullFromInsideContainer,omitempty"`

	// Agent holds the agent info
	Agent ProviderAgentConfig `json:"agent,omitempty"`
}

type CreateProxyCommands added in v0.6.0

type CreateProxyCommands struct {
	// Workspace creates a workspace instance
	Workspace types.StrArray `json:"workspace,omitempty"`
}

type ExportConfig added in v0.5.0

type ExportConfig struct {
	// Workspace is the workspace that was exported
	Workspace *ExportWorkspaceConfig `json:"workspace,omitempty"`

	// Machine is the machine that was exported
	Machine *ExportMachineConfig `json:"machine,omitempty"`

	// Provider is the provider that was exported
	Provider *ExportProviderConfig `json:"provider,omitempty"`
}

type ExportMachineConfig added in v0.5.0

type ExportMachineConfig struct {
	// ID is the machine id
	ID string `json:"id,omitempty"`

	// Context is the machine context
	Context string `json:"context,omitempty"`

	// Data is the machine folder data
	Data string `json:"data,omitempty"`
}

func ExportMachine added in v0.5.0

func ExportMachine(context, machineID string) (*ExportMachineConfig, error)

type ExportProviderConfig added in v0.5.0

type ExportProviderConfig struct {
	// ID is the provider id
	ID string `json:"id,omitempty"`

	// Context is the provider context
	Context string `json:"context,omitempty"`

	// Data is the provider folder data
	Data string `json:"data,omitempty"`

	// Config is the provider config within the config.yaml
	Config *config.ProviderConfig `json:"config,omitempty"`
}

func ExportProvider added in v0.5.0

func ExportProvider(devPodConfig *config.Config, context, providerID string) (*ExportProviderConfig, error)

type ExportWorkspaceConfig added in v0.5.0

type ExportWorkspaceConfig struct {
	// ID is the workspace id
	ID string `json:"id,omitempty"`

	// Context is the workspace context
	Context string `json:"context,omitempty"`

	// UID is used to identify this specific workspace
	UID string `json:"uid,omitempty"`

	// Data is the workspace folder data
	Data string `json:"data,omitempty"`
}

func ExportWorkspace added in v0.5.0

func ExportWorkspace(context, workspaceID string) (*ExportWorkspaceConfig, error)

type GetProxyCommands added in v0.6.0

type GetProxyCommands struct {
	// Workspace gets a workspace instance
	Workspace types.StrArray `json:"workspace,omitempty"`

	// Self gets self for this provider
	Self types.StrArray `json:"self,omitempty"`

	// Version gets the for this pro instance
	Version types.StrArray `json:"version,omitempty"`
}

type ListProxyCommands added in v0.6.0

type ListProxyCommands struct {
	// Workspaces lists all workspaces
	Workspaces types.StrArray `json:"workspaces,omitempty"`

	// Projects lists all projects
	Projects types.StrArray `json:"projects,omitempty"`

	// Templates lists all templates in a project
	Templates types.StrArray `json:"templates,omitempty"`

	// Clusters lists all clusters and runners in a project
	Clusters types.StrArray `json:"clusters,omitempty"`
}

type Machine

type Machine struct {
	// ID is the machine id to use
	ID string `json:"id,omitempty"`

	// Provider is the provider used to create this workspace
	Provider MachineProviderConfig `json:"provider,omitempty"`

	// CreationTimestamp is the timestamp when this workspace was created
	CreationTimestamp types.Time `json:"creationTimestamp,omitempty"`

	// Context is the context where this config file was loaded from
	Context string `json:"context,omitempty"`

	// Origin is the place where this config file was loaded from
	Origin string `json:"-"`
}

func CloneMachine

func CloneMachine(server *Machine) *Machine

func LoadMachineConfig

func LoadMachineConfig(context, machineID string) (*Machine, error)

type MachineProviderConfig

type MachineProviderConfig struct {
	// Name is the provider name used to deploy this machine
	Name string `json:"name,omitempty"`

	// Options are the local options that override the global ones
	Options map[string]config.OptionValue `json:"options,omitempty"`
}

type ProInstance added in v0.3.5

type ProInstance struct {
	// Provider is the provider name this pro instance belongs to
	Provider string `json:"provider,omitempty"`

	// Host is the Loft DevPod Pro host to use
	Host string `json:"host,omitempty"`

	// CreationTimestamp is the timestamp when this pro instance was created
	CreationTimestamp types.Time `json:"creationTimestamp,omitempty"`
}

func LoadProInstanceConfig added in v0.3.5

func LoadProInstanceConfig(context, proInstanceHost string) (*ProInstance, error)

type ProMetadata added in v0.6.0

type ProMetadata struct {
	// Project is the platform project the workspace lives in
	Project string `json:"project,omitempty"`

	// DisplayName is the name intended to show users
	DisplayName string `json:"displayName,omitempty"`
}

type ProviderAgentConfig

type ProviderAgentConfig struct {
	// Local defines if DevPod is running locally
	Local types.StrBool `json:"local,omitempty"`

	// Path is the binary path inside the server devpod will expect the agent binary
	Path string `json:"path,omitempty"`

	// DataPath is the agent path where data is stored
	DataPath string `json:"dataPath,omitempty"`

	// DownloadURL is the base url where to download the agent from
	DownloadURL string `json:"downloadURL,omitempty"`

	// Timeout is the timeout in minutes to wait until the agent tries
	// to turn of the server.
	Timeout string `json:"inactivityTimeout,omitempty"`

	// ContainerTimeout is the timeout in minutes to wait until the agent tries
	// to delete the container.
	ContainerTimeout string `json:"containerInactivityTimeout,omitempty"`

	// InjectGitCredentials signals DevPod if git credentials should get synced into
	// the remote machine for cloning the repository.
	InjectGitCredentials types.StrBool `json:"injectGitCredentials,omitempty"`

	// InjectDockerCredentials signals DevPod if docker credentials should get synced
	// into the remote machine for pulling and pushing images.
	InjectDockerCredentials types.StrBool `json:"injectDockerCredentials,omitempty"`

	// Exec commands that can be used on the remote
	Exec ProviderAgentConfigExec `json:"exec,omitempty"`

	// Binaries is an optional field to specify a binary to execute the commands
	Binaries map[string][]*ProviderBinary `json:"binaries,omitempty"`

	// Dockerless holds custom dockerless configuration
	Dockerless ProviderDockerlessOptions `json:"dockerless,omitempty"`

	// Driver is the driver to use for deploying the devcontainer. Currently supports
	// docker (default) or kubernetes (experimental)
	Driver string `json:"driver,omitempty"`

	// Docker holds docker specific configuration
	Docker ProviderDockerDriverConfig `json:"docker,omitempty"`

	// Custom holds custom driver specific configuration
	Custom ProviderCustomDriverConfig `json:"custom,omitempty"`
}

func (ProviderAgentConfig) IsDockerDriver added in v0.4.0

func (a ProviderAgentConfig) IsDockerDriver() bool

type ProviderAgentConfigExec

type ProviderAgentConfigExec struct {
	// Shutdown is the remote command to run when the remote machine
	// should shutdown.
	Shutdown types.StrArray `json:"shutdown,omitempty"`
}

type ProviderBinary

type ProviderBinary struct {
	// The current OS
	OS string `json:"os,omitempty"`

	// The current Arch
	Arch string `json:"arch,omitempty"`

	// Checksum is the sha256 hash of the binary
	Checksum string `json:"checksum,omitempty"`

	// Path is the binary url to download from or relative path to use
	Path string `json:"path,omitempty"`

	// ArchivePath is the path within the archive to extract
	ArchivePath string `json:"archivePath,omitempty"`

	// Name is the name of the binary to store locally
	Name string `json:"name,omitempty"`
}

type ProviderCommands

type ProviderCommands struct {
	// Init is run directly after `devpod provider use`
	Init types.StrArray `json:"init,omitempty"`

	// Command executes a command on the server
	Command types.StrArray `json:"command,omitempty"`

	// Create creates a new server
	Create types.StrArray `json:"create,omitempty"`

	// Delete destroys a server
	Delete types.StrArray `json:"delete,omitempty"`

	// Start starts a stopped server
	Start types.StrArray `json:"start,omitempty"`

	// Stop stops a running server
	Stop types.StrArray `json:"stop,omitempty"`

	// Status retrieves the server status
	Status types.StrArray `json:"status,omitempty"`

	// Proxy proxies commands
	Proxy *ProxyCommands `json:"proxy,omitempty"`
}

type ProviderConfig

type ProviderConfig struct {
	// Name is the name of the provider
	Name string `json:"name,omitempty"`

	// Version is the provider version
	Version string `json:"version,omitempty"`

	// Icon holds an image URL that will be displayed
	Icon string `json:"icon,omitempty"`

	// IconDark holds an image URL that will be displayed in dark mode
	IconDark string `json:"iconDark,omitempty"`

	// Home holds the provider home URL
	Home string `json:"home,omitempty"`

	// Source is the source the provider was loaded from
	Source ProviderSource `json:"source,omitempty"`

	// Description is the provider description
	Description string `json:"description,omitempty"`

	// OptionGroups holds information how to display options
	OptionGroups []ProviderOptionGroup `json:"optionGroups,omitempty"`

	// Options are the provider options.
	Options map[string]*types.Option `json:"options,omitempty"`

	// Agent allows you to override agent configuration
	Agent ProviderAgentConfig `json:"agent,omitempty"`

	// Exec holds the provider commands
	Exec ProviderCommands `json:"exec,omitempty"`

	// Binaries is an optional field to specify a binary to execute the commands
	Binaries map[string][]*ProviderBinary `json:"binaries,omitempty"`
}

func LoadProviderConfig

func LoadProviderConfig(context, provider string) (*ProviderConfig, error)

func ParseProvider

func ParseProvider(reader io.Reader) (*ProviderConfig, error)

func (*ProviderConfig) HasHealthCheck added in v0.6.0

func (c *ProviderConfig) HasHealthCheck() bool

func (*ProviderConfig) IsMachineProvider

func (c *ProviderConfig) IsMachineProvider() bool

func (*ProviderConfig) IsProxyProvider added in v0.2.0

func (c *ProviderConfig) IsProxyProvider() bool

type ProviderCustomDriverConfig added in v0.4.0

type ProviderCustomDriverConfig struct {
	// FindDevContainer is used to find an existing devcontainer
	FindDevContainer types.StrArray `json:"findDevContainer,omitempty"`

	// CommandDevContainer is used to execute a command in the devcontainer
	CommandDevContainer types.StrArray `json:"commandDevContainer,omitempty"`

	// TargetArchitecture is used to find out the target architecture
	TargetArchitecture types.StrArray `json:"targetArchitecture,omitempty"`

	// RunDevContainer is used to actually run the devcontainer
	RunDevContainer types.StrArray `json:"runDevContainer,omitempty"`

	// StartDevContainer is used to start the devcontainer
	StartDevContainer types.StrArray `json:"startDevContainer,omitempty"`

	// StopDevContainer is used to stop the devcontainer
	StopDevContainer types.StrArray `json:"stopDevContainer,omitempty"`

	// DeleteDevContainer is used to delete the devcontainer
	DeleteDevContainer types.StrArray `json:"deleteDevContainer,omitempty"`

	// CanReprovision returns true if the driver can reprovision the devcontainer
	CanReprovision types.StrBool `json:"canReprovision,omitempty"`

	// GetDevContainerLogs returns the logs of the devcontainer
	GetDevContainerLogs types.StrArray `json:"getDevContainerLogs,omitempty"`
}

type ProviderDockerDriverConfig

type ProviderDockerDriverConfig struct {
	// Path where to find the docker binary, defaults to 'docker'
	Path string `json:"path,omitempty"`

	// If false, DevPod will not try to install docker into the machine.
	Install types.StrBool `json:"install,omitempty"`

	// Builder to use with docker
	Builder string `json:"builder,omitempty"`

	// Environment variables to set when running docker commands
	Env map[string]string `json:"env,omitempty"`
}

type ProviderDockerlessOptions added in v0.4.0

type ProviderDockerlessOptions struct {
	// Disabled signals if dockerless building is disabled
	Disabled types.StrBool `json:"disabled,omitempty"`

	// Image is the image of the dockerless container to start
	Image string `json:"image,omitempty"`

	// IgnorePaths are additional ignore paths that should be ignored during deletion
	IgnorePaths string `json:"ignorePaths,omitempty"`

	// Registry to use as remote cache
	RegistryCache string `json:"registryCache,omitempty"`

	// DisableDockerCredentials prevents docker credentials from getting injected
	DisableDockerCredentials types.StrBool `json:"disableDockerCredentials,omitempty"`
}

type ProviderOptionGroup

type ProviderOptionGroup struct {
	// Name is the display name of the option group
	Name string `json:"name,omitempty"`

	// Options are the options that belong to this group
	Options []string `json:"options,omitempty"`

	// DefaultVisible defines if the option group should be visible by default
	DefaultVisible bool `json:"defaultVisible,omitempty"`
}

type ProviderSource

type ProviderSource struct {
	// Internal means provider was received internally
	Internal bool `json:"internal,omitempty"`

	// Github source for the provider
	Github string `json:"github,omitempty"`

	// File source for the provider
	File string `json:"file,omitempty"`

	// URL where the provider was downloaded from
	URL string `json:"url,omitempty"`

	// Raw is the exact string we used to load the provider
	Raw string `json:"raw,omitempty"`
}

type ProxyCommands added in v0.2.0

type ProxyCommands struct {
	// Up proxies the up command
	Up types.StrArray `json:"up,omitempty"`

	// Stop proxies the stop command
	Stop types.StrArray `json:"stop,omitempty"`

	// Delete proxies the delete command
	Delete types.StrArray `json:"delete,omitempty"`

	// Ssh proxies the ssh command
	Ssh types.StrArray `json:"ssh,omitempty"`

	// Status proxies the status command
	Status types.StrArray `json:"status,omitempty"`

	// Health checks the health of the platform
	Health types.StrArray `json:"health,omitempty"`

	// Create creates entities associated with this provider
	Create CreateProxyCommands `json:"create,omitempty"`

	// Get gets entities associated with this provider
	Get GetProxyCommands `json:"get,omitempty"`

	// List lists all entities associated with this provider
	List ListProxyCommands `json:"list,omitempty"`

	// Watch lists all entities associated with this provider and then watches for changes
	Watch WatchProxyCommands `json:"watch,omitempty"`

	// Update updates entities associated with this provider
	Update UpdateProxyCommands `json:"update,omitempty"`
}

type SubOptions added in v0.3.0

type SubOptions struct {
	Options map[string]*types.Option `json:"options,omitempty"`
}

type UpdateProxyCommands added in v0.6.0

type UpdateProxyCommands struct {
	// Workspace updates a workspace instance
	Workspace types.StrArray `json:"workspace,omitempty"`
}

type WatchProxyCommands added in v0.6.0

type WatchProxyCommands struct {
	// Workspaces watches all workspaces and updates on changes
	Workspaces types.StrArray `json:"workspaces,omitempty"`
}

type Workspace

type Workspace struct {
	// ID is the workspace id to use
	ID string `json:"id,omitempty"`

	// UID is used to identify this specific workspace
	UID string `json:"uid,omitempty"`

	// Picture is the project social media image
	Picture string `json:"picture,omitempty"`

	// Provider is the provider used to create this workspace
	Provider WorkspaceProviderConfig `json:"provider,omitempty"`

	// Machine is the machine to use for this workspace
	Machine WorkspaceMachineConfig `json:"machine,omitempty"`

	// IDE holds IDE specific settings
	IDE WorkspaceIDEConfig `json:"ide,omitempty"`

	// Source is the source where this workspace will be created from
	Source WorkspaceSource `json:"source,omitempty"`

	// DevContainerImage is the container image to use, overriding whatever is in the devcontainer.json
	DevContainerImage string `json:"devContainerImage,omitempty"`

	// DevContainerPath is the relative path where the devcontainer.json is located.
	DevContainerPath string `json:"devContainerPath,omitempty"`

	// DevContainerConfig holds the config for the devcontainer.json.
	DevContainerConfig *devcontainerconfig.DevContainerConfig `json:"devContainerConfig,omitempty"`

	// CreationTimestamp is the timestamp when this workspace was created
	CreationTimestamp types.Time `json:"creationTimestamp,omitempty"`

	// LastUsedTimestamp holds the timestamp when this workspace was last accessed
	LastUsedTimestamp types.Time `json:"lastUsed,omitempty"`

	// Context is the context where this config file was loaded from
	Context string `json:"context,omitempty"`

	// Imported signals that this workspace was imported
	Imported bool `json:"imported,omitempty"`

	// Origin is the place where this config file was loaded from
	Origin string `json:"-"`

	// Pro signals this workspace is remote and doesn't necessarily exist locally. It also has more metadata about the pro workspace
	Pro *ProMetadata `json:"pro,omitempty"`

	// Path to the file where the SSH config to access the workspace is stored
	SSHConfigPath string `json:"sshConfigPath,omitempty"`
}

func CloneWorkspace

func CloneWorkspace(workspace *Workspace) *Workspace

func LoadWorkspaceConfig

func LoadWorkspaceConfig(context, workspaceID string) (*Workspace, error)

func (*Workspace) IsPro added in v0.6.0

func (w *Workspace) IsPro() bool

type WorkspaceIDEConfig

type WorkspaceIDEConfig struct {
	// Name is the name of the IDE
	Name string `json:"name,omitempty"`

	// Options are the local options that override the global ones
	Options map[string]config.OptionValue `json:"options,omitempty"`
}

type WorkspaceMachineConfig

type WorkspaceMachineConfig struct {
	// ID is the machine ID to use for this workspace
	ID string `json:"machineId,omitempty"`

	// AutoDelete specifies if the machine should get destroyed when
	// the workspace is destroyed
	AutoDelete bool `json:"autoDelete,omitempty"`
}

type WorkspaceProviderConfig

type WorkspaceProviderConfig struct {
	// Name is the provider name
	Name string `json:"name,omitempty"`

	// Options are the local options that override the global ones
	Options map[string]config.OptionValue `json:"options,omitempty"`
}

type WorkspaceSource

type WorkspaceSource struct {
	// GitRepository is the repository to clone
	GitRepository string `json:"gitRepository,omitempty"`

	// GitBranch is the branch to use
	GitBranch string `json:"gitBranch,omitempty"`

	// GitCommit is the commit SHA to checkout
	GitCommit string `json:"gitCommit,omitempty"`

	// GitPRReference is the pull request reference to checkout
	GitPRReference string `json:"gitPRReference,omitempty"`

	// GitSubPath is the subpath in the repo to use
	GitSubPath string `json:"gitSubDir,omitempty"`

	// LocalFolder is the local folder to use
	LocalFolder string `json:"localFolder,omitempty"`

	// Image is the docker image to use
	Image string `json:"image,omitempty"`

	// Container is the container to use
	Container string `json:"container,omitempty"`
}

func ParseWorkspaceSource added in v0.2.0

func ParseWorkspaceSource(source string) *WorkspaceSource

func (WorkspaceSource) String

func (w WorkspaceSource) String() string

Jump to

Keyboard shortcuts

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