Documentation ¶
Index ¶
- Constants
- func FlagsetFromConfigurationOptions(param ConfigurationOptions) *pflag.FlagSet
- func GetCommandFromWorkflowIdentifier(id Identifier) string
- func JsonFromConfigurationOptions(param ConfigurationOptions) []byte
- type Callback
- type ConfigurationOptions
- type ConfigurationOptionsImpl
- type Data
- type DataImpl
- func (d *DataImpl) AddError(err snyk_errors.Error)
- func (d *DataImpl) GetContentLocation() string
- func (d *DataImpl) GetContentType() string
- func (d *DataImpl) GetErrorList() []snyk_errors.Error
- func (d *DataImpl) GetIdentifier() Identifier
- func (d *DataImpl) GetMetaData(key string) (string, error)
- func (d *DataImpl) GetPayload() interface{}
- func (d *DataImpl) SetContentLocation(location string)
- func (d *DataImpl) SetMetaData(key string, value string)
- func (d *DataImpl) SetPayload(payload interface{})
- func (d *DataImpl) String() string
- type Engine
- type EngineImpl
- func (e *EngineImpl) AddExtensionInitializer(initializer ExtensionInit)
- func (e *EngineImpl) GetAnalytics() analytics.Analytics
- func (e *EngineImpl) GetConfiguration() configuration.Configuration
- func (e *EngineImpl) GetLogger() *zerolog.Logger
- func (e *EngineImpl) GetNetworkAccess() networking.NetworkAccess
- func (e *EngineImpl) GetRuntimeInfo() runtimeinfo.RuntimeInfo
- func (e *EngineImpl) GetUserInterface() ui.UserInterface
- func (e *EngineImpl) GetWorkflow(id Identifier) (Entry, bool)
- func (e *EngineImpl) GetWorkflows() []Identifier
- func (e *EngineImpl) Init() error
- func (e *EngineImpl) Invoke(id Identifier) ([]Data, error)
- func (e *EngineImpl) InvokeWithConfig(id Identifier, config configuration.Configuration) ([]Data, error)
- func (e *EngineImpl) InvokeWithInput(id Identifier, input []Data) ([]Data, error)
- func (e *EngineImpl) InvokeWithInputAndConfig(id Identifier, input []Data, config configuration.Configuration) ([]Data, error)
- func (e *EngineImpl) Register(id Identifier, config ConfigurationOptions, entryPoint Callback) (Entry, error)
- func (e *EngineImpl) SetConfiguration(config configuration.Configuration)
- func (e *EngineImpl) SetLogger(logger *zerolog.Logger)
- func (e *EngineImpl) SetRuntimeInfo(ri runtimeinfo.RuntimeInfo)
- func (e *EngineImpl) SetUserInterface(userInterface ui.UserInterface)
- type Entry
- type EntryImpl
- type ExtensionInit
- type Identifier
- type InvocationContext
- type Location
- type Option
- type PayloadLocation
Constants ¶
const ( Content_type_key string = "Content-Type" Content_location_key string = "Content-Location" )
Variables ¶
This section is empty.
Functions ¶
func FlagsetFromConfigurationOptions ¶
func FlagsetFromConfigurationOptions(param ConfigurationOptions) *pflag.FlagSet
FlagsetFromConfigurationOptions extracts the pflag.FlagSet from a ConfigurationOptions implementation.
func GetCommandFromWorkflowIdentifier ¶
func GetCommandFromWorkflowIdentifier(id Identifier) string
GetCommandFromWorkflowIdentifier returns the command string from a workflow identifier. It returns an empty string if the identifier is not a workflow identifier.
func JsonFromConfigurationOptions ¶
func JsonFromConfigurationOptions(param ConfigurationOptions) []byte
Types ¶
type ConfigurationOptions ¶
type ConfigurationOptions interface { }
ConfigurationOptions is an interface that can be implemented by any type that can be used to pass configuration options to a workflow.
func ConfigurationOptionsFromFlagset ¶
func ConfigurationOptionsFromFlagset(flagset *pflag.FlagSet) ConfigurationOptions
ConfigurationOptionsFromFlagset implements the ConfigurationOptions interface. It returns a ConfigurationOptionsImpl instance that wraps the given pflag.FlagSet.
func ConfigurationOptionsFromJson ¶
func ConfigurationOptionsFromJson(bytes []byte) ConfigurationOptions
func GetGlobalConfiguration ¶
func GetGlobalConfiguration() ConfigurationOptions
GetGlobalConfiguration returns the global configuration options.
type ConfigurationOptionsImpl ¶
type ConfigurationOptionsImpl struct {
// contains filtered or unexported fields
}
ConfigurationOptionsImpl is a wrapper around a pflag.FlagSet.
type Data ¶
type Data interface { SetMetaData(key string, value string) GetMetaData(key string) (string, error) SetPayload(payload interface{}) GetPayload() interface{} GetIdentifier() Identifier GetContentType() string GetContentLocation() string SetContentLocation(string) AddError(err snyk_errors.Error) GetErrorList() []snyk_errors.Error }
Data is an interface that wraps the methods that are used to manage data that is passed between workflows.
func NewData ¶
func NewData(id Identifier, contentType string, payload interface{}, opts ...Option) Data
NewData creates a new data instance.
It accepts optional parameters to configure the data instance.
It will preserve the headers, metadata and errors
func NewDataFromInput
deprecated
func NewDataFromInput(input Data, typeIdentifier Identifier, contentType string, payload interface{}, opts ...Option) Data
Deprecated: Use NewData with workflow.WithInputData() option instead
NewDataFromInput creates a new data instance from the given input data.
It will preserve the headers, metadata and errors
type DataImpl ¶
type DataImpl struct {
// contains filtered or unexported fields
}
DataImpl is the default implementation of the Data interface.
func (*DataImpl) AddError ¶
func (d *DataImpl) AddError(err snyk_errors.Error)
func (*DataImpl) GetContentLocation ¶
GetContentLocation returns the Content-Location header of the given data instance.
func (*DataImpl) GetContentType ¶
GetContentType returns the Content-Type header of the given data instance.
func (*DataImpl) GetErrorList ¶
func (d *DataImpl) GetErrorList() []snyk_errors.Error
func (*DataImpl) GetIdentifier ¶
func (d *DataImpl) GetIdentifier() Identifier
GetIdentifier returns the identifier of the given data instance.
func (*DataImpl) GetMetaData ¶
GetMetaData returns the value of the given header key.
func (*DataImpl) GetPayload ¶
func (d *DataImpl) GetPayload() interface{}
GetPayload returns the payload of the given data instance.
func (*DataImpl) SetContentLocation ¶
SetContentLocation sets the Content-Location header of the given data instance.
func (*DataImpl) SetMetaData ¶
SetMetaData sets the headers of the given data instance.
func (*DataImpl) SetPayload ¶
func (d *DataImpl) SetPayload(payload interface{})
SetPayload sets the payload of the given data instance.
type Engine ¶
type Engine interface { Init() error AddExtensionInitializer(initializer ExtensionInit) Register(id Identifier, config ConfigurationOptions, callback Callback) (Entry, error) GetWorkflows() []Identifier GetWorkflow(id Identifier) (Entry, bool) Invoke(id Identifier) ([]Data, error) InvokeWithInput(id Identifier, input []Data) ([]Data, error) InvokeWithConfig(id Identifier, config configuration.Configuration) ([]Data, error) InvokeWithInputAndConfig(id Identifier, input []Data, config configuration.Configuration) ([]Data, error) GetAnalytics() analytics.Analytics GetNetworkAccess() networking.NetworkAccess GetConfiguration() configuration.Configuration SetLogger(logger *zerolog.Logger) SetConfiguration(config configuration.Configuration) GetLogger() *zerolog.Logger GetUserInterface() ui.UserInterface SetUserInterface(ui ui.UserInterface) GetRuntimeInfo() runtimeinfo.RuntimeInfo SetRuntimeInfo(ri runtimeinfo.RuntimeInfo) }
Engine is the interface that wraps the methods that are used to manage workflows.
func NewDefaultWorkFlowEngine ¶
func NewDefaultWorkFlowEngine() Engine
NewDefaultWorkFlowEngine is an implementation of the Engine interface.
func NewWorkFlowEngine ¶
func NewWorkFlowEngine(configuration configuration.Configuration) Engine
NewWorkFlowEngine is an implementation of the Engine interface. It is called when creating a new app engine via CreateAppEngine().
type EngineImpl ¶
type EngineImpl struct {
// contains filtered or unexported fields
}
EngineImpl is the default implementation of the Engine interface.
func (*EngineImpl) AddExtensionInitializer ¶
func (e *EngineImpl) AddExtensionInitializer(initializer ExtensionInit)
AddExtensionInitializer adds an extension initializer to the engine.
func (*EngineImpl) GetAnalytics ¶
func (e *EngineImpl) GetAnalytics() analytics.Analytics
GetAnalytics returns the analytics object.
func (*EngineImpl) GetConfiguration ¶
func (e *EngineImpl) GetConfiguration() configuration.Configuration
GetConfiguration returns the configuration object.
func (*EngineImpl) GetLogger ¶
func (e *EngineImpl) GetLogger() *zerolog.Logger
func (*EngineImpl) GetNetworkAccess ¶
func (e *EngineImpl) GetNetworkAccess() networking.NetworkAccess
GetNetworkAccess returns the network access object.
func (*EngineImpl) GetRuntimeInfo ¶
func (e *EngineImpl) GetRuntimeInfo() runtimeinfo.RuntimeInfo
func (*EngineImpl) GetUserInterface ¶
func (e *EngineImpl) GetUserInterface() ui.UserInterface
func (*EngineImpl) GetWorkflow ¶
func (e *EngineImpl) GetWorkflow(id Identifier) (Entry, bool)
GetWorkflow returns the workflow entry for the given workflow identifier.
func (*EngineImpl) GetWorkflows ¶
func (e *EngineImpl) GetWorkflows() []Identifier
GetWorkflows returns a list of all registered workflows.
func (*EngineImpl) Init ¶
func (e *EngineImpl) Init() error
Init initializes the engine by setting up the necessary defaults.
func (*EngineImpl) Invoke ¶
func (e *EngineImpl) Invoke(id Identifier) ([]Data, error)
Invoke invokes the workflow with the given identifier.
func (*EngineImpl) InvokeWithConfig ¶
func (e *EngineImpl) InvokeWithConfig(id Identifier, config configuration.Configuration) ([]Data, error)
InvokeWithConfig invokes the workflow with the given identifier and configuration.
func (*EngineImpl) InvokeWithInput ¶
func (e *EngineImpl) InvokeWithInput(id Identifier, input []Data) ([]Data, error)
InvokeWithInput invokes the workflow with the given identifier and input data.
func (*EngineImpl) InvokeWithInputAndConfig ¶
func (e *EngineImpl) InvokeWithInputAndConfig( id Identifier, input []Data, config configuration.Configuration, ) ([]Data, error)
InvokeWithInputAndConfig invokes the workflow with the given identifier, input data and configuration.
func (*EngineImpl) Register ¶
func (e *EngineImpl) Register(id Identifier, config ConfigurationOptions, entryPoint Callback) (Entry, error)
Register registers a new workflow entry with the engine. In order to register a workflow, the following parameters are required: - id: the workflow identifier - config: the configuration options for the workflow - entryPoint: the entry point function for the workflow
func (*EngineImpl) SetConfiguration ¶
func (e *EngineImpl) SetConfiguration(config configuration.Configuration)
func (*EngineImpl) SetLogger ¶
func (e *EngineImpl) SetLogger(logger *zerolog.Logger)
func (*EngineImpl) SetRuntimeInfo ¶
func (e *EngineImpl) SetRuntimeInfo(ri runtimeinfo.RuntimeInfo)
func (*EngineImpl) SetUserInterface ¶
func (e *EngineImpl) SetUserInterface(userInterface ui.UserInterface)
type Entry ¶
type Entry interface { GetEntryPoint() Callback GetConfigurationOptions() ConfigurationOptions IsVisible() bool SetVisibility(visible bool) }
Entry is an interface that wraps the methods that are used to manage workflow entries.
type EntryImpl ¶
type EntryImpl struct {
// contains filtered or unexported fields
}
EntryImpl is the default implementation of the Entry interface.
func (*EntryImpl) GetConfigurationOptions ¶
func (e *EntryImpl) GetConfigurationOptions() ConfigurationOptions
GetConfigurationOptions returns the configuration options for the workflow entry.
func (*EntryImpl) GetEntryPoint ¶
GetEntryPoint returns the entry point callback for the workflow entry.
func (*EntryImpl) SetVisibility ¶
SetVisibility sets the visibility of the workflow entry.
type ExtensionInit ¶
type Identifier ¶
typedefs
func NewTypeIdentifier ¶
func NewTypeIdentifier(workflowID Identifier, dataType string) Identifier
NewTypeIdentifier creates a new type identifier represented in parsed URL format. It accepts a workflow identifier and a data type string which is used as the path part of the URL.
func NewWorkflowIdentifier ¶
func NewWorkflowIdentifier(command string) Identifier
NewWorkflowIdentifier creates a new workflow identifier represented in parsed URL format. It accepts a command param which is converted to a dot separated string and used as the host part of the URL.
type InvocationContext ¶
type InvocationContext interface { GetWorkflowIdentifier() Identifier GetConfiguration() configuration.Configuration GetEngine() Engine GetAnalytics() analytics.Analytics GetNetworkAccess() networking.NetworkAccess GetLogger() *log.Logger GetEnhancedLogger() *zerolog.Logger GetUserInterface() ui.UserInterface GetRuntimeInfo() runtimeinfo.RuntimeInfo }
InvocationContext is an interface that wraps various context information that is passed to a workflow when it is invoked.
func NewInvocationContext ¶
func NewInvocationContext( id Identifier, config configuration.Configuration, engine Engine, network networking.NetworkAccess, logger zerolog.Logger, analyticsImpl analytics.Analytics, ui ui.UserInterface, ) InvocationContext
type Location ¶
type Location struct { Path string Sha256 string Type PayloadLocation }
type Option ¶
type Option = func(d *DataImpl)
func WithConfiguration ¶
func WithConfiguration(config configuration.Configuration) Option