Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Handshake = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "CHAINLOOP_CLI_PLUGIN",
MagicCookieValue: "chainloop-cli-plugin-v1",
}
Handshake is a common handshake that is shared by CLI plugins and the host.
var PluginMap = map[string]plugin.Plugin{ "chainloop": &ChainloopCliPlugin{}, }
PluginMap is the map of plugins.
Functions ¶
func GetPluginsDir ¶
Types ¶
type ChainloopCliPlugin ¶
type ChainloopCliPlugin struct {
Impl Plugin
}
ChainloopCliPlugin is the implementation of plugin.Plugin.
func (ChainloopCliPlugin) Client ¶
func (ChainloopCliPlugin) Client(_ *plugin.MuxBroker, c *rpc.Client) (interface{}, error)
func (*ChainloopCliPlugin) Server ¶
func (p *ChainloopCliPlugin) Server(*plugin.MuxBroker) (interface{}, error)
type ChainloopConfig ¶
type FlagInfo ¶
type FlagInfo struct { Name string Shorthand string Description string Type string Default any Required bool }
FlagInfo describes a command flag.
type LoadedPlugin ¶
type LoadedPlugin struct { Path string Plugin Plugin Metadata PluginMetadata }
LoadedPlugin represents a loaded plugin with its metadata.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles loading and managing plugins.
func NewManager ¶
NewManager creates a new plugin manager.
func (*Manager) GetAllPlugins ¶
func (m *Manager) GetAllPlugins() map[string]*LoadedPlugin
GetAllPlugins returns all loaded plugins.
func (*Manager) GetPlugin ¶
func (m *Manager) GetPlugin(name string) (*LoadedPlugin, bool)
GetPlugin returns a loaded plugin by name.
func (*Manager) LoadPlugins ¶
LoadPlugins loads all plugins from the plugins directory.
type Plugin ¶
type Plugin interface { // Exec executes a command within the plugin Exec(ctx context.Context, config PluginExecConfig) (*PluginExecResult, error) // GetMetadata returns plugin metadata including commands it provides GetMetadata(ctx context.Context) (PluginMetadata, error) }
Plugin is the interface that plugins must implement.
type PluginCommandInfo ¶
PluginCommandInfo describes a command provided by the plugin
type PluginExecConfig ¶
type PluginExecConfig struct { Command string Args []string Flags map[string]*SimpleFlag ChainloopConfig ChainloopConfig }
PluginExecConfig is the configuration for a plugin command execution.
type PluginExecResult ¶
type PluginMetadata ¶
type PluginMetadata struct { Name string Version string Description string Commands []*PluginCommandInfo }
PluginMetadata contains information about the plugin.
type RPCClient ¶
type RPCClient struct {
// contains filtered or unexported fields
}
RPCClient is an implementation of Plugin that talks over RPC.
func (*RPCClient) Exec ¶
func (m *RPCClient) Exec(_ context.Context, config PluginExecConfig) (*PluginExecResult, error)
func (*RPCClient) GetMetadata ¶
func (m *RPCClient) GetMetadata(_ context.Context) (PluginMetadata, error)
type RPCServer ¶
type RPCServer struct {
Impl Plugin
}
RPCServer is the RPC server that RPCClient talks to, conforming to the requirements of net/rpc.
func (*RPCServer) Exec ¶
func (m *RPCServer) Exec(config PluginExecConfig, resp *PluginExecResult) error
func (*RPCServer) GetMetadata ¶
func (m *RPCServer) GetMetadata(_ any, resp *PluginMetadata) error