entities

package
v0.0.0-...-f432a95 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: MIT Imports: 9 Imported by: 6 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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

func BuildDevEnvNameSlug(name string) string

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 NewCluster(
	clusterName string,
	defaultInstanceType string,
	isDefaultCluster bool,
) *Cluster

func (*Cluster) GetNameSlug

func (c *Cluster) GetNameSlug() string

func (*Cluster) SetInfrastructureJSON

func (c *Cluster) SetInfrastructureJSON(infrastructure interface{}) error

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 NewConfig

func NewConfig() *Config

func (*Config) ClusterExists

func (c *Config) ClusterExists(clusterName string) bool

func (*Config) CountDevEnvsInCluster

func (c *Config) CountDevEnvsInCluster(clusterName string) (int, error)

func (*Config) DevEnvExists

func (c *Config) DevEnvExists(clusterName, devEnvName string) bool

func (*Config) GetCluster

func (c *Config) GetCluster(clusterName string) (*Cluster, error)

func (*Config) GetDevEnv

func (c *Config) GetDevEnv(clusterName, devEnvName string) (*DevEnv, error)

func (*Config) RemoveCluster

func (c *Config) RemoveCluster(clusterName string) error

func (*Config) RemoveDevEnv

func (c *Config) RemoveDevEnv(clusterName, devEnvName string) error

func (*Config) SetCluster

func (c *Config) SetCluster(cluster *Cluster) error

func (*Config) SetDevEnv

func (c *Config) SetDevEnv(clusterName string, devEnv *DevEnv) error

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 (d *DevEnv) GetNameSlug() string

func (*DevEnv) GetSSHKeyPairName

func (d *DevEnv) GetSSHKeyPairName() string

func (*DevEnv) SetAdditionalPropertiesJSON

func (d *DevEnv) SetAdditionalPropertiesJSON(additionalProperties interface{}) error

func (*DevEnv) SetInfrastructureJSON

func (d *DevEnv) SetInfrastructureJSON(infrastructure interface{}) error

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

type ErrDevEnvNotExists struct {
	ClusterName string
	DevEnvName  string
}

func (ErrDevEnvNotExists) Error

func (ErrDevEnvNotExists) Error() string

type ErrDevEnvRepositoryNotFound

type ErrDevEnvRepositoryNotFound struct {
	RepoOwner string
	RepoName  string
}

func (ErrDevEnvRepositoryNotFound) Error

type ErrInvalidDevEnvUserConfig

type ErrInvalidDevEnvUserConfig struct {
	RepoOwner string
	Reason    string
}

func (ErrInvalidDevEnvUserConfig) Error

type ErrStartRemovingDevEnv

type ErrStartRemovingDevEnv struct {
	DevEnvName string
}

func (ErrStartRemovingDevEnv) Error

type ErrStartStoppingDevEnv

type ErrStartStoppingDevEnv struct {
	DevEnvName string
}

func (ErrStartStoppingDevEnv) Error

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"`
}

Jump to

Keyboard shortcuts

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