plugin

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	Plugin Plugin
	// contains filtered or unexported fields
}

func NewContainer

func NewContainer(newPlugin NewFunc) (Container, error)

func (*Container) ValidateSpec

func (pc *Container) ValidateSpec(pluginSpec map[string]interface{}) (ValidationResult, error)

type Context added in v1.0.0

type Context struct {
	// Namespace is the namespace where the returned object will be created.
	Namespace string
	// Actual is the actual object that will be updated if it exists already.
	// nil if the object does not exist.
	Actual runtime.Object
	// Dependencies is the map from dependency name to a description of that dependency.
	Dependencies map[smith_v1.ResourceName]Dependency
}

Context contains contextual information for the Process() call.

type Dependency

type Dependency struct {
	// Spec is the specification of the resource as specified in the Bundle.
	Spec smith_v1.Resource
	// Actual is the actual dependency object.
	Actual runtime.Object
	// Outputs are objects produced by the actual object.
	Outputs []runtime.Object
	// Auxiliary are objects that somehow relate to the actual object.
	Auxiliary []runtime.Object
}

Dependency contains information about a dependency of a resource that a plugin is processing.

type Description added in v1.0.0

type Description struct {
	Name smith_v1.PluginName
	GVK  schema.GroupVersionKind
	// gojsonschema supported schema for the spec (first argument of Process)
	SpecSchema []byte
}

type NewFunc added in v1.0.0

type NewFunc func() (Plugin, error)

NewFunc is a factory function that returns an initialized plugin. Called once on Smith startup.

type Plugin added in v1.0.0

type Plugin interface {
	// Describe returns information about the plugin.
	Describe() *Description
	// Process processes a plugin specification and produces an object as the result.
	Process(map[string]interface{}, *Context) ProcessResult
}

Plugin represents a plugin and the functionality it provides.

type ProcessResult

type ProcessResult interface {
	StatusType() ProcessResultType
}

ProcessResult contains result of the Process() call.

type ProcessResultFailure

type ProcessResultFailure struct {
	Error            error
	IsExternalError  bool
	IsRetriableError bool
}

func (*ProcessResultFailure) StatusType

func (r *ProcessResultFailure) StatusType() ProcessResultType

type ProcessResultSuccess

type ProcessResultSuccess struct {
	// Object is the object that should be created/updated.
	Object runtime.Object
}

func (*ProcessResultSuccess) StatusType

func (r *ProcessResultSuccess) StatusType() ProcessResultType

type ProcessResultType

type ProcessResultType string
const (
	ProcessResultSuccessType ProcessResultType = "Success"
	ProcessResultFailureType ProcessResultType = "Failure"
)

type ValidationResult

type ValidationResult struct {
	Errors []error
}

Jump to

Keyboard shortcuts

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