Documentation
¶
Index ¶
- Constants
- Variables
- func WithExecutionContext(ctx context.Context, execCtx ExecutionContext) context.Context
- type ClearCurrentCommand
- type CloneCommand
- type ComposeFiles
- type EnvFile
- type ExampleFileProvisioner
- type ExampleFileProvisionerType
- type ExecutionContext
- type ExecutionContextMiddleware
- type ExecutionTarget
- type Extension
- type ExtraComposeFile
- type InitialiseCommand
- type InvalidWorkspaceConfigError
- type LoaderCondition
- type LoaderPropertyCondition
- type LsQuery
- type Manager
- func (m *Manager) ClearCurrent(_ context.Context, cmd ClearCurrentCommand) error
- func (m *Manager) Clone(ctx context.Context, cmd CloneCommand) error
- func (m *Manager) Initialise(ctx context.Context, cmd InitialiseCommand) error
- func (m *Manager) InitialiseFromLocalDirectory(ctx context.Context, dir string, workspaceFile string, into string) error
- func (m *Manager) InitialiseFromRemoteRepo(ctx context.Context, repoName string, workspaceFile string, into string) error
- func (m *Manager) Ls(_ context.Context, query LsQuery) error
- func (m *Manager) ShowCurrent(_ context.Context, query ShowCurrentQuery) error
- func (m *Manager) Switch(_ context.Context, cmd SwitchCommand) error
- type NetworkOverlayConfig
- type OverlayConfig
- type Project
- type ProjectConfig
- type ProjectMeta
- type ProjectRepositoryConfig
- type ProjectRepositoryMeta
- type Property
- type Provisioner
- type Repository
- type Resolver
- type ShowCurrentQuery
- type SwitchCommand
- type UnconfiguredProject
- type UnconfiguredWorkspace
- type Workspace
- type WorkspaceMeta
Constants ¶
const DefaultProjectFileName = "orca.project.yaml"
const DefaultWorkspaceFileName = "orca.workspace.yaml"
Variables ¶
var ( ErrInvalidExecutionContext = errors.New("invalid execution context") ErrCouldNotDetermineWorkspace = errors.New("could not determine workspace") ErrUnknownWorkspace = errors.New("unknown workspace") ErrUnknownProject = errors.New("unknown project") ErrInvalidInput = errors.New("invalid input") ErrFileNotFound = errors.New("file not found") ErrWorkspaceAlreadyExists = errors.New("workspace already exists") ErrDirectoryAlreadyExists = errors.New("directory already exists") ErrDirectoryDoesNotMatchOrigin = errors.New("directory does not contain a repo with the expected origin") ErrProjectConfigNotFound = errors.New("project config not found") ErrWorkspaceConfigNotFound = errors.New("workspace config not found") ErrConfigIsNotValidYAML = errors.New("config is not valid yaml") ErrUnknownExtension = errors.New("unknown extension") )
var ErrNoExecutionContext = errors.New("no execution context was resolved for this message, it needs a target registering")
ErrNoExecutionContext means a handler needed an ExecutionContext, but its message has no target registered, so it was never resolved. This is a bug.
Functions ¶
func WithExecutionContext ¶
func WithExecutionContext(ctx context.Context, execCtx ExecutionContext) context.Context
Types ¶
type ClearCurrentCommand ¶
func (ClearCurrentCommand) MessageName ¶
func (ClearCurrentCommand) MessageName() string
type CloneCommand ¶
func (CloneCommand) MessageName ¶
func (CloneCommand) MessageName() string
type ComposeFiles ¶
type ComposeFiles struct {
Primary string
Extras []ExtraComposeFile
}
type ExampleFileProvisioner ¶
type ExampleFileProvisioner struct {
Src string
Target string
Type ExampleFileProvisionerType
}
type ExampleFileProvisionerType ¶
type ExampleFileProvisionerType string
const ExampleFileProvisionerTypeDotenv ExampleFileProvisionerType = "dotenv"
type ExecutionContext ¶
func ExecutionContextFrom ¶
func ExecutionContextFrom(ctx context.Context) (ExecutionContext, error)
ExecutionContextFrom returns the ExecutionContext resolved for the message being handled. It should only be called from handlers, whose message has a target registered with the ExecutionContextMiddleware.
func (ExecutionContext) Dir ¶
func (e ExecutionContext) Dir() string
Dir is the directory to run in: the project's, if there is one, otherwise the working directory.
type ExecutionContextMiddleware ¶
type ExecutionContextMiddleware struct {
// contains filtered or unexported fields
}
ExecutionContextMiddleware resolves the ExecutionContext for a message before it's handled, and passes it along in the context.Context, to be read with ExecutionContextFrom.
Only messages with a target registered (see Target) are resolved, others are passed through as they are.
func NewExecutionContextMiddleware ¶
func NewExecutionContextMiddleware(resolver resolver) *ExecutionContextMiddleware
func (*ExecutionContextMiddleware) Handle ¶
func (m *ExecutionContextMiddleware) Handle(ctx context.Context, msg bus.Named, next bus.Next) (any, error)
Handle is the bus.Middleware.
func (*ExecutionContextMiddleware) Target ¶
func (m *ExecutionContextMiddleware) Target[M bus.Named](fn func(msg M) ExecutionTarget)
Target registers how to get the target for messages of type M. Registering a second target for the same type is a programming error, so panics.
func (*ExecutionContextMiddleware) TargetedTypes ¶
func (m *ExecutionContextMiddleware) TargetedTypes() []string
TargetedTypes returns the type of every message that has a target, e.g. "controller.UpCommand".
type ExecutionTarget ¶
type ExecutionTarget struct {
Workspace string
Project string
// When the workspace can't be determined, carry on with only the working
// directory, instead of failing. Used by commands that are still useful
// outside of orca, like the git commands in any repository.
WorkspaceOptional bool
}
ExecutionTarget is the workspace and project a message runs against, as given by the user. Either may be empty, in which case they're resolved as usual (see Resolver.Resolve).
type ExtraComposeFile ¶
type ExtraComposeFile struct {
Path string
When []LoaderCondition
}
type InitialiseCommand ¶
type InitialiseCommand struct {
bus.Returns[bus.Void]
// A github repository in the format 'owner/repo' to clone the workspace
// config from, takes precedence over SourceDirectory
SourceRepo string
SourceDirectory string
WorkspaceFileName string
Into string
}
func (InitialiseCommand) MessageName ¶
func (InitialiseCommand) MessageName() string
type InvalidWorkspaceConfigError ¶
func (InvalidWorkspaceConfigError) Error ¶
func (err InvalidWorkspaceConfigError) Error() string
type LoaderCondition ¶
type LoaderCondition struct {
OS string
Arch string
Property LoaderPropertyCondition
}
type LoaderPropertyCondition ¶
type LsQuery ¶
func (LsQuery) MessageName ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) ClearCurrent ¶
func (m *Manager) ClearCurrent(_ context.Context, cmd ClearCurrentCommand) error
func (*Manager) Initialise ¶
func (m *Manager) Initialise(ctx context.Context, cmd InitialiseCommand) error
func (*Manager) InitialiseFromLocalDirectory ¶
func (*Manager) InitialiseFromRemoteRepo ¶
func (*Manager) ShowCurrent ¶
func (m *Manager) ShowCurrent(_ context.Context, query ShowCurrentQuery) error
type NetworkOverlayConfig ¶
type OverlayConfig ¶
type OverlayConfig struct {
Network NetworkOverlayConfig
}
type Project ¶
type Project struct {
Name string
RepositoryConfig ProjectRepositoryConfig
ProjectDir string
Requires []string
Config ProjectConfig
IsRegistered bool
}
func (Project) EnvFilePaths ¶
func (Project) GetChildren ¶
func (Project) GetParents ¶
type ProjectConfig ¶
type ProjectConfig struct {
ComposeFiles ComposeFiles
Provisioners []Provisioner
EnvFiles []EnvFile
Properties []Property
Hosts []string
TLSCertificates []string
Extensions []Extension
}
type ProjectMeta ¶
type ProjectMeta struct {
Name string
Path string
WorkspaceName string
Repository ProjectRepositoryMeta
}
type ProjectRepositoryConfig ¶
type ProjectRepositoryMeta ¶
type Provisioner ¶
type Provisioner struct {
ExampleFile *ExampleFileProvisioner
}
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(fs afero.Fs, userConfig userConfig) *Repository
func (*Repository) LoadUnconfiguredWorkspace ¶
func (wcr *Repository) LoadUnconfiguredWorkspace(path string) (*UnconfiguredWorkspace, error)
func (*Repository) ParseUnconfiguredWorkspace ¶
func (wcr *Repository) ParseUnconfiguredWorkspace(contents []byte, path string) (*UnconfiguredWorkspace, error)
ParseUnconfiguredWorkspace loads a workspace from raw config contents, e.g. when fetched from a remote. The path is only used for reporting.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func NewResolver ¶
func NewResolver(cfg configManager, workspaceRepo workspaceRepository) *Resolver
type ShowCurrentQuery ¶
func (ShowCurrentQuery) MessageName ¶
func (ShowCurrentQuery) MessageName() string
type SwitchCommand ¶
func (SwitchCommand) MessageName ¶
func (SwitchCommand) MessageName() string
type UnconfiguredProject ¶
type UnconfiguredProject struct {
Name string
RepositoryConfig ProjectRepositoryConfig
}
type UnconfiguredWorkspace ¶
type UnconfiguredWorkspace struct {
Name string
ConfigPath string
Projects []UnconfiguredProject
}
type Workspace ¶
type Workspace struct {
Name string
ConfigPath string
Projects []Project
OverlayConfig OverlayConfig `yaml:"overlays"`
}
func (*Workspace) GetUniqueHosts ¶
func (*Workspace) GetUniqueTLSCertificates ¶
type WorkspaceMeta ¶
type WorkspaceMeta struct {
Name string
Path string
Projects []ProjectMeta
}