echo

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: BSD-3-Clause Imports: 2 Imported by: 0

README

echo Plugin

This plugin returns the output defined in its configuration, without performing any kind of work. It is useful for transforming and aggregating previous results, and for running tests on the engine.

Configuration

Field Description
output an object with the complete output of the step
metadata an object containing the metadata returned by the step
error_message for testing purposes, an error message to simulate execution failure
error_type (client/server) for testing purposes: client error blocks execution, server lets the step be retried

Example

An action of type echo requires the following kind of configuration. The default outcome is a successful step: by adding an error_message, the step will consider the action a failure and set the step in SERVER_ERROR state. This is the default error type, which will cause the step to be elligible for retry. To block the task, error_type can be set to client, causing the step state to be set to CLIENT_ERROR.

action:
  type: echo
  configuration:
    output: # an arbitrary yaml object representing the final output of the step
      foo: '{{.input.foo}}-suffix'
      bar: 'prefix-{{.input.bar}}'
    metadata: # an arbitrary yaml object representing the step's returned metadata
      HTTPStatus: 200
    error_message: Epic fail! # an arbitrary error message
    error_type: client # client|server   

Requirements

None.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Plugin = taskplugin.New("echo", "0.1", exec,
		taskplugin.WithConfig(validConfig, Config{}),
	)
)

the echo plugin is used to "manually" build result payloads allowing to aggregate several results in a consolidated structure

Functions

This section is empty.

Types

type Config

type Config struct {
	Output       interface{}            `json:"output"`
	Metadata     map[string]interface{} `json:"metadata"`
	ErrorMessage string                 `json:"error_message"`
	ErrorType    string                 `json:"error_type"` // default if empty: server -> ie. retry
}

Config describes transparently the outcome of execution output: an arbitrary object, equivalent to a successful return metadata: the metadata returned by execution, if any error_message: the outcome of a non-successful execution error_type: choose between client|server, to trigger different behavior (blocked VS retry)

Jump to

Keyboard shortcuts

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