Documentation
¶
Index ¶
- Constants
- Variables
- func BuildDevEnvNameFromResolvedRepo(resolvedRepo ResolvedDevEnvRepository) string
- func BuildDevEnvNameSlug(name string) string
- type CloudService
- type CloudServiceBuilder
- type Cluster
- type ClusterStatus
- type Config
- func (c *Config) ClusterExists(clusterName string) bool
- func (c *Config) CountDevEnvsInCluster(clusterName string) (int, error)
- func (c *Config) DevEnvExists(clusterName, devEnvName string) bool
- func (c *Config) GetCluster(clusterName string) (*Cluster, error)
- func (c *Config) GetDevEnv(clusterName, devEnvName string) (*DevEnv, error)
- func (c *Config) RemoveCluster(clusterName string) error
- func (c *Config) RemoveDevEnv(clusterName, devEnvName string) error
- func (c *Config) SetCluster(cluster *Cluster) error
- func (c *Config) SetDevEnv(clusterName string, devEnv *DevEnv) error
- type DevEnv
- type DevEnvRepositoryGitURL
- type DevEnvSSHHostKey
- type DevEnvStatus
- type ErrClusterAlreadyExists
- type ErrClusterNotExists
- type ErrDevEnvNotExists
- type ErrDevEnvRepositoryNotFound
- type ErrInvalidDevEnvUserConfig
- type ErrStartRemovingDevEnv
- type ErrStartStoppingDevEnv
- type ErrStopCreatingDevEnv
- type ErrStopRemovingDevEnv
- type ErrStopStartingDevEnv
- type HookRunner
- type ResolvedDevEnvRepository
- type ResolvedDevEnvUserConfig
Constants ¶
View Source
const ( DevEnvDockerfilesVSCodeExtLabelKey = "sh.recode.vscode.extensions" DevEnvDockerfilesReposLabelKey = "sh.recode.repositories" DevEnvRootUser = "recode" )
View Source
const ( DevEnvRepositoryConfigDirectory = ".recode" DevEnvRepositoryDockerfileFileName = "dev_env.Dockerfile" DevEnvRepositoryConfigHooksDirectory = "hooks" DevEnvRepositoryInitHookFileName = "init.sh" )
View Source
const ( DevEnvUserConfigDefaultRepoOwner = "recode-sh" DevEnvUserConfigRepoName = ".recode" DevEnvUserConfigDockerfileFileName = "dev_env.Dockerfile" DevEnvUserConfigDockerfileRootImage = "recodesh/base-dev-env" DevEnvUserConfigDockerfileImageName = "user_dev_env" )
View Source
const (
DefaultClusterName = "default"
)
Variables ¶
View Source
var ( DevEnvDockerfilesVSCodeExtLabelSepRegExp = regexp.MustCompile(`\s*,\s*`) DevEnvDockerfilesReposLabelSepRegExp = regexp.MustCompile(`\s*,\s*`) )
View Source
var ( ErrRecodeNotInstalled = errors.New("ErrRecodeNotInstalled") ErrUninstallExistingDevEnvs = errors.New("ErrUninstallExistingDevEnvs") )
Functions ¶
func BuildDevEnvNameFromResolvedRepo ¶
func BuildDevEnvNameFromResolvedRepo( resolvedRepo ResolvedDevEnvRepository, ) string
func BuildDevEnvNameSlug ¶
Types ¶
type CloudService ¶
type CloudService interface {
CreateRecodeConfigStorage(stepper.Stepper) error
RemoveRecodeConfigStorage(stepper.Stepper) error
LookupRecodeConfig(stepper.Stepper) (*Config, error)
SaveRecodeConfig(stepper.Stepper, *Config) error
CreateCluster(stepper.Stepper, *Config, *Cluster) error
RemoveCluster(stepper.Stepper, *Config, *Cluster) error
CheckInstanceTypeValidity(stepper.Stepper, string) error
CreateDevEnv(stepper.Stepper, *Config, *Cluster, *DevEnv) error
RemoveDevEnv(stepper.Stepper, *Config, *Cluster, *DevEnv) error
StartDevEnv(stepper.Stepper, *Config, *Cluster, *DevEnv) error
StopDevEnv(stepper.Stepper, *Config, *Cluster, *DevEnv) error
}
type CloudServiceBuilder ¶
type CloudServiceBuilder interface {
Build() (CloudService, error)
}
type Cluster ¶
type Cluster struct {
ID string `json:"id"`
Name string `json:"name"`
DefaultInstanceType string `json:"default_instance_type"`
InfrastructureJSON string `json:"infrastructure_json"`
DevEnvs map[string]*DevEnv `json:"dev_envs"`
IsDefault bool `json:"is_default"`
Status ClusterStatus `json:"status"`
CreatedAtTimestamp int64 `json:"created_at_timestamp"`
}
func NewCluster ¶
func (*Cluster) GetNameSlug ¶
func (*Cluster) SetInfrastructureJSON ¶
type ClusterStatus ¶
type ClusterStatus string
const ( ClusterStatusCreating ClusterStatus = "creating" ClusterStatusCreated ClusterStatus = "created" ClusterStatusRemoving ClusterStatus = "removing" )
type Config ¶
type Config struct {
ID string `json:"id"`
Clusters map[string]*Cluster `json:"clusters"`
CreatedAtTimestamp int64 `json:"created_at_timestamp"`
}
func (*Config) ClusterExists ¶
func (*Config) CountDevEnvsInCluster ¶
func (*Config) DevEnvExists ¶
func (*Config) RemoveCluster ¶
func (*Config) RemoveDevEnv ¶
func (*Config) SetCluster ¶
type DevEnv ¶
type DevEnv struct {
ID string `json:"id"`
Name string `json:"name"`
InfrastructureJSON string `json:"infrastructure_json"`
InstanceType string `json:"instance_type"`
InstancePublicIPAddress string `json:"instance_public_ip_address"`
InstancePublicHostname string `json:"instance_public_hostname"`
SSHHostKeys []DevEnvSSHHostKey `json:"ssh_host_keys"`
SSHKeyPairPEMContent string `json:"ssh_key_pair_pem_content"`
ResolvedUserConfig ResolvedDevEnvUserConfig `json:"resolved_user_config"`
ResolvedRepository ResolvedDevEnvRepository `json:"resolved_repository"`
Status DevEnvStatus `json:"status"`
AdditionalPropertiesJSON string `json:"additional_properties_json"`
CreatedAtTimestamp int64 `json:"created_at_timestamp"`
}
func NewDevEnv ¶
func NewDevEnv( devEnvName string, instanceType string, resolvedUserConfig ResolvedDevEnvUserConfig, resolvedRepository ResolvedDevEnvRepository, ) *DevEnv
func (*DevEnv) GetNameSlug ¶
func (*DevEnv) GetSSHKeyPairName ¶
func (*DevEnv) SetAdditionalPropertiesJSON ¶
func (*DevEnv) SetInfrastructureJSON ¶
type DevEnvRepositoryGitURL ¶
type DevEnvRepositoryGitURL string
type DevEnvSSHHostKey ¶
type DevEnvSSHHostKey struct {
Algorithm string `json:"algorithm"`
Fingerprint string `json:"fingerprint"`
}
func ParseSSHHostKeys ¶
func ParseSSHHostKeys(hostKeysContent string) ([]DevEnvSSHHostKey, error)
type DevEnvStatus ¶
type DevEnvStatus string
const ( DevEnvStatusCreating DevEnvStatus = "creating" DevEnvStatusStarting DevEnvStatus = "starting" DevEnvStatusStarted DevEnvStatus = "started" DevEnvStatusStopping DevEnvStatus = "stopping" DevEnvStatusStopped DevEnvStatus = "stopped" DevEnvStatusRemoving DevEnvStatus = "removing" )
type ErrClusterAlreadyExists ¶
type ErrClusterAlreadyExists struct {
ClusterName string
}
func (ErrClusterAlreadyExists) Error ¶
func (e ErrClusterAlreadyExists) Error() string
type ErrClusterNotExists ¶
type ErrClusterNotExists struct {
ClusterName string
}
func (ErrClusterNotExists) Error ¶
func (e ErrClusterNotExists) Error() string
type ErrDevEnvNotExists ¶
func (ErrDevEnvNotExists) Error ¶
func (ErrDevEnvNotExists) Error() string
type ErrDevEnvRepositoryNotFound ¶
func (ErrDevEnvRepositoryNotFound) Error ¶
func (ErrDevEnvRepositoryNotFound) Error() string
type ErrInvalidDevEnvUserConfig ¶
func (ErrInvalidDevEnvUserConfig) Error ¶
func (ErrInvalidDevEnvUserConfig) Error() string
type ErrStartRemovingDevEnv ¶
type ErrStartRemovingDevEnv struct {
DevEnvName string
}
func (ErrStartRemovingDevEnv) Error ¶
func (ErrStartRemovingDevEnv) Error() string
type ErrStartStoppingDevEnv ¶
type ErrStartStoppingDevEnv struct {
DevEnvName string
}
func (ErrStartStoppingDevEnv) Error ¶
func (ErrStartStoppingDevEnv) Error() string
type ErrStopCreatingDevEnv ¶
type ErrStopCreatingDevEnv struct {
DevEnvName string
}
func (ErrStopCreatingDevEnv) Error ¶
func (ErrStopCreatingDevEnv) Error() string
type ErrStopRemovingDevEnv ¶
type ErrStopRemovingDevEnv struct {
DevEnvName string
}
func (ErrStopRemovingDevEnv) Error ¶
func (ErrStopRemovingDevEnv) Error() string
type ErrStopStartingDevEnv ¶
type ErrStopStartingDevEnv struct {
DevEnvName string
}
func (ErrStopStartingDevEnv) Error ¶
func (ErrStopStartingDevEnv) Error() string
type HookRunner ¶
type HookRunner interface {
Run(
cloudService CloudService,
config *Config,
cluster *Cluster,
devEnv *DevEnv,
) error
}
type ResolvedDevEnvRepository ¶
type ResolvedDevEnvRepository struct {
Name string `json:"name"`
Owner string `json:"owner"`
ExplicitOwner bool `json:"explicit_owner"`
GitURL DevEnvRepositoryGitURL `json:"git_url"`
GitHTTPURL DevEnvRepositoryGitURL `json:"git_http_url"`
}
type ResolvedDevEnvUserConfig ¶
type ResolvedDevEnvUserConfig struct {
RepoOwner string `json:"repo_owner"`
RepoName string `json:"repo_name"`
RepoGitURL DevEnvRepositoryGitURL `json:"repo_git_url"`
RepoGitHTTPURL DevEnvRepositoryGitURL `json:"repo_git_http_url"`
}
Click to show internal directories.
Click to hide internal directories.