pluggable

package
v0.22.0-beta.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry interface {
	GetName() string
	GetPluginSubKey() string
	GetConfig() interface{}
}

Entry defines a configuration entry for an item that that can be managed by a plugin.

type PluginLoader

type PluginLoader struct {
	*config.Config

	SelectedPluginKey    *plugins.PluginKey
	SelectedPluginConfig interface{}
}

PluginLoader handles finding, configuring and loading porter plugins.

func NewPluginLoader

func NewPluginLoader(c *config.Config) *PluginLoader

func (*PluginLoader) Load

func (l *PluginLoader) Load(pluginType PluginTypeConfig) (interface{}, func(), error)

Load a plugin, returning the plugin's interface which the caller must then cast to the typed interface, a cleanup function to stop the plugin when finished communicating with it, and an error if the plugin could not be loaded.

type PluginTypeConfig

type PluginTypeConfig struct {
	// Name of the plugin type interface.
	Interface string

	// Plugin to communicate with the plugin
	Plugin plugin.Plugin

	// GetDefaultPluggable is the function on porter's config.Data
	// to retrieve a pluggable configuration value's named default instance to use, e.g. "default-instance-store"
	GetDefaultPluggable func(datastore *config.Data) string

	// GetPluggable is the function on porter's config.Data
	// to retrieve a named pluggable instance, e.g. an instance-store named "azure"
	GetPluggable func(datastore *config.Data, name string) (Entry, error)

	// GetDefaultPlugin is the function on porter's config.Data
	// to retrieve the default plugin to use for a type of plugin, e.g. "instance-storage-plugin"
	GetDefaultPlugin func(datastore *config.Data) string
}

PluginTypeConfig defines a set of functions to access a type of plugin's data in the porter config file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL