get.porter.sh/porter@v1.3.0/pkg/plugins/pluggable/config.go (about)

     1  package pluggable
     2  
     3  import (
     4  	"get.porter.sh/porter/pkg/config"
     5  	"github.com/hashicorp/go-plugin"
     6  )
     7  
     8  // Entry defines a configuration entry for an item that can be managed by a plugin.
     9  type Entry interface {
    10  	GetName() string
    11  	GetPluginSubKey() string
    12  	GetConfig() interface{}
    13  }
    14  
    15  // PluginTypeConfig defines a set of functions to access a type of plugin's data in
    16  // the porter config file.
    17  type PluginTypeConfig struct {
    18  	// Name of the plugin type interface.
    19  	Interface string
    20  
    21  	// Plugin to communicate with the plugin
    22  	Plugin plugin.Plugin
    23  
    24  	// GetDefaultPluggable is the function on porter's configuration
    25  	// to retrieve a pluggable configuration value's named default instance to use, e.g. "default-storage"
    26  	GetDefaultPluggable func(c *config.Config) string
    27  
    28  	// GetPluggable is the function on porter's configuration
    29  	// to retrieve a named pluggable instance, e.g. a storage named "azure"
    30  	GetPluggable func(c *config.Config, name string) (Entry, error)
    31  
    32  	// GetDefaultPlugin is the function on porter's configuration
    33  	// to retrieve the default plugin to use for a type of plugin, e.g. "storage-plugin"
    34  	GetDefaultPlugin func(c *config.Config) string
    35  
    36  	// ProtocolVersion is the version of the protocol used by this plugin.
    37  	ProtocolVersion uint
    38  }