Documentation ¶
Index ¶
- func DispatchCommand(args []string, path []string, root string) (string, []string, bool, error)
- func GetPluginsDir(root string) string
- func Help(root string)
- func RunFromManifest(pluginD, path string, args []string) error
- type DockerConfig
- type DockerInvoker
- type ExecutableInvoker
- type Invoker
- type InvokerConfig
- type Manifest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DispatchCommand ¶
DispatchCommand finds the manifest for the correct command, or instructs us to run "help". If neither case is appropriate, an error is returned.
func GetPluginsDir ¶
GetPluginsDir returns the default root of the plugins tree below a given root.
func RunFromManifest ¶
RunFromManifest reads a plugins manifest and then invokes it in line with the content of that manifest.
Types ¶
type DockerConfig ¶
DockerConfig contains options for customizing the docker invoker.
type DockerInvoker ¶
DockerInvoker invokes a plugin as a docker container.
func NewDockerInvoker ¶
func NewDockerInvoker(client *client.Client, stdout, stderr io.Writer) *DockerInvoker
NewDockerInvoker creates a configured DockerInvoker.
func (*DockerInvoker) Invoke ¶
func (d *DockerInvoker) Invoke(ctx context.Context, m *Manifest, cfg *InvokerConfig) error
Invoke the docker container based on the given manifest and config.
type ExecutableInvoker ¶
type ExecutableInvoker struct {
PluginDir string
}
ExecutableInvoker invokes a plugin as an executable.
func (*ExecutableInvoker) Invoke ¶
func (e *ExecutableInvoker) Invoke(ctx context.Context, m *Manifest, cfg *InvokerConfig) error
Invoke an executable described by the given manifest. The configuration can be used to pass args and environment variables to that executable.
type Invoker ¶
type Invoker interface {
Invoke(ctx context.Context, m *Manifest, cfg *InvokerConfig) error
}
Invoker invokes a plugin and passes it the given configuration.
type InvokerConfig ¶
InvokerConfig contains information passed to the invoked plugin.
type Manifest ¶
type Manifest struct { Invoker string `json:"invoker"` Exec string `json:"exec"` Docker DockerConfig `json:"docker"` Command []string `json:"command"` }
A Manifest describes a plugin information.
func LoadManifest ¶
LoadManifest reads the file found at the given path and decodes it into a manifest. The file must be JSON formatted.