Documentation
¶
Overview ¶
Package plugin is used to manage the execution of Phobos plugins
Index ¶
- func AreProtocolsSupported(protocols []string) error
- type Installer
- type InstallerOption
- type LaunchOption
- type Manager
- type MockManager
- func (_m *MockManager) Close()
- func (_m *MockManager) GetPlugin(name string) (*PipelinePlugin, error)
- func (_m *MockManager) GetPlugins() []*PipelinePlugin
- func (_m *MockManager) GetVersionForBuiltInPlugins(ctx context.Context) (string, error)
- func (_m *MockManager) LaunchPlugin(ctx context.Context, source string, options ...LaunchOption) error
- type PipelinePlugin
- func (p *PipelinePlugin) Close()
- func (p *PipelinePlugin) Configure(ctx context.Context, body hcl.Body, evalCtx *hcl.EvalContext) hcl.Diagnostics
- func (p *PipelinePlugin) ExecuteAction(ctx context.Context, actionName string, body hcl.Body, ...) (map[string]cty.Value, error)
- func (p *PipelinePlugin) GetImpliedActionOutputs(ctx context.Context, actionName string) (map[string]cty.Value, error)
- func (p *PipelinePlugin) GracefulShutdown(ctx context.Context) error
- func (p *PipelinePlugin) ValidateActionInput(ctx context.Context, actionName string, body hcl.Body, ...) hcl.Diagnostics
- func (p *PipelinePlugin) ValidateConfig(ctx context.Context, body hcl.Body, evalCtx *hcl.EvalContext) hcl.Diagnostics
- type RegistryPluginDownloadResponse
- type RegistryPluginPlatform
- type RegistryPluginVersion
- type RegistryPluginVersionList
- type Source
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreProtocolsSupported ¶
AreProtocolsSupported checks if the given protocols are supported.
Types ¶
type Installer ¶
type Installer interface {
EnsureLatestVersion(ctx context.Context, source string, opts ...InstallerOption) (string, error)
InstallPlugin(ctx context.Context, source, version string, opts ...InstallerOption) error
}
Installer is the interface for installing plugins
type InstallerOption ¶
type InstallerOption func(*installerOptions)
InstallerOption is a function that configures the installer.
func WithConstraints ¶
func WithConstraints(constraints *string) InstallerOption
WithConstraints sets the version constraints for the installer. Only applicable for EnsureLatestVersion.
func WithToken ¶
func WithToken(token *string) InstallerOption
WithToken sets the token for the installer.
type LaunchOption ¶
type LaunchOption func(*launchOptions)
LaunchOption is a function that modifies the launch options
func WithBinaryPath ¶
func WithBinaryPath(path string) LaunchOption
WithBinaryPath indicates the path for a local plugin binary which will be used to launch the plugin instead.
func WithDir ¶
func WithDir(dir string) LaunchOption
WithDir will become the working directory of the plugin's command.
func WithVersion ¶
func WithVersion(version string) LaunchOption
WithVersion sets the plugin version. Required when using a plugin from a remote registry.
type Manager ¶
type Manager interface {
Close()
GetPlugins() []*PipelinePlugin
GetPlugin(name string) (*PipelinePlugin, error)
GetVersionForBuiltInPlugins(ctx context.Context) (string, error)
LaunchPlugin(ctx context.Context, source string, options ...LaunchOption) error
}
Manager manages plugin execution and lifecycle
type MockManager ¶
MockManager is an autogenerated mock type for the Manager type
func NewMockManager ¶
func NewMockManager(t interface {
mock.TestingT
Cleanup(func())
}) *MockManager
NewMockManager creates a new instance of MockManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockManager) Close ¶
func (_m *MockManager) Close()
Close provides a mock function with no fields
func (*MockManager) GetPlugin ¶
func (_m *MockManager) GetPlugin(name string) (*PipelinePlugin, error)
GetPlugin provides a mock function with given fields: name
func (*MockManager) GetPlugins ¶
func (_m *MockManager) GetPlugins() []*PipelinePlugin
GetPlugins provides a mock function with no fields
func (*MockManager) GetVersionForBuiltInPlugins ¶ added in v0.3.0
func (_m *MockManager) GetVersionForBuiltInPlugins(ctx context.Context) (string, error)
GetVersionForBuiltInPlugins provides a mock function with given fields: ctx
func (*MockManager) LaunchPlugin ¶
func (_m *MockManager) LaunchPlugin(ctx context.Context, source string, options ...LaunchOption) error
LaunchPlugin provides a mock function with given fields: ctx, source, options
type PipelinePlugin ¶
type PipelinePlugin struct {
// contains filtered or unexported fields
}
PipelinePlugin wraps a provider plugin instance and encapsulates functionality for interfacing with a provider
func NewPipelinePlugin ¶
func NewPipelinePlugin(instance component.PipelinePlugin, log hclog.Logger, closeFn func()) *PipelinePlugin
NewPipelinePlugin creates a new instance of a PipelinePlugin
func (*PipelinePlugin) Configure ¶
func (p *PipelinePlugin) Configure(ctx context.Context, body hcl.Body, evalCtx *hcl.EvalContext) hcl.Diagnostics
Configure configures a provider instance with an hcl config
func (*PipelinePlugin) ExecuteAction ¶
func (p *PipelinePlugin) ExecuteAction(ctx context.Context, actionName string, body hcl.Body, evalCtx *hcl.EvalContext, ui terminal.UI) (map[string]cty.Value, error)
ExecuteAction executes a provider action and returns the outputs
func (*PipelinePlugin) GetImpliedActionOutputs ¶
func (p *PipelinePlugin) GetImpliedActionOutputs(ctx context.Context, actionName string) (map[string]cty.Value, error)
GetImpliedActionOutputs returns the implied outputs for an action without executing it. This is used primarily for validation
func (*PipelinePlugin) GracefulShutdown ¶
func (p *PipelinePlugin) GracefulShutdown(ctx context.Context) error
GracefulShutdown gracefully stops the provider actions
func (*PipelinePlugin) ValidateActionInput ¶
func (p *PipelinePlugin) ValidateActionInput(ctx context.Context, actionName string, body hcl.Body, evalCtx *hcl.EvalContext) hcl.Diagnostics
ValidateActionInput validates the hcl config against the action input struct
func (*PipelinePlugin) ValidateConfig ¶
func (p *PipelinePlugin) ValidateConfig(ctx context.Context, body hcl.Body, evalCtx *hcl.EvalContext) hcl.Diagnostics
ValidateConfig validates a provider hcl config
type RegistryPluginDownloadResponse ¶
type RegistryPluginDownloadResponse struct {
OperatingSystem string `json:"os"`
Arch string `json:"arch"`
Filename string `json:"filename"`
DownloadURL string `json:"download_url"`
SHASumsURL string `json:"shasums_url"`
SHASum string `json:"shasum"`
Protocols []string `json:"protocols"`
}
RegistryPluginDownloadResponse is the response for downloading a plugin.
type RegistryPluginPlatform ¶
RegistryPluginPlatform represents a platform for a plugin version
type RegistryPluginVersion ¶
type RegistryPluginVersion struct {
Version string `json:"version"`
Protocols []string `json:"protocols"`
Platforms []RegistryPluginPlatform `json:"platforms"`
}
RegistryPluginVersion represents a plugin version
type RegistryPluginVersionList ¶
type RegistryPluginVersionList struct {
Versions []RegistryPluginVersion `json:"versions"`
}
RegistryPluginVersionList contains a list of plugin versions
type Source ¶
Source defines the plugin Source with three parts (hostname, organization, name). The hostname is optional and defaults to the default registry URL.
func ParseSource ¶
ParseSource parses the plugin source and returns the provider.