Documentation ¶
Overview ¶
Package plugininventory implements an interface to deal with a plugin inventory. It encapsulates the logic that deals with how plugin inventories are stored so that other entities can use the plugin inventory without knowing its implementation details.
Index ¶
- Constants
- Variables
- type PluginGroup
- type PluginGroupPluginEntry
- type PluginIdentifier
- type PluginInventory
- type PluginInventoryEntry
- type PluginInventoryFilter
- type SQLiteInventory
- func (b *SQLiteInventory) CreateSchema() error
- func (b *SQLiteInventory) GetAllGroups() ([]*PluginGroup, error)
- func (b *SQLiteInventory) GetAllPlugins() ([]*PluginInventoryEntry, error)
- func (b *SQLiteInventory) GetPlugins(filter *PluginInventoryFilter) ([]*PluginInventoryEntry, error)
- func (b *SQLiteInventory) InsertPlugin(pluginInventoryEntry *PluginInventoryEntry) error
- func (b *SQLiteInventory) InsertPluginGroup(pg *PluginGroup, override bool) error
- func (b *SQLiteInventory) UpdatePluginActivationState(pluginInventoryEntry *PluginInventoryEntry) error
- func (b *SQLiteInventory) UpdatePluginGroupActivationState(pg *PluginGroup) error
Constants ¶
const ( // SQliteDBFileName is the name of the DB file that is stored in // the OCI image describing the inventory of plugins. SQliteDBFileName = "plugin_inventory.db" )
Variables ¶
var ( // CreateTablesSchema defines the database schema to create sqlite database CreateTablesSchema = strings.TrimSpace(createTablesSchema) )
Functions ¶
This section is empty.
Types ¶
type PluginGroup ¶ added in v0.0.4
type PluginGroup struct { // Vendor of the group Vendor string // Publisher of the group Publisher string // Name of the group Name string // Hidden tells whether the plugin-group should be ignored by the CLI. Hidden bool // The list of plugins specified by this group Plugins []*PluginGroupPluginEntry }
PluginGroup represents a list of plugins. The user will specify a group using "<Vendor>-<Publisher>/<Name> e.g., "vmware-tkg/v2.1.0"
type PluginGroupPluginEntry ¶ added in v0.0.11
type PluginGroupPluginEntry struct { // The plugin version of this plugin entry PluginIdentifier // Mandatory specifies if the plugin is required to be installed or not Mandatory bool }
PluginGroupPluginEntry represents a plugin entry within a plugin group
type PluginIdentifier ¶ added in v0.0.4
type PluginIdentifier struct { // Name is the name of the plugin Name string // Target is the target of the plugin Target configtypes.Target // Version is the version for the plugin Version string }
PluginIdentifier uniquely identifies a single version of a specific plugin
type PluginInventory ¶
type PluginInventory interface { // GetAllPlugins returns all plugins found in the inventory. GetAllPlugins() ([]*PluginInventoryEntry, error) // GetPlugins returns the plugins found in the inventory that match the provided filter. GetPlugins(*PluginInventoryFilter) ([]*PluginInventoryEntry, error) // GetAllGroups returns all plugin groups found in the inventory. GetAllGroups() ([]*PluginGroup, error) // CreateSchema creates table schemas to the provided database. // returns error if table creation fails for any reason CreateSchema() error // InsertPlugin inserts plugin to the inventory InsertPlugin(*PluginInventoryEntry) error // InsertPluginGroup inserts plugin-group to the inventory // if override is true, it will update the existing plugin by // updating the metadata and the plugin associated with the plugin-group InsertPluginGroup(pg *PluginGroup, override bool) error // UpdatePluginActivationState updates plugin metadata to activate or deactivate plugin UpdatePluginActivationState(*PluginInventoryEntry) error // UpdatePluginGroupActivationState updates plugin-group metadata to activate or deactivate the plugin-group UpdatePluginGroupActivationState(*PluginGroup) error }
PluginInventory is the interface to interact with a plugin inventory. It can be used to get the plugin information for plugins in the inventory based on different criteria.
func NewSQLiteInventory ¶
func NewSQLiteInventory(inventoryFile, prefix string) PluginInventory
NewSQLiteInventory returns a new PluginInventory connected to the data found at 'inventoryFile'.
type PluginInventoryEntry ¶
type PluginInventoryEntry struct { // Name of the plugin Name string // Target to which the plugin applies Target configtypes.Target // Description of the plugin Description string // Publisher is the name of the publisher of this plugin // (e.g., a product group within a company) Publisher string // Vendor is the name of the vendor of this plugin (e.g., a company's name) Vendor string // Recommended version that Tanzu CLI should install by default. // The value should be a valid semantic version as defined in // https://semver.org/. E.g., 2.0.1 RecommendedVersion string // Hidden tells whether the plugin is marked as hidden or not. Hidden bool // Artifacts contains an artifact list for every available version. Artifacts distribution.Artifacts }
PluginInventoryEntry represents the inventory information about a single plugin as found by the inventory backend.
type PluginInventoryFilter ¶ added in v0.0.4
type PluginInventoryFilter struct { // Name of the plugin to look for Name string // Target to which the plugins apply Target configtypes.Target // Version for the plugins to look for Version string // OS of the plugin binary in `GOOS` format. OS string // Arch of the plugin binary in `GOARCH` format. Arch string // Publisher of the plugins to look for Publisher string // Vendor the plugins to look for Vendor string }
PluginInventoryFilter allows to specify different criteria for looking up plugin entries.
type SQLiteInventory ¶
type SQLiteInventory struct {
// contains filtered or unexported fields
}
SQLiteInventory is an inventory stored using SQLite
func (*SQLiteInventory) CreateSchema ¶ added in v0.0.4
func (b *SQLiteInventory) CreateSchema() error
CreateSchema creates table schemas to the provided database. returns error if table creation fails for any reason
func (*SQLiteInventory) GetAllGroups ¶ added in v0.0.4
func (b *SQLiteInventory) GetAllGroups() ([]*PluginGroup, error)
func (*SQLiteInventory) GetAllPlugins ¶
func (b *SQLiteInventory) GetAllPlugins() ([]*PluginInventoryEntry, error)
GetAllPlugins returns all plugins found in the inventory.
func (*SQLiteInventory) GetPlugins ¶ added in v0.0.4
func (b *SQLiteInventory) GetPlugins(filter *PluginInventoryFilter) ([]*PluginInventoryEntry, error)
GetPlugins returns the plugin found in the inventory that matches the provided parameters.
func (*SQLiteInventory) InsertPlugin ¶ added in v0.0.4
func (b *SQLiteInventory) InsertPlugin(pluginInventoryEntry *PluginInventoryEntry) error
InsertPlugin inserts plugin to the inventory
func (*SQLiteInventory) InsertPluginGroup ¶ added in v0.0.11
func (b *SQLiteInventory) InsertPluginGroup(pg *PluginGroup, override bool) error
InsertPluginGroup inserts plugin-group to the inventory specifying override will delete the existing plugin-group and add new one
func (*SQLiteInventory) UpdatePluginActivationState ¶ added in v0.0.4
func (b *SQLiteInventory) UpdatePluginActivationState(pluginInventoryEntry *PluginInventoryEntry) error
UpdatePluginActivationState updates plugin metadata to activate or deactivate plugin
func (*SQLiteInventory) UpdatePluginGroupActivationState ¶ added in v0.0.11
func (b *SQLiteInventory) UpdatePluginGroupActivationState(pg *PluginGroup) error