 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Variables
- func GetPluginsDir(appName string) string
- type ChainloopCliPlugin
- type ChainloopConfig
- type FlagInfo
- type LoadedPlugin
- type Manager
- type PlatformConfig
- type Plugin
- type PluginCommandInfo
- type PluginExecConfig
- type PluginExecResult
- type PluginMetadata
- type RPCClient
- type RPCServer
- type SimpleFlag
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 PlatformConfig ¶ added in v1.45.4
type PlatformConfig struct {
	API string
}
    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 ¶
type PluginCommandInfo struct {
	Name        string
	Description string
	Usage       string
	Flags       []*FlagInfo
	// Optional: if specified, this command will be added as a subcommand to the parent
	ParentCommand string
}
    PluginCommandInfo describes a command provided by the plugin
type PluginExecConfig ¶
type PluginExecConfig struct {
	Command string
	// Optional: the parent command if this is a subcommand
	ParentCommand   string
	Args            []string
	Flags           map[string]*SimpleFlag
	ChainloopConfig ChainloopConfig
	PlatformConfig  PlatformConfig
}
    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