plugin

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parameter

type Parameter struct {
	Label       string
	Description string
	Required    bool
	Type        string      // "string", "int", "bool", "strings", or "enum"
	ValidValues []string    `yaml:"valid_values"` // only useable if Type == "enum"
	Default     interface{} // Must be valid according to Type & ValidValues
}

Parameter is a basic description of a plugin's parameter.

type Plugin

type Plugin struct {
	Version     string
	Title       string
	Description string
	Parameters  map[string]Parameter
	Pipeline    []operator.Config
}

Plugin is the rendered result of a plugin template.

type Registry

type Registry map[string]*template.Template

Registry is a registry of plugin templates.

func NewPluginRegistry

func NewPluginRegistry(dir string) (Registry, error)

NewPluginRegistry creates a new plugin registry from a plugin directory.

func (Registry) Add

func (r Registry) Add(pluginType string, contents string) error

Add will add a plugin to the registry.

func (Registry) IsDefined

func (r Registry) IsDefined(pluginType string) bool

IsDefined returns a boolean indicating if a plugin is defined and registered.

func (Registry) Load

func (r Registry) Load(path string) error

Load will load a plugin template from a file path.

func (Registry) LoadAll

func (r Registry) LoadAll(dir string, pattern string) error

LoadAll will load all plugin templates contained in a directory.

func (Registry) Render

func (r Registry) Render(pluginType string, params map[string]interface{}) (Plugin, error)

Render will render a plugin using the params and plugin type.

Jump to

Keyboard shortcuts

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