Documentation ¶
Index ¶
- Constants
- func WithConfig(configCheckFunc ConfigFunc, configObj interface{}) func(*PluginOpt)
- func WithContext(contextObj interface{}) func(*PluginOpt)
- func WithContextFunc(contextFunc func(string) interface{}) func(*PluginOpt)
- func WithExecutorMetadata(metadataFunc func() string) func(*PluginOpt)
- func WithResources(resourcesFunc func(interface{}) []string) func(*PluginOpt)
- func WithTags(fn tagsFunc) func(*PluginOpt)
- type ConfigFunc
- type ExecFunc
- type MetadataSchemaBuilder
- type PluginExecutor
- func (r PluginExecutor) Context(stepName string) interface{}
- func (r PluginExecutor) Exec(stepName string, baseConfig json.RawMessage, config json.RawMessage, ...) (interface{}, interface{}, map[string]string, error)
- func (r PluginExecutor) MetadataSchema() json.RawMessage
- func (r PluginExecutor) PluginName() string
- func (r PluginExecutor) PluginVersion() string
- func (r PluginExecutor) Resources(baseConfig json.RawMessage, config json.RawMessage) []string
- func (r PluginExecutor) ValidConfig(baseConfig json.RawMessage, config json.RawMessage) error
- type PluginOpt
Constants ¶
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 ¶
WithContextFunc defines a context-generating function
func WithExecutorMetadata ¶
WithExecutorMetadata defines a jsonschema-generating function
func WithResources ¶ added in v1.6.0
WithResources defines a function indicating what resources will be needed by the plugin
Types ¶
type ConfigFunc ¶
type ConfigFunc func(interface{}) error
ConfigFunc is a type of function to validate the contents of a configuration payload
type ExecFunc ¶
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