Documentation
¶
Index ¶
- func CloneTemplateRepo(opts GitTemplateOptions) error
- func ConfigureTemplateRemotes(opts GitTemplateOptions) error
- func ContextPluginSupports(contextPlugin, requestedPlugin string) bool
- type CheckoutSource
- type CommandExecOptions
- type ComposeCreateContextOptions
- type ComposeCreateRequest
- type ComposeRemoteContextOptions
- type Config
- type ContextJob
- type ConvergeRunner
- type CreateRunner
- type CreateSpec
- type DebugRunner
- type DeployRunner
- type DeploySpec
- type FileAccessor
- func (a *FileAccessor) Close() error
- func (a *FileAccessor) ListFiles(root string) ([]string, error)
- func (a *FileAccessor) MatchFiles(root, pattern string) ([]string, error)
- func (a *FileAccessor) MatchFilesInDir(root, pattern string) ([]string, error)
- func (a *FileAccessor) ReadFile(path string) ([]byte, error)
- func (a *FileAccessor) ReadFileContext(ctx context.Context, path string) ([]byte, error)
- func (a *FileAccessor) ReadFiles(paths []string) (map[string][]byte, error)
- func (a *FileAccessor) ReadFilesContext(ctx context.Context, paths []string) (map[string][]byte, error)
- type GitTemplateOptions
- type InstalledPlugin
- type Metadata
- type ProgressLine
- type RegisteredCreate
- type RegisteredDeploy
- type RegisteredJob
- type SDK
- func (s *SDK) AddCommand(cmd *cobra.Command)
- func (s *SDK) BindComposeCreateFlags(cmd *cobra.Command, spec CreateSpec, drupalRootfs *string, ...) error
- func (s *SDK) CloneTemplateRepo(opts GitTemplateOptions) error
- func (s *SDK) Close() error
- func (s *SDK) ConfigureTemplateRemotes(opts GitTemplateOptions) error
- func (s *SDK) ContextValidators() []validate.Validator
- func (s *SDK) CreateComponentDefinitions() ([]corecomponent.Definition, error)
- func (s *SDK) CreateDefinitions() []CreateSpec
- func (s *SDK) DeployDefinitions() []DeploySpec
- func (s *SDK) EnsureComposeCreateContext(req ComposeCreateRequest, opts ComposeCreateContextOptions) (*config.Context, error)
- func (s *SDK) ExecContainer(ctx context.Context, opts docker.ExecOptions) (int, error)
- func (s *SDK) ExecInContainer(ctx context.Context, containerID string, cmd []string) (int, error)
- func (s *SDK) ExecInContainerInteractive(ctx context.Context, containerID string, cmd []string) (int, error)
- func (s *SDK) Execute()
- func (s *SDK) GetComponentManager() (*component.Manager, error)
- func (s *SDK) GetContext() (*config.Context, error)
- func (s *SDK) GetDiscoveryMetadataCommand() *cobra.Command
- func (s *SDK) GetDockerClient() (*docker.DockerClient, error)
- func (s *SDK) GetFileAccessor() (*FileAccessor, error)
- func (s *SDK) GetSSHClient() (*ssh.Client, error)
- func (s *SDK) InvokeIncludedPluginCommand(pluginName string, args []string, opts CommandExecOptions) (string, error)
- func (s *SDK) InvokeIncludedPlugins(args []string) ([]string, error)
- func (s *SDK) InvokePluginCommand(pluginName string, args []string, opts CommandExecOptions) (string, error)
- func (s *SDK) LocalComponentDefinitions() []corecomponent.Definition
- func (s *SDK) PromptAndSaveLocalContext(opts config.LocalContextCreateOptions) (*config.Context, error)
- func (s *SDK) RegisterComponentDefinition(def corecomponent.Definition)
- func (s *SDK) RegisterComponentDefinitions(defs ...corecomponent.Definition)
- func (s *SDK) RegisterContextJob(spec job.Spec, runner ContextJob)
- func (s *SDK) RegisterContextValidator(validator validate.Validator)
- func (s *SDK) RegisterConvergeRunner(runner ConvergeRunner)
- func (s *SDK) RegisterCreate(spec CreateSpec, cmd *cobra.Command)
- func (s *SDK) RegisterCreateRunner(spec CreateSpec, runner CreateRunner)
- func (s *SDK) RegisterDebugHandler(runner DebugRunner)
- func (s *SDK) RegisterDeployRunner(spec DeploySpec, runner DeployRunner)
- func (s *SDK) RegisterJob(spec job.Spec, cmd *cobra.Command)
- func (s *SDK) RegisterSetRunner(runner SetRunner)
- func (s *SDK) RegisterValidateRunner(runner ValidateRunner)
- func (s *SDK) ResolveComposeCreateRequest(cmd *cobra.Command, input config.InputFunc, ...) (ComposeCreateRequest, error)
- func (s *SDK) SetVersionInfo(version, commit, date string)
- type SetRunner
- type ValidateRunner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloneTemplateRepo ¶ added in v0.5.0
func CloneTemplateRepo(opts GitTemplateOptions) error
func ConfigureTemplateRemotes ¶ added in v0.5.0
func ConfigureTemplateRemotes(opts GitTemplateOptions) error
func ContextPluginSupports ¶ added in v0.11.0
Types ¶
type CheckoutSource ¶ added in v0.15.0
type CheckoutSource string
const ( CheckoutSourceTemplate CheckoutSource = "template" CheckoutSourceExisting CheckoutSource = "existing" )
type CommandExecOptions ¶ added in v0.11.0
type ComposeCreateContextOptions ¶ added in v0.15.0
type ComposeCreateContextOptions struct {
DefaultName string
DefaultSite string
DefaultPlugin string
DefaultProjectDir string
DefaultProjectName string
DefaultEnvironment string
DefaultDockerSocket string
DefaultDrupalRootfs string
DrupalContainerRoot string
ConfirmOverwrite bool
Input config.InputFunc
}
type ComposeCreateRequest ¶ added in v0.15.0
type ComposeCreateRequest struct {
ContextName string
TargetType config.ContextType
CheckoutSource CheckoutSource
Path string
TemplateRepo string
TemplateBranch string
Site string
Environment string
ProjectName string
ComposeProjectName string
ComposeNetwork string
DockerSocket string
SSHHostname string
SSHUser string
SSHPort uint
SSHKeyPath string
DrupalRootfs string
SetDefaultContext bool
SetupOnly bool
Decisions map[string]corecomponent.ReviewDecision
}
type ComposeRemoteContextOptions ¶ added in v0.15.0
type ComposeRemoteContextOptions struct {
ContextName string
DefaultName string
Site string
DefaultSite string
Plugin string
ProjectDir string
DefaultProjectDir string
ProjectName string
DefaultProjectName string
Environment string
DefaultEnvironment string
ComposeProjectName string
ComposeNetwork string
DockerSocket string
SSHHostname string
SSHUser string
SSHPort uint
SSHKeyPath string
SetDefault bool
ConfirmOverwrite bool
Input config.InputFunc
DrupalRootfs string
DrupalContainerRoot string
}
type ContextJob ¶ added in v0.13.0
type ConvergeRunner ¶ added in v0.16.0
type ConvergeRunner interface {
BindFlags(cmd *cobra.Command)
Run(cmd *cobra.Command, ctx *config.Context) error
}
ConvergeRunner implements plugin-specific component convergence. Run detects and repairs configuration drift for the active context.
type CreateRunner ¶ added in v0.14.0
type CreateSpec ¶ added in v0.14.0
type CreateSpec struct {
Name string `yaml:"name"`
Plugin string `yaml:"plugin,omitempty"`
Description string `yaml:"description,omitempty"`
Default bool `yaml:"default,omitempty"`
MinCPUCores float64 `yaml:"min_cpu_cores,omitempty"`
MinMemory string `yaml:"min_memory,omitempty"`
MinDiskSpace string `yaml:"min_disk_space,omitempty"`
DockerComposeRepo string `yaml:"docker_compose_repo,omitempty"`
DockerComposeBranch string `yaml:"docker_compose_branch,omitempty"`
DockerComposeInit []string `yaml:"docker_compose_init,omitempty"`
DockerComposeUp []string `yaml:"docker_compose_up,omitempty"`
DockerComposeDown []string `yaml:"docker_compose_down,omitempty"`
}
type DebugRunner ¶ added in v0.16.0
type DebugRunner interface {
BindFlags(cmd *cobra.Command)
Render(cmd *cobra.Command, ctx *config.Context) (string, error)
}
DebugRunner renders plugin-specific debug diagnostics. Render returns the body content (without panel wrapper) for the plugin's debug section. The SDK wraps the body in a named panel and delegates to included plugins.
type DeployRunner ¶ added in v0.16.0
type DeployRunner interface {
BindFlags(cmd *cobra.Command)
PreDown(cmd *cobra.Command, ctx *config.Context) error
PostUp(cmd *cobra.Command, ctx *config.Context) error
}
DeployRunner implements plugin-specific lifecycle hooks for the deploy flow. PreDown runs before compose down; PostUp runs after compose up.
type DeploySpec ¶ added in v0.16.0
type DeploySpec struct {
Name string `yaml:"name"`
Plugin string `yaml:"plugin,omitempty"`
Description string `yaml:"description,omitempty"`
Default bool `yaml:"default,omitempty"`
}
DeploySpec describes a plugin's deploy capability.
type FileAccessor ¶ added in v0.12.0
type FileAccessor struct {
// contains filtered or unexported fields
}
func NewFileAccessor ¶ added in v0.12.0
func NewFileAccessor(ctx *config.Context) (*FileAccessor, error)
func NewFileAccessorWithSSH ¶ added in v0.12.0
func (*FileAccessor) Close ¶ added in v0.12.0
func (a *FileAccessor) Close() error
func (*FileAccessor) ListFiles ¶ added in v0.12.0
func (a *FileAccessor) ListFiles(root string) ([]string, error)
func (*FileAccessor) MatchFiles ¶ added in v0.12.0
func (a *FileAccessor) MatchFiles(root, pattern string) ([]string, error)
func (*FileAccessor) MatchFilesInDir ¶ added in v0.12.0
func (a *FileAccessor) MatchFilesInDir(root, pattern string) ([]string, error)
func (*FileAccessor) ReadFile ¶ added in v0.12.0
func (a *FileAccessor) ReadFile(path string) ([]byte, error)
func (*FileAccessor) ReadFileContext ¶ added in v0.12.0
func (*FileAccessor) ReadFiles ¶ added in v0.12.0
func (a *FileAccessor) ReadFiles(paths []string) (map[string][]byte, error)
func (*FileAccessor) ReadFilesContext ¶ added in v0.12.0
type GitTemplateOptions ¶ added in v0.5.0
type InstalledPlugin ¶ added in v0.10.0
type InstalledPlugin struct {
Name string
BinaryName string
Path string
Version string
Description string
Author string
TemplateRepo string
CanCreate bool
CanDeploy bool
CanConverge bool
CanSet bool
CanValidate bool
Includes []string
CreateDefinitions []CreateSpec
DeployDefinitions []DeploySpec
}
func DiscoverInstalled ¶ added in v0.10.0
func DiscoverInstalled() []InstalledPlugin
func DiscoverInstalledFromPath ¶ added in v0.10.0
func DiscoverInstalledFromPath(pathEnv string) []InstalledPlugin
func DiscoverInstalledLightweight ¶ added in v0.15.0
func DiscoverInstalledLightweight() []InstalledPlugin
func DiscoverInstalledLightweightFromPath ¶ added in v0.15.0
func DiscoverInstalledLightweightFromPath(pathEnv string) []InstalledPlugin
func FindInstalled ¶ added in v0.11.0
func FindInstalled(name string) (InstalledPlugin, bool)
type Metadata ¶
type Metadata struct {
Name string
Version string
Description string
Author string
TemplateRepo string
Includes []string
}
Metadata contains information about a plugin
type ProgressLine ¶ added in v0.13.0
type ProgressLine struct {
// contains filtered or unexported fields
}
func NewProgressLine ¶ added in v0.13.0
func NewProgressLine(w io.Writer, title, detail string) *ProgressLine
func (*ProgressLine) Close ¶ added in v0.13.0
func (p *ProgressLine) Close()
func (*ProgressLine) Report ¶ added in v0.13.0
func (p *ProgressLine) Report(title, detail string)
type RegisteredCreate ¶ added in v0.14.0
type RegisteredCreate struct {
Spec CreateSpec
Command *cobra.Command
}
type RegisteredDeploy ¶ added in v0.16.0
type RegisteredDeploy struct {
Spec DeploySpec
}
RegisteredDeploy holds a registered deploy spec.
type RegisteredJob ¶ added in v0.13.0
type SDK ¶
type SDK struct {
Metadata Metadata
Config Config
RootCmd *cobra.Command
// contains filtered or unexported fields
}
SDK provides common functionality for plugins
func (*SDK) AddCommand ¶
AddCommand adds a subcommand to the plugin
func (*SDK) BindComposeCreateFlags ¶ added in v0.15.0
func (*SDK) CloneTemplateRepo ¶ added in v0.5.0
func (s *SDK) CloneTemplateRepo(opts GitTemplateOptions) error
func (*SDK) ConfigureTemplateRemotes ¶ added in v0.5.0
func (s *SDK) ConfigureTemplateRemotes(opts GitTemplateOptions) error
func (*SDK) ContextValidators ¶ added in v0.9.0
func (*SDK) CreateComponentDefinitions ¶ added in v0.15.0
func (s *SDK) CreateComponentDefinitions() ([]corecomponent.Definition, error)
func (*SDK) CreateDefinitions ¶ added in v0.14.0
func (s *SDK) CreateDefinitions() []CreateSpec
func (*SDK) DeployDefinitions ¶ added in v0.16.0
func (s *SDK) DeployDefinitions() []DeploySpec
DeployDefinitions returns the deploy specs registered with this SDK instance.
func (*SDK) EnsureComposeCreateContext ¶ added in v0.15.0
func (s *SDK) EnsureComposeCreateContext(req ComposeCreateRequest, opts ComposeCreateContextOptions) (*config.Context, error)
func (*SDK) ExecContainer ¶ added in v0.12.0
ExecContainer executes a command in a Docker container using the shared SDK Docker path.
func (*SDK) ExecInContainer ¶
ExecInContainer executes a command in a Docker container. This is a convenience wrapper for plugins.
func (*SDK) ExecInContainerInteractive ¶
func (s *SDK) ExecInContainerInteractive(ctx context.Context, containerID string, cmd []string) (int, error)
ExecInContainerInteractive executes an interactive command in a Docker container with TTY. This is a convenience wrapper for plugins.
func (*SDK) GetComponentManager ¶ added in v0.5.0
GetComponentManager creates a component manager bound to the active sitectl context.
func (*SDK) GetContext ¶
GetContext loads the sitectl context configuration This is useful for plugins that need to access context-specific settings If no context is specified, returns the current context from config
func (*SDK) GetDiscoveryMetadataCommand ¶ added in v0.15.0
GetDiscoveryMetadataCommand returns a single cheap metadata payload for plugin discovery.
func (*SDK) GetDockerClient ¶
func (s *SDK) GetDockerClient() (*docker.DockerClient, error)
GetDockerClient creates a Docker client respecting the sitectl context This is a helper for plugins that need to interact with Docker Returns the existing DockerClient which handles both local and remote contexts
func (*SDK) GetFileAccessor ¶ added in v0.12.0
func (s *SDK) GetFileAccessor() (*FileAccessor, error)
func (*SDK) InvokeIncludedPluginCommand ¶ added in v0.11.0
func (*SDK) InvokeIncludedPlugins ¶ added in v0.11.0
func (*SDK) InvokePluginCommand ¶ added in v0.11.0
func (*SDK) LocalComponentDefinitions ¶ added in v0.15.0
func (s *SDK) LocalComponentDefinitions() []corecomponent.Definition
func (*SDK) PromptAndSaveLocalContext ¶ added in v0.5.0
func (s *SDK) PromptAndSaveLocalContext(opts config.LocalContextCreateOptions) (*config.Context, error)
PromptAndSaveLocalContext creates or updates a local sitectl context using the shared config prompts and save behavior.
func (*SDK) RegisterComponentDefinition ¶ added in v0.15.0
func (s *SDK) RegisterComponentDefinition(def corecomponent.Definition)
func (*SDK) RegisterComponentDefinitions ¶ added in v0.15.0
func (s *SDK) RegisterComponentDefinitions(defs ...corecomponent.Definition)
func (*SDK) RegisterContextJob ¶ added in v0.13.0
func (s *SDK) RegisterContextJob(spec job.Spec, runner ContextJob)
func (*SDK) RegisterContextValidator ¶ added in v0.9.0
func (*SDK) RegisterConvergeRunner ¶ added in v0.16.0
func (s *SDK) RegisterConvergeRunner(runner ConvergeRunner)
RegisterConvergeRunner registers a converge runner for the plugin. The SDK creates the __converge hidden command that is invoked by sitectl converge.
func (*SDK) RegisterCreate ¶ added in v0.14.0
func (s *SDK) RegisterCreate(spec CreateSpec, cmd *cobra.Command)
func (*SDK) RegisterCreateRunner ¶ added in v0.14.0
func (s *SDK) RegisterCreateRunner(spec CreateSpec, runner CreateRunner)
func (*SDK) RegisterDebugHandler ¶ added in v0.16.0
func (s *SDK) RegisterDebugHandler(runner DebugRunner)
RegisterDebugHandler registers a debug runner for the plugin. The SDK creates the __debug hidden command, wraps the runner's output in a named panel, and delegates to any included plugins.
func (*SDK) RegisterDeployRunner ¶ added in v0.16.0
func (s *SDK) RegisterDeployRunner(spec DeploySpec, runner DeployRunner)
RegisterDeployRunner registers a deploy runner for the plugin. The SDK creates the __deploy hidden command with pre-down and post-up subcommands that are invoked by sitectl deploy around the compose down/up cycle.
func (*SDK) RegisterJob ¶ added in v0.13.0
func (*SDK) RegisterSetRunner ¶ added in v0.16.0
RegisterSetRunner registers a set runner for the plugin. The SDK creates the __set hidden command that is invoked by sitectl set.
func (*SDK) RegisterValidateRunner ¶ added in v0.16.0
func (s *SDK) RegisterValidateRunner(runner ValidateRunner)
RegisterValidateRunner registers a validate runner for the plugin. The SDK creates the __validate hidden command that is invoked by sitectl validate. The command outputs YAML-encoded []validate.Result that sitectl merges with core validation results before writing the final report.
func (*SDK) ResolveComposeCreateRequest ¶ added in v0.15.0
func (*SDK) SetVersionInfo ¶ added in v0.6.1
SetVersionInfo formats plugin version metadata like the main sitectl binary.
type SetRunner ¶ added in v0.16.0
type SetRunner interface {
BindFlags(cmd *cobra.Command)
Run(cmd *cobra.Command, args []string, ctx *config.Context) error
}
SetRunner implements plugin-specific component state management. Run applies the requested state or disposition to the named component.
type ValidateRunner ¶ added in v0.16.0
type ValidateRunner interface {
BindFlags(cmd *cobra.Command)
Run(cmd *cobra.Command, ctx *config.Context) ([]sitevalidate.Result, error)
}
ValidateRunner implements plugin-specific context validation. Run returns a list of validation results for the active context.