taskplugin

package
v1.16.2 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: BSD-3-Clause Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	HTTPStatus  = "HTTPStatus"
	HTTPHeaders = "HTTPHeaders"
	HTTPCookies = "HTTPCookies"
)

common metadata keys

Variables

This section is empty.

Functions

func WithConfig

func WithConfig(configCheckFunc ConfigFunc, configObj interface{}) func(*PluginOpt)

WithConfig defines the configuration struct and validation function for a plugin

func WithContext

func WithContext(contextObj interface{}) func(*PluginOpt)

WithContext defines the context object expected by the plugin

func WithContextFunc

func WithContextFunc(contextFunc func(string) interface{}) func(*PluginOpt)

WithContextFunc defines a context-generating function

func WithExecutorMetadata

func WithExecutorMetadata(metadataFunc func() string) func(*PluginOpt)

WithExecutorMetadata defines a jsonschema-generating function

func WithResources added in v1.6.0

func WithResources(resourcesFunc func(interface{}) []string) func(*PluginOpt)

WithResources defines a function indicating what resources will be needed by the plugin

func WithTags added in v1.5.0

func WithTags(fn tagsFunc) func(*PluginOpt)

WithTags defines a function to manipulate the tags of a task.

Types

type ConfigFunc

type ConfigFunc func(interface{}) error

ConfigFunc is a type of function to validate the contents of a configuration payload

type ExecFunc

type ExecFunc func(string, interface{}, interface{}) (interface{}, interface{}, error)

ExecFunc is a type of function to be implemented by a plugin to perform an action in a task

type MetadataSchemaBuilder

type MetadataSchemaBuilder struct {
	// contains filtered or unexported fields
}

MetadataSchemaBuilder is a helper to generate jsonschema for a metadata payload

func NewMetadataSchema

func NewMetadataSchema() *MetadataSchemaBuilder

NewMetadataSchema instantiates a new metadataSchemaBuilder

func (*MetadataSchemaBuilder) String

func (m *MetadataSchemaBuilder) String() string

String renders a json schema for metadata

func (*MetadataSchemaBuilder) WithHeaders

func (m *MetadataSchemaBuilder) WithHeaders(headers ...string) *MetadataSchemaBuilder

WithHeaders adds httpHeader fields to metadata

func (*MetadataSchemaBuilder) WithStatusCode

func (m *MetadataSchemaBuilder) WithStatusCode() *MetadataSchemaBuilder

WithStatusCode adds an HTTPStatus field to metadata

type PluginExecutor

type PluginExecutor struct {
	// contains filtered or unexported fields
}

PluginExecutor is a structure to generate action executors from different implementations builtin or loaded as custom extensions

func New

func New(pluginName string, pluginVersion string, execfunc ExecFunc, opts ...func(*PluginOpt)) PluginExecutor

New generates a step action executor from a given plugin

func (PluginExecutor) Context

func (r PluginExecutor) Context(stepName string) interface{}

Context generates a context payload to pass to Exec()

func (PluginExecutor) Exec

func (r PluginExecutor) Exec(stepName string, baseConfig json.RawMessage, config json.RawMessage, ctx interface{}) (interface{}, interface{}, map[string]string, error)

Exec performs the action implemented by the executor

func (PluginExecutor) MetadataSchema

func (r PluginExecutor) MetadataSchema() json.RawMessage

MetadataSchema returns json schema to validate the metadata returned on execution

func (PluginExecutor) PluginName

func (r PluginExecutor) PluginName() string

PluginName returns a plugin's name

func (PluginExecutor) PluginVersion

func (r PluginExecutor) PluginVersion() string

PluginVersion returns a plugin's version

func (PluginExecutor) Resources added in v1.6.0

func (r PluginExecutor) Resources(baseConfig json.RawMessage, config json.RawMessage) []string

Resources returns a list of resources to be used by uTask engine for this plugin

func (PluginExecutor) ValidConfig

func (r PluginExecutor) ValidConfig(baseConfig json.RawMessage, config json.RawMessage) error

ValidConfig asserts that a given configuration payload complies with the executor's definition

type PluginOpt

type PluginOpt struct {
	// contains filtered or unexported fields
}

PluginOpt is a helper struct to customize an action executor

Jump to

Keyboard shortcuts

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