Documentation ¶
Overview ¶
Package catalog implements catalog management functions
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PluginNameTarget ¶
func PluginNameTarget(pluginName string, target configtypes.Target) string
PluginNameTarget constructs a string to uniquely refer to a plugin associated with a specific target when target is provided.
func UpdateCatalogCache ¶
func UpdateCatalogCache() error
UpdateCatalogCache when updating the core CLI from v0.x.x to v1.x.x. This is needed to group the standalone plugins by context type.
Types ¶
type Catalog ¶
type Catalog struct { // PluginInfos is a list of PluginInfo PluginInfos []*cli.PluginInfo `json:"pluginInfos,omitempty" yaml:"pluginInfos,omitempty"` // IndexByPath of PluginInfos for all installed plugins by installation path. IndexByPath map[string]cli.PluginInfo `json:"indexByPath,omitempty" yaml:"indexByPath,omitempty"` // IndeByName of all plugin installation paths by name. IndexByName map[string][]string `json:"indexByName,omitempty" yaml:"indexByName,omitempty"` // StandAlonePlugins is a set of stand-alone plugin installations aggregated across all context types. // Note: Shall be reduced to only those stand-alone plugins that are common to all context types. StandAlonePlugins PluginAssociation `json:"standAlonePlugins,omitempty" yaml:"standAlonePlugins,omitempty"` // ServerPlugins links a server and a set of associated plugin installations. ServerPlugins map[string]PluginAssociation `json:"serverPlugins,omitempty" yaml:"serverPlugins,omitempty"` }
Catalog is the Schema for the plugin catalog data
type CatalogList ¶
type CatalogList struct {
Items []Catalog `json:"items"`
}
CatalogList contains a list of Catalog
type ContextCatalog ¶
type ContextCatalog struct {
// contains filtered or unexported fields
}
ContextCatalog denotes a local plugin catalog for a given context or stand-alone.
func NewContextCatalog ¶
func NewContextCatalog(context string) (*ContextCatalog, error)
NewContextCatalog creates context-aware catalog
func (*ContextCatalog) Delete ¶
func (c *ContextCatalog) Delete(plugin string) error
Delete deletes the given plugin from the catalog, but it does not delete the installation.
func (*ContextCatalog) Get ¶
func (c *ContextCatalog) Get(plugin string) (cli.PluginInfo, bool)
Get looks up the descriptor of a plugin given its name.
func (*ContextCatalog) List ¶
func (c *ContextCatalog) List() []cli.PluginInfo
List returns the list of active plugins. Active plugin means the plugin that are available to the user based on the current logged-in server.
func (*ContextCatalog) Upsert ¶
func (c *ContextCatalog) Upsert(plugin *cli.PluginInfo) error
Upsert inserts/updates the given plugin.
type PluginAssociation ¶
PluginAssociation is a set of plugin names and their associated installation paths.
func (PluginAssociation) Add ¶
func (pa PluginAssociation) Add(pluginName, installationPath string)
Add adds plugin entry to the map
func (PluginAssociation) Get ¶
func (pa PluginAssociation) Get(pluginName string) string
Get returns installation path for the plugin If plugin doesn't exists in map it will return empty string
func (PluginAssociation) Map ¶
func (pa PluginAssociation) Map() map[string]string
Map returns associated list of plugins as a map
func (PluginAssociation) Remove ¶
func (pa PluginAssociation) Remove(pluginName string)
Remove deletes plugin entry from the map
type PluginCatalog ¶
type PluginCatalog interface { // Upsert inserts/updates the given plugin. Upsert(plugin cli.PluginInfo) // Get looks up the info of a plugin given its name. Get(pluginName string) (cli.PluginInfo, bool) // List returns the list of active plugins. // Active plugin means the plugin that are available to the user // based on the current logged-in server. List() []cli.PluginInfo // Delete deletes the given plugin from the catalog, but it does not delete the installation. Delete(plugin string) }
PluginCatalog is the interface to a collection of installed plugins.
type PluginSupplier ¶
type PluginSupplier interface { // GetInstalledPlugins returns a list of installed plugins GetInstalledPlugins() ([]*cli.PluginInfo, error) }
PluginSupplier is responsible for keeping an inventory of installed plugins