plugin

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterPlugins added in v0.12.2

func RegisterPlugins(pluginDir string, registry *operator.Registry) []error

RegisterPlugins adds every plugin in a directory to the global plugin registry

Types

type Config added in v0.12.2

type Config struct {
	helper.WriterConfig
	Plugin     *Plugin                `json:"-" yaml:"-"`
	Parameters map[string]interface{} `json:",squash" yaml:",squash"`
}

Config is the config values for the plugin

func (*Config) Build added in v0.13.0

func (c *Config) Build(bc operator.BuildContext) ([]operator.Operator, error)

Build implements operator.MultiBuilder

func (Config) MarshalJSON added in v0.12.3

func (c Config) MarshalJSON() ([]byte, error)

MarshalJSON marshals JSON

func (Config) MarshalYAML added in v0.12.2

func (c Config) MarshalYAML() (interface{}, error)

MarshalYAML marshals YAML

func (*Config) UnmarshalJSON added in v0.12.3

func (c *Config) UnmarshalJSON(raw []byte) error

UnmarshalJSON unmarshals JSON

func (*Config) UnmarshalYAML added in v0.12.2

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals YAML

type Definition added in v0.13.0

type Definition struct {
	Version            string      `json:"version"     yaml:"version"`
	Title              string      `json:"title"       yaml:"title"`
	Description        string      `json:"description" yaml:"description"`
	Parameters         []Parameter `json:"parameters"  yaml:"parameters"`
	MinStanzaVersion   string      `json:"minStanzaVersion" yaml:"min_stanza_version"`
	MaxStanzaVersion   string      `json:"maxStanzaVersion" yaml:"max_stanza_version"`
	SupportedPlatforms []string    `json:"supportedPlatforms" yaml:"supported_platforms"`
}

Definition contains metadata for rendering the plugin

type Parameter

type Parameter struct {
	Name        string `json:"name" yaml:"name"`
	Label       string `json:"label" yaml:"label"`
	Description string `json:"description" yaml:"description"`
	Required    bool   `json:"required" yaml:"required"`

	// "string", "int", "bool", "strings", or "enum"
	Type string `json:"type" yaml:"type"`

	// only useable if Type == "enum"
	ValidValues []string `json:"validValues" yaml:"valid_values"`

	// Must be valid according to Type & ValidValues
	Default        interface{}                       `json:"default" yaml:"default"`
	RelevantIf     map[string]map[string]interface{} `json:"relevantIf" yaml:"relevant_if"`
	Hidden         bool                              `json:"hidden" yaml:"hidden"`
	AdvancedConfig bool                              `json:"advancedConfig" yaml:"advanced_config"`
}

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

type Plugin

type Plugin struct {
	Definition `yaml:",inline"`
	ID         string `json:"id" yaml:"id"`
	Template   *template.Template
}

Plugin is the rendered result of a plugin template.

func NewPlugin added in v0.12.2

func NewPlugin(pluginID string, contents []byte) (*Plugin, error)

NewPlugin builds a new plugin from an ID and file contents

func NewPluginFromFile added in v0.12.2

func NewPluginFromFile(path string) (*Plugin, error)

NewPluginFromFile builds a new plugin from a file

func (*Plugin) NewBuilder added in v0.12.2

func (p *Plugin) NewBuilder() operator.Builder

NewBuilder creates a new, empty config that can build into an operator

func (*Plugin) Render added in v0.12.2

func (p *Plugin) Render(params map[string]interface{}) ([]byte, error)

Render will render a plugin's template with the given parameters

func (*Plugin) UnmarshalText added in v0.12.2

func (p *Plugin) UnmarshalText(text []byte) error

UnmarshalText unmarshals a plugin from a text file

func (*Plugin) Validate added in v0.12.2

func (p *Plugin) Validate(params map[string]interface{}) error

Validate checks the provided params against the parameter definitions to ensure they are valid

Jump to

Keyboard shortcuts

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