Documentation
¶
Index ¶
- Constants
- Variables
- func CreateLoopStack() loopStack
- type Action
- type ActionFunc
- type ActionOption
- func OptionActionAction(v string) ActionOption
- func OptionActionConfig(v map[string]interface{}) ActionOption
- func OptionActionContinueOnError(v interface{}) ActionOption
- func OptionActionDescription(v string) ActionOption
- func OptionActionDisabled(v bool) ActionOption
- func OptionActionFail(v string) ActionOption
- func OptionActionKey(v string) ActionOption
- type ActionSchema
- type Answer
- type Answers
- type DeleteConfigFunc
- type EventFunc
- type FunctionSchema
- type InlineFormatter
- type Job
- type JobOption
- type Manifest
- func (m *Manifest) DataModel() *go_data_chain.Data
- func (m *Manifest) GetGlobalAction(key string) *Action
- func (m *Manifest) GetJob(key string) *Job
- func (m *Manifest) GetParameter(key string) *Parameter
- func (m *Manifest) GlobalActionKeyExists(key string) bool
- func (m *Manifest) ParameterExists(key string) bool
- type ManifestOption
- type MetaData
- type MetaDataOption
- func OptionMetaDataAuthor(v string) MetaDataOption
- func OptionMetaDataContact(v string) MetaDataOption
- func OptionMetaDataCreatedDate(v string) MetaDataOption
- func OptionMetaDataDescription(v string) MetaDataOption
- func OptionMetaDataName(v string) MetaDataOption
- func OptionMetaDataUpdateDate(v string) MetaDataOption
- func OptionMetaDataVars(v map[string]interface{}) MetaDataOption
- func OptionMetaDataVersion(v string) MetaDataOption
- type Parameter
- type ParameterOption
- type ReadConfigFunc
- type Schema
- type SchemaEndpoint
- type TargetMapFunc
- type TargetSchema
- type TemplateData
- type ValueOperand
- type ValueType
- type Workflow
- func (w *Workflow) ActionProcessResults(m *TemplateData, data interface{}) error
- func (m *Workflow) AddActionSchema(sch SchemaEndpoint)
- func (m *Workflow) BuildAnswerFile() (*Answers, error)
- func (m *Workflow) BuildPath(file_path string) string
- func (m *Workflow) BuildStoreMap(key string, custom ...string) map[string]interface{}
- func (m *Workflow) ClearDataBucket(key string)
- func (m *Workflow) ClearDataBuckets()
- func (m *Workflow) CountArray(v []interface{}) int
- func (m *Workflow) CreateJSEngine() *goja.Runtime
- func (m *Workflow) CreateSubWorkflowEngine() *Workflow
- func (m *Workflow) CreateTemplateData(current_action *Action) *TemplateData
- func (m *Workflow) FileTemplate(file string, custom ...interface{}) (string, error)
- func (m *Workflow) GenerateToken(password string) (string, error)
- func (m *Workflow) GetConfigToken(key string, model *TemplateData) (interface{}, error)
- func (m *Workflow) GetConfigTokenBool(key string, model *TemplateData, required bool) (bool, error)
- func (m *Workflow) GetConfigTokenFloat(key string, model *TemplateData, required bool) (float64, error)
- func (m *Workflow) GetConfigTokenInt(key string, model *TemplateData, required bool) (int, error)
- func (m *Workflow) GetConfigTokenInterface(key string, model *TemplateData, required bool) (interface{}, error)
- func (m *Workflow) GetConfigTokenInterfaceArray(key string, model *TemplateData, required bool) ([]interface{}, error)
- func (m *Workflow) GetConfigTokenMap(key string, model *TemplateData, required bool) (map[string]interface{}, error)
- func (m *Workflow) GetConfigTokenMapArray(key string, model *TemplateData, required bool) ([]map[string]interface{}, error)
- func (m *Workflow) GetConfigTokenString(key string, model *TemplateData, required bool) (string, error)
- func (m *Workflow) GetConfigTokenStringArray(key string, model *TemplateData, required bool) ([]string, error)
- func (w *Workflow) GetConfigValue(config_target string, key string, data_type string, custom ...string) (interface{}, error)
- func (m *Workflow) GetCurrentActionIndex() int
- func (m *Workflow) GetCurrentJob() *Job
- func (m *Workflow) GetDataBucket() map[string]map[string]interface{}
- func (m *Workflow) GetDataBucketContent(key string) map[string]interface{}
- func (m *Workflow) GetDataFromString(path string) (interface{}, error)
- func (m *Workflow) GetDataItem(item string) *go_data_chain.Data
- func (m *Workflow) GetInbuiltTemplateFuncMap() template.FuncMap
- func (m *Workflow) GetInputValue(key string) interface{}
- func (m *Workflow) GetParamValue(key string) interface{}
- func (m *Workflow) GetRuntimeVar(key string) (interface{}, error)
- func (m *Workflow) GetStackVariable(variable_name string) int
- func (m *Workflow) GetTemplateFuncMap() template.FuncMap
- func (m *Workflow) GetTokenBool(value interface{}, model *TemplateData) (bool, error)
- func (m *Workflow) GetTokenFloat64(value interface{}, model *TemplateData) (float64, error)
- func (m *Workflow) GetTokenInt(value interface{}, model *TemplateData) (int, error)
- func (m *Workflow) GetTokenString(value interface{}, model *TemplateData) (string, error)
- func (m *Workflow) GetValueFromDataBucket(key string, name string) interface{}
- func (m *Workflow) GetValueFromDataBucketAsBool(key string, name string) bool
- func (m *Workflow) GetValueFromDataBucketAsFloat(key string, name string) float64
- func (m *Workflow) GetValueFromDataBucketAsInt(key string, name string) int
- func (m *Workflow) GetValueFromDataBucketAsStrings(key string, name string) string
- func (m *Workflow) GetWorkflow() *Workflow
- func (m *Workflow) KeyPair(key string, value interface{}) string
- func (m *Workflow) KeyPairMap(custom ...string) map[string]interface{}
- func (m *Workflow) LoadAnswerFile(answer_file string) error
- func (m *Workflow) LoadManifest(package_path string) error
- func (m *Workflow) LoadManifestFromString(manifest_string string) error
- func (m *Workflow) ManifestAddActionToJob(job_key string, action_obj *Action) error
- func (m *Workflow) ManifestAddGlobalAction(action_obj *Action) error
- func (m *Workflow) ManifestAddJob(job *Job) error
- func (m *Workflow) ManifestCreateMeta(meta *MetaData)
- func (m *Workflow) ManifestCreateParameter(param *Parameter) error
- func (m *Workflow) ManifestDeleteActionFromJob(job_key string, action_key string) error
- func (m *Workflow) ManifestDeleteJob(job_key string) error
- func (m *Workflow) ManifestDeleteParameter(param_key string) error
- func (m *Workflow) ManifestGetJob(job_key string) *Job
- func (m *Workflow) ManifestUpdateMeta(meta *MetaData)
- func (w *Workflow) MapTargetConfigValue(m interface{}, target interface{}) (interface{}, error)
- func (m *Workflow) MapValuesToInput(map_data map[string]interface{}) error
- func (m *Workflow) ParseInterfaceMap(model *TemplateData, val map[string]interface{}) map[string]interface{}
- func (m *Workflow) ParseToken(data *TemplateData, value string) (string, error)
- func (m *Workflow) RunAction(current_action *Action) error
- func (m *Workflow) RunJob(key string, run_time_vars map[string]interface{}, ...) error
- func (m *Workflow) RunSubWorkflow(key string, inputs map[string]interface{}) error
- func (m *Workflow) SaveManifest(file_name string) error
- func (m *Workflow) SetAnswers(answers map[string]interface{})
- func (m *Workflow) SetBasePath(base_path string)
- func (m *Workflow) SetCurrentActionIndex(index int) error
- func (m *Workflow) SetTemplateFuncMap(f template.FuncMap)
- func (m *Workflow) SetValueToDataBucket(key string, name string, value interface{})
- func (m *Workflow) Template(val string, custom ...interface{}) (string, error)
- func (m *Workflow) TemplateMap(val string, custom map[string]interface{}) (string, error)
- func (m *Workflow) UpdateWorkflow(opts ...WorkflowOption) *Workflow
- type WorkflowOption
- type WriteConfigFunc
Constants ¶
const ( TYPE_STRING = "string" TYPE_INT = "int" TYPE_FLOAT = "float" TYPE_BOOL = "bool" )
Parameter data types
const ( LOG_QUIET = 0 //just show print messages LOG_INFO = 1 //show Action messages LOG_VERBOSE = 2 //show Action messages and LogLevel messages )
Log Level constants
Variables ¶
var ( //ErrEndWorkflow is the error that is returned when the workflow is ended //Use this error to end the workflow but not return an error to the caller ErrEndWorkflow = errors.New("end workflow") )
Functions ¶
func CreateLoopStack ¶
func CreateLoopStack() loopStack
CreateLoopStack creates a new loop stack returns the loop stack
Types ¶
type Action ¶
type Action struct { Key string `json:"key,omitempty" yaml:"key,omitempty" flag:"key k" desc:"key for the job or global action"` Description string `json:"description,omitempty" yaml:"description,omitempty" flag:"desc" desc:"description for the job"` Action string `json:"action" yaml:"action" flag:"-"` //Label string `json:"label" yaml:"label"` Fail string `json:"fail,omitempty" yaml:"fail,omitempty" flag:"fail" desc:"The action to run if this action fails"` ContinueOnError interface{} `` /* 204-byte string literal not displayed */ Config map[string]interface{} `json:"config,omitempty" yaml:"config,omitempty"` Disabled interface{} `` /* 150-byte string literal not displayed */ }
Action is the struct that defines an action
func CreateAction ¶
func CreateAction(opts ...ActionOption) *Action
CreateAction creates a new action
func (*Action) GetConfig ¶
GetConfig returns the Action config as an interface Key is the name of the config returns the config as an interface
func (*Action) GetConfigBool ¶
GetConfigBool returns the Action config as a bool Key is the name of the config returns the config as a bool
func (*Action) GetConfigFloat64 ¶
GetConfigInt returns the Action config as an int Key is the name of the config returns the config as an int
func (*Action) GetConfigInt ¶
GetConfigInt returns the Action config as an int Key is the name of the config returns the config as an int
func (*Action) GetConfigString ¶
GetConfigString returns the Action config as a string Key is the name of the config returns the config as a string
type ActionFunc ¶
type ActionFunc func(w *Workflow, m *TemplateData) error
ActionFunc is the function definition that needs to be implemented to be able to execute an action, this is called by the workflow - w: the workflow - m: the template data returns an error if the action fails
type ActionOption ¶
type ActionOption func(*Action)
ActionOption is a function that sets an option on the action
func OptionActionAction ¶
func OptionActionAction(v string) ActionOption
OptionActionAction sets the action on the action
func OptionActionConfig ¶
func OptionActionConfig(v map[string]interface{}) ActionOption
OptionActionConfig sets the config on the action
func OptionActionContinueOnError ¶
func OptionActionContinueOnError(v interface{}) ActionOption
OptionActionContinueOnError sets the continue on error flag on the action
func OptionActionDescription ¶
func OptionActionDescription(v string) ActionOption
OptionActionDescription sets the description on the action
func OptionActionDisabled ¶
func OptionActionDisabled(v bool) ActionOption
OptionActionDisabled sets the disabled flag on the action
func OptionActionFail ¶
func OptionActionFail(v string) ActionOption
OptionActionFail sets the fail flag on the action
func OptionActionKey ¶
func OptionActionKey(v string) ActionOption
OptionActionKey sets the key on the action
type ActionSchema ¶
type ActionSchema struct { Short string Long string Target string //The module and target that the action is for e.g action_git_target //Config map[string]interface{} ConfigSchema map[string]*Schema ProcessResults bool //Uses the process results function to process the results so auto add the results to the template data InlineParams bool //If true then the params are passed as a string in the action name e.g action: "print;Hello World" InlineFormat InlineFormatter //If InlineParams is true then this is used to format the inline params into a string this will need to be implemented by user Action ActionFunc //The action function that is called to execute the action }
ActionSchema is the schema definition for the action plugin
type Answer ¶
type Answer struct { Key string `` /* 127-byte string literal not displayed */ Title string `json:"title,omitempty" yaml:"title,omitempty" flag:"title t" desc:"title for the parameter, used as the parameter title"` Description string `` /* 143-byte string literal not displayed */ InputType string `` /* 127-byte string literal not displayed */ Value interface{} `json:"value" yaml:"value" flag:"value v" desc:"value of the parameter, must be a string, int, float, or bool"` }
type Answers ¶
type Answers struct { Name string `json:"package_name" yaml:"package_name"` Version string `json:"package_version" yaml:"package_version"` Answers []Answer `json:"answers" yaml:"answers"` }
func (*Answers) GetPackageProjectName ¶
type DeleteConfigFunc ¶
DeleteConfigFunc is the function definition that needs to be implemented to be able to delete config values to the config store of choice - key: the key to delete - custom: the custom data that is used to to pass data to the config function
type EventFunc ¶
EventFunc is the function definition is used as part of the workflow event system Start and a cleanup function can be added to the workflow and you implement code to handle the event - w: the workflow returns an error if the event fails
type FunctionSchema ¶
type InlineFormatter ¶
InlineFormatter is used with the action schema to format the inline params inline params as passed with the action name e.g action "print;Hello World" Normally params are passed as a map[string]interface{} in the action config but if the action schema has InlineParams set to true then the params are passed as a string - cfg: the config map returns the formatted string
type Job ¶
type Job struct { Key string `json:"key" yaml:"key" flag:"key k" desc:"key for the job, must be unique within the workflow, used as the job name"` Title string `json:"title" yaml:"title" flag:"title t" desc:"title for the job"` Description string `json:"description" yaml:"description" flag:"desc d" desc:"description for the job"` Actions []Action `json:"actions" yaml:"actions" flag:"actions a" desc:"list of actions for the job"` IsSubWorkflow bool `json:"is_sub_workflow" yaml:"is_sub_workflow" flag:"sub s" desc:"set to true if this is a sub workflow"` Inputs map[string]Parameter `json:"inputs,omitempty" yaml:"inputs,omitempty" flag:"inputs i" desc:"inputs for the job"` }
Job is a workflow job
func (*Job) ActionExists ¶
ActionExists returns true if the action exists - key is the name of the action - returns true if the action exists
func (*Job) ActionKeyExists ¶
ActionKeyExists returns true if the action exists - key is the name of the action - returns true if the action exists
func (*Job) GetActionByKey ¶
GetActionByKey returns the action with the given key - key is the name of the action - returns the action
func (*Job) GetInput ¶
GetInput returns the Job input as an interface - key is the name of the parameter - returns the parameter
func (*Job) GetKeyIndex ¶
GetKeyIndex returns the index of the action with the given key - key is the name of the action - returns the index of the action
func (*Job) SetInputAnswer ¶
SetInputAnswer sets the answer for the input parameter - key is the name of the parameter - value is the answer - returns an error if the input does not exist
type JobOption ¶
type JobOption func(*Job)
JobOption is a function that sets an option on the job
func OptionJobActions ¶
OptionJobActions sets the actions on the job v is the actions as a slice of Action
func OptionJobDescription ¶
OptionJobDescription sets the description on the job
v is the description
func OptionJobKey ¶
OptionJobKey sets the key on the job v is the key
func OptionJobTitle ¶
OptionJobTitle sets the title on the job v is the title
type Manifest ¶
type Manifest struct { Meta MetaData `json:"meta_data" yaml:"meta_data"` Actions []Action `json:"actions" yaml:"actions"` Jobs []Job `json:"jobs" yaml:"jobs"` Parameters []Parameter `json:"parameters" yaml:"parameters"` Data map[string]interface{} `json:"data" yaml:"data"` }
Manifest is a workflow manifest and contains all the information needed to run a workflow
func CreateManifest ¶
func CreateManifest(opts ...ManifestOption) *Manifest
CreateManifest creates a new manifest opts are the options to set on the manifest returns the manifest
func (*Manifest) DataModel ¶
func (m *Manifest) DataModel() *go_data_chain.Data
DataModel returns the data model for the manifest returns the data model for the manifest as a data chain
func (*Manifest) GetGlobalAction ¶
GetJob gets a job from the manifest key is the key of the job returns the job or nil if it does not exist
func (*Manifest) GetJob ¶
GetJob gets a job from the manifest key is the key of the job returns the job or nil if it does not exist
func (*Manifest) GetParameter ¶
GetParameter gets a parameter key is the key of the parameter returns the parameter or nil if it does not exist
func (*Manifest) GlobalActionKeyExists ¶
func (*Manifest) ParameterExists ¶
ParameterExists checks if a parameter exists key is the key of the parameter returns true if the parameter exists
type ManifestOption ¶
type ManifestOption func(*Manifest)
ManifestOption is a function that sets an option on the manifest
func OptionManifestData ¶
func OptionManifestData(v map[string]interface{}) ManifestOption
OptionManifestData sets the data on the manifest v is the data as a map[string]interface{}
func OptionManifestJobs ¶
func OptionManifestJobs(v []Job) ManifestOption
OptionManifestJobs sets the jobs on the manifest v is the slice of jobs
func OptionManifestMeta ¶
func OptionManifestMeta(v MetaData) ManifestOption
OptionManifestMeta sets the meta data on the manifest v is the meta data
func OptionManifestParameters ¶
func OptionManifestParameters(v []Parameter) ManifestOption
OptionManifestParameters sets the parameters on the manifest v is the slice of parameters
type MetaData ¶
type MetaData struct { Name string `json:"name" yaml:"name" flag:"name n" desc:"Project Name"` Description string `json:"description" yaml:"description" flag:"description d" desc:"Project Description"` Version string `json:"version" yaml:"version" flag:"version v" desc:"Project Version"` Author string `json:"author" yaml:"author" flag:"author a" desc:"Project Author"` Contact string `json:"contact" yaml:"contact" flag:"contact c" desc:"Contact Details"` CreatedDate string `json:"create_date" yaml:"create_date" flag:"create_date" desc:"Created Date"` UpdateDate string `json:"update_date" yaml:"update_date" flag:"update_date" desc:"Updated Date"` Vars map[string]interface{} `json:"vars" yaml:"vars"` }
MetaData is the metadata for a workflow
func CreateMetaData ¶
func CreateMetaData(opts ...MetaDataOption) *MetaData
CreateMetaData creates a new metadata opts are the options to set on the metadata returns the metadata
type MetaDataOption ¶
type MetaDataOption func(*MetaData)
MetaDataOption is a function that sets an option on the metadata
func OptionMetaDataAuthor ¶
func OptionMetaDataAuthor(v string) MetaDataOption
OptionMetaDataAuthor sets the author on the metadata v is the author
func OptionMetaDataContact ¶
func OptionMetaDataContact(v string) MetaDataOption
OptionMetaDataContact sets the contact on the metadata v is the contact
func OptionMetaDataCreatedDate ¶
func OptionMetaDataCreatedDate(v string) MetaDataOption
OptionMetaDataCreatedDate sets the created date on the metadata v is the created date
func OptionMetaDataDescription ¶
func OptionMetaDataDescription(v string) MetaDataOption
OptionMetaDataDescription sets the description on the metadata v is the description
func OptionMetaDataName ¶
func OptionMetaDataName(v string) MetaDataOption
OptionMetaDataName sets the name on the metadata v is the name
func OptionMetaDataUpdateDate ¶
func OptionMetaDataUpdateDate(v string) MetaDataOption
OptionMetaDataUpdateDate sets the update date on the metadata v is the update date
func OptionMetaDataVars ¶
func OptionMetaDataVars(v map[string]interface{}) MetaDataOption
OptionMetaDataVars sets the vars on the metadata v is the vars
func OptionMetaDataVersion ¶
func OptionMetaDataVersion(v string) MetaDataOption
OptionMetaDataVersion sets the version on the metadata v is the version
type Parameter ¶
type Parameter struct { Key string `` /* 127-byte string literal not displayed */ Title string `json:"title" yaml:"title" flag:"title t" desc:"title for the parameter, used as the parameter title"` Description string `json:"description" yaml:"description" flag:"desc d" desc:"description for the parameter, used as the parameter description"` InputType string `json:"type" yaml:"type" flag:"type y" desc:"type of the parameter, must be one of string, int, float, bool"` Value interface{} `json:"value" yaml:"value" flag:"value v" desc:"value of the parameter, must be a string, int, float, or bool"` // contains filtered or unexported fields }
Parameter is a struct that holds the information for a parameter
func CreateParameter ¶
func CreateParameter(opts ...ParameterOption) *Parameter
func (*Parameter) GetValue ¶
func (m *Parameter) GetValue() interface{}
GetValue returns the value of the parameter returns the value of the parameter
func (*Parameter) SetAnswer ¶
func (m *Parameter) SetAnswer(answer interface{})
SetAnswer sets the answer of the parameter - answer is the answer to set
func (*Parameter) ValueBool ¶
ValueBool returns the value of the parameter as a bool returns the value of the parameter as a bool
func (*Parameter) ValueFloat ¶
ValueFloat returns the value of the parameter as a float64 returns the value of the parameter as a float64
func (*Parameter) ValueInt ¶
ValueInt returns the value of the parameter as an int returns the value of the parameter as an int
func (*Parameter) ValueString ¶
ValueString returns the value of the parameter as a string returns the value of the parameter as a string
type ParameterOption ¶
type ParameterOption func(*Parameter)
ParameterOption is a function that sets a parameter option
func OptionParameterDescription ¶
func OptionParameterDescription(v string) ParameterOption
OptionParameterDescription sets the description of the parameter - v is the description of the parameter
func OptionParameterKey ¶
func OptionParameterKey(v string) ParameterOption
OptionParameterKey sets the key of the parameter - v is the key of the parameter
func OptionParameterTitle ¶
func OptionParameterTitle(v string) ParameterOption
OptionParameterTitle sets the title of the parameter - v is the title of the parameter
func OptionParameterType ¶
func OptionParameterType(v string) ParameterOption
OptionParameterType sets the type of the parameter - v is the type of the parameter
func OptionParameterValue ¶
func OptionParameterValue(v string) ParameterOption
OptionParameterValue sets the value of the parameter - v is the value of the parameter
type ReadConfigFunc ¶
ReadConfigFunc is the function definition that needs to be implemented for when you want to get config values from the config store of choice - key: the key to get - data_type: the data type to convert the value to - custom: the custom data that is used to to pass data to the config function returns the value of the config or nil if the config does not exist returns an error
type Schema ¶
type Schema struct { Type ValueType Partial bool Required bool Description string ConfigKey string Short string Default interface{} Value string }
Schema is the schema definition for the action plugin
type SchemaEndpoint ¶
type SchemaEndpoint interface { GetTargetSchema() map[string]TargetSchema //Get the target schema GetActionSchema() map[string]ActionSchema //Get the action schema GetFunctionMap() map[string]FunctionSchema //Get the custom function map for the template }
SchemaEndpoint is the interface that needs to be implemented by the plugin
type TargetMapFunc ¶
TargetMapFunc is the function that is called to map config values to a target type - w: the workflow - m: the config values - target: the target type
type TargetSchema ¶
type TargetSchema struct { Action string //The action that the target is used for e.g action_git Short string //The short name of the target Long string //The long name of the target Target interface{} //The target type }
TargetSchema is the schema definition for the target plugin
func BuildTargetConfig ¶
func BuildTargetConfig(short string, long string, target interface{}) TargetSchema
BuildTargetConfig is a helper function to build a target schema - short: the short name of the target - long: the long name of the target - target: the target type returns the target schema
func (*TargetSchema) GetTargetMap ¶
func (m *TargetSchema) GetTargetMap() map[string]interface{}
type TemplateData ¶
type TemplateData struct { Meta *MetaData Manifest *Manifest CurrentAction *Action Data map[string]interface{} }
TemplateData is the data that is passed to the template engine
func (*TemplateData) SetAction ¶
func (m *TemplateData) SetAction(current_action *Action)
SetAction sets the current action current_action - the current action
type ValueOperand ¶
type ValueOperand int
type Workflow ¶
type Workflow struct { LogLevel int64 Manifest Manifest //the manifest that is used for the workflow InitFunc EventFunc //the function that is called when the workflow is initialized CleanFunc EventFunc //the function that is called when the workflow is cleaned up ActionList map[string]ActionFunc //the list of actions that are available ReadConfigFunc map[string]ReadConfigFunc //the function that can be called to get config values for an action TargetMapFunc TargetMapFunc //Called to map config values to a target type // contains filtered or unexported fields }
Workflow is the main struct for the workflow
func CreateWorkflow ¶
func CreateWorkflow(opts ...WorkflowOption) *Workflow
createWorkflow creates a new workflow - opts: the workflow options returns: the workflow
func (*Workflow) ActionProcessResults ¶
func (w *Workflow) ActionProcessResults(m *TemplateData, data interface{}) error
ActionProcessResults processes the results of the action - m is the template data model - data is the data to process - returns an error if there is an error
func (*Workflow) AddActionSchema ¶
func (m *Workflow) AddActionSchema(sch SchemaEndpoint)
AddActionSchema adds an action and target schema to the client and adds the action to the workflow
func (*Workflow) BuildAnswerFile ¶
func (*Workflow) BuildPath ¶
BuildPath will build a path from the base path and the file path file_path - the file path to build returns the full path
func (*Workflow) BuildStoreMap ¶
BuildStoreMap will build a map of values to store in the data bucket or from key/value pairs as string `key=value` key - the key of the data bucket custom - the custom values to add to the map Returns the map of values
func (*Workflow) ClearDataBucket ¶
ClearDataBucket values from the data bucket - key is the name of the bucket
func (*Workflow) ClearDataBuckets ¶
func (m *Workflow) ClearDataBuckets()
ClearDataBuckets clears the data bucket
func (*Workflow) CountArray ¶
func (*Workflow) CreateJSEngine ¶
CreateJSEngine creates a new js engine this is used to run the js code returns a new js engine
func (*Workflow) CreateSubWorkflowEngine ¶
CreateSubWorkflowEngine creates a new workflow engine from the current workflow engine This is useful for creating sub workflows
func (*Workflow) CreateTemplateData ¶
func (m *Workflow) CreateTemplateData(current_action *Action) *TemplateData
CreateTemplateData creates the template data current_action - the current action returns the template data
func (*Workflow) FileTemplate ¶
FileTemplate will read a file and parse the tokens file - the file to read custom - the custom data to use Returns the parsed string Returns an error if the file could not be read
func (*Workflow) GenerateToken ¶
GenerateToken will generate a token from a password password - the password to generate the token from Returns the token Returns an error if the token could not be generated
func (*Workflow) GetConfigToken ¶
func (m *Workflow) GetConfigToken(key string, model *TemplateData) (interface{}, error)
GetConfigToken will get the config token from the action and replaces its tokens key - the key of the config model - the template data Returns the value of the config as an interface Returns an error if the key is not found
func (*Workflow) GetConfigTokenBool ¶
GetConfigTokenBool will get the config token from the action and replaces its tokens and converts to a bool key - the key of the config model - the template data required - if the key should exist and a value should be returned Returns the value of the config as a bool Returns an error if the key is not found
func (*Workflow) GetConfigTokenFloat ¶
func (m *Workflow) GetConfigTokenFloat(key string, model *TemplateData, required bool) (float64, error)
GetConfigTokenInt will get the config token from the action and replaces its tokens and converts to an int key - the key of the config model - the template data required - if the key should exist and a value should be returned Returns the value of the config as an int Returns an error if the key is not found
func (*Workflow) GetConfigTokenInt ¶
GetConfigTokenInt will get the config token from the action and replaces its tokens and converts to an int key - the key of the config model - the template data required - if the key should exist and a value should be returned Returns the value of the config as an int Returns an error if the key is not found
func (*Workflow) GetConfigTokenInterface ¶
func (m *Workflow) GetConfigTokenInterface(key string, model *TemplateData, required bool) (interface{}, error)
GetConfigTokenInterface will get the config token from the action and replaces its tokens and returns it as an interface key - the key of the config model - the template data required - if the key should exist and a value should be returned Returns the value of the config as an interface Returns an error if the key is not found
func (*Workflow) GetConfigTokenInterfaceArray ¶
func (m *Workflow) GetConfigTokenInterfaceArray(key string, model *TemplateData, required bool) ([]interface{}, error)
GetConfigTokenMap will get the config token map from the action and replaces its tokens key - the key of the config model - the template data required - if the key is required returns the value of the map with the tokens replaced returns an error if the key is not found
func (*Workflow) GetConfigTokenMap ¶
func (m *Workflow) GetConfigTokenMap(key string, model *TemplateData, required bool) (map[string]interface{}, error)
GetConfigTokenMap will get the config token map from the action and replaces its tokens key - the key of the config model - the template data required - if the key is required returns the value of the map with the tokens replaced returns an error if the key is not found
func (*Workflow) GetConfigTokenMapArray ¶
func (m *Workflow) GetConfigTokenMapArray(key string, model *TemplateData, required bool) ([]map[string]interface{}, error)
GetConfigTokenMap will get the config token map from the action and replaces its tokens key - the key of the config model - the template data required - if the key is required returns the value of the map with the tokens replaced returns an error if the key is not found
func (*Workflow) GetConfigTokenString ¶
func (m *Workflow) GetConfigTokenString(key string, model *TemplateData, required bool) (string, error)
GetConfigTokenString will get the config token from the action and replaces its tokens as a string key - the key of the config model - the template data required - if the key should exist and a value should be returned Returns the value of the config as a string Returns an error if the key is not found
func (*Workflow) GetConfigTokenStringArray ¶
func (m *Workflow) GetConfigTokenStringArray(key string, model *TemplateData, required bool) ([]string, error)
GetConfigTokenMap will get the config token map from the action and replaces its tokens key - the key of the config model - the template data required - if the key is required returns the value of the map with the tokens replaced returns an error if the key is not found
func (*Workflow) GetConfigValue ¶
func (w *Workflow) GetConfigValue(config_target string, key string, data_type string, custom ...string) (interface{}, error)
GetConfigValue will return the value of the config with the given key key - the key of the config to return data_type - the type of the config to return custom - custom values to pass to the config function returns the value of the config or nil if the config does not exist returns an error if the config function is not set
func (*Workflow) GetCurrentActionIndex ¶
GetCurrentActionIndex will get the current action index returns the current action index
func (*Workflow) GetCurrentJob ¶
GetCurrentJob returns the current job
func (*Workflow) GetDataBucket ¶
GetDataBucket returns the data bucket
func (*Workflow) GetDataBucketContent ¶
GetDataBucketItem returns the Map from the data bucket - key is the name of the bucket returns Bucket Content nil if the bucket does not exist
func (*Workflow) GetDataFromString ¶
Gets the data from the template using a string
func (*Workflow) GetDataItem ¶
func (m *Workflow) GetDataItem(item string) *go_data_chain.Data
GetDataItem returns the data item with the given name item: the name of the data item to return returns the data item or nil if the item does not exist
func (*Workflow) GetInbuiltTemplateFuncMap ¶
GetTemplateFuncMap will return the template function map
func (*Workflow) GetInputValue ¶
GetInputValue will return the value of the job input key - the key of the parameter to return returns the value of the parameter or nil if the parameter does not exist
func (*Workflow) GetParamValue ¶
GetParamValue will return the value of the parameter with the given key key - the key of the parameter to return returns the value of the parameter or nil if the parameter does not exist
func (*Workflow) GetRuntimeVar ¶
Get Runtime vars from the workflow using key key - the key of the parameter to return returns the value of the parameter or nil if the parameter does not exist
func (*Workflow) GetStackVariable ¶
GetStackVariable gets the value of a variable from the stack variable_name - the name of the variable returns the value of the variable as an int or -1 if the variable is not found
func (*Workflow) GetTemplateFuncMap ¶
func (*Workflow) GetTokenBool ¶
func (m *Workflow) GetTokenBool(value interface{}, model *TemplateData) (bool, error)
GetTokenBool will parse the token string and convert to a bool value - the value to parse model - the template data Returns the parsed bool Returns an error if the value is not a bool
func (*Workflow) GetTokenFloat64 ¶
func (m *Workflow) GetTokenFloat64(value interface{}, model *TemplateData) (float64, error)
GetTokenInt will parse the token string and convert to an int value - the value to parse model - the template data Returns the parsed int Returns an error if the value is not an int
func (*Workflow) GetTokenInt ¶
func (m *Workflow) GetTokenInt(value interface{}, model *TemplateData) (int, error)
GetTokenInt will parse the token string and convert to an int value - the value to parse model - the template data Returns the parsed int Returns an error if the value is not an int
func (*Workflow) GetTokenString ¶
func (m *Workflow) GetTokenString(value interface{}, model *TemplateData) (string, error)
GetTokenString will parse the token string value - the value to parse model - the template data Returns the parsed string Returns an error if the value is not a string
func (*Workflow) GetValueFromDataBucket ¶
GetValueFromDataBucket returns the value from the data bucket - key is the name of the bucket - name is the name of the value The value is the data or nil if the value does not exist
func (*Workflow) GetValueFromDataBucketAsBool ¶
GetValueFromDataBucketAsBool returns the value from the data bucket as a bool - key is the name of the bucket - name is the name of the value The value is the data or nil if the value does not exist
func (*Workflow) GetValueFromDataBucketAsFloat ¶
GetValueFromDataBucketAsFloat returns the value from the data bucket as a float - key is the name of the bucket - name is the name of the value The value is the data or nil if the value does not exist
func (*Workflow) GetValueFromDataBucketAsInt ¶
GetValueFromDataBucketAsInt returns the value from the data bucket as an int - key is the name of the bucket - name is the name of the value The value is the data or nil if the value does not exist
func (*Workflow) GetValueFromDataBucketAsStrings ¶
GetValueFromDataBucketAsStrings returns the value from the data bucket as a string - key is the name of the bucket - name is the name of the value The value is the data or nil if the value does not exist
func (*Workflow) GetWorkflow ¶
GetWorkflow will return the workflow
func (*Workflow) KeyPair ¶
KeyPair will return a key pair when string is passed as `key=value` key - the key value - the value Returns the key pair
func (*Workflow) KeyPairMap ¶
KeyPairMap will return a map of the key pairs when string is passed as `key=value` custom - the key pairs
func (*Workflow) LoadAnswerFile ¶
LoadAnswerFile loads the answers from the given file answer_file: the file to load the answers from returns an error if the answers are not valid
func (*Workflow) LoadManifest ¶
LoadManifest loads the manifest package_path: the path to the manifest file returns an error if the manifest is not valid
func (*Workflow) LoadManifestFromString ¶
LoadManifestFromString loads the manifest from a string manifest_string: the manifest as a string returns an error if the manifest is not valid
func (*Workflow) ManifestAddActionToJob ¶
AddActionToJob adds an action to a job job_key: the key of the job to add the action to action_obj: the action to add
func (*Workflow) ManifestAddGlobalAction ¶
AddActionToJob adds an action to a job job_key: the key of the job to add the action to action_obj: the action to add
func (*Workflow) ManifestAddJob ¶
AddJob adds a job to the manifest job: the job to add returns an error if the job already exists or if the job key is empty
func (*Workflow) ManifestCreateMeta ¶
AddMeta adds the meta data to the manifest overwriting any existing meta data meta: the meta data to add
func (*Workflow) ManifestCreateParameter ¶
ManifestCreateParameter creates a parameter in the manifest param: the parameter to create returns an error if the parameter already exists
func (*Workflow) ManifestDeleteActionFromJob ¶
DeleteActionFromJob deletes an action from a job by key job_key: the key of the job to delete the action from action_key: the key of the action to delete returns an error if the job or action does not exist
func (*Workflow) ManifestDeleteJob ¶
DeleteJob delete a job from the manifest job_key: the key of the job to delete returns an error if the job does not exist
func (*Workflow) ManifestDeleteParameter ¶
ManifestDeleteParameter deletes a parameter from the manifest param_key: the key of the parameter to delete returns an error if the parameter does not exist
func (*Workflow) ManifestGetJob ¶
func (*Workflow) ManifestUpdateMeta ¶
UpdateMeta updates the meta data of the manifest meta: the meta data to update
func (*Workflow) MapTargetConfigValue ¶
MapTargetConfigValue will call the target config mapper function m - the template data target - the target to map returns the mapped target returns an error if the mapper function is not set
func (*Workflow) MapValuesToInput ¶
MapValuesToInput will map the values in the map to the input of the current job map_data - the map of values to map to the input
func (*Workflow) ParseInterfaceMap ¶
func (m *Workflow) ParseInterfaceMap(model *TemplateData, val map[string]interface{}) map[string]interface{}
ParseInterfaceMap will parse the interface map and replace its tokens model - the template data val - the map to parse returns the value of the map with the tokens replaced returns an error if the key is not found
func (*Workflow) ParseToken ¶
func (m *Workflow) ParseToken(data *TemplateData, value string) (string, error)
ParseToken will parse the token string and replace any tokens with the values from the model data - the template data value - the value to parse Returns the parsed string Returns an error if the key is not found
func (*Workflow) RunAction ¶
RunAction will run the action - current_action - the action to run - returns - error
func (*Workflow) RunJob ¶
func (m *Workflow) RunJob(key string, run_time_vars map[string]interface{}, params map[string]interface{}) error
RunJob will run the job with the given key key - the key of the job to run returns - error
func (*Workflow) RunSubWorkflow ¶
RunSubWorkflow will run a SubWorkflow job with the given key key - the key of the job to run inputs - the inputs to the job returns - error
func (*Workflow) SaveManifest ¶
SaveManifest saves the manifest file_name: the name of the file to save returns an error if the manifest is not valid
func (*Workflow) SetAnswers ¶
SetAnswers will set the answers for the workflow answers - the answers to set
func (*Workflow) SetBasePath ¶
SetBasePath will set the base path of the manifest file base_path - the base path of the manifest file
func (*Workflow) SetCurrentActionIndex ¶
SetCurrentActionIndex will set the current action index index - the index to set returns an error if the index is out of range or if the index is greater than the next action
func (*Workflow) SetTemplateFuncMap ¶
SetTemplateFuncMap sets the template function map
func (*Workflow) SetValueToDataBucket ¶
dataBucket is a map of maps that can be used to store data between actions - key is the name of the bucket - name is the name of the value - value is the data to store
func (*Workflow) Template ¶
Template will parse the token string and replace the tokens with the custom data val - the value to parse custom - the custom data to use as a string `key=value` or a map Returns the parsed string Returns an error if the value could not be parsed
func (*Workflow) TemplateMap ¶
TemplateMap will parse the token string and replace the tokens with the custom data val - the value to parse custom - the custom data to use Returns the parsed string Returns an error if the value could not be parsed
func (*Workflow) UpdateWorkflow ¶
func (m *Workflow) UpdateWorkflow(opts ...WorkflowOption) *Workflow
UpdateWorkflow updates the workflow - opts: the workflow options returns: the workflow
type WorkflowOption ¶
type WorkflowOption func(*Workflow)
WorkflowOption is a function that sets a workflow option
func OptionWorkflowLogLevel ¶
func OptionWorkflowLogLevel(v int64) WorkflowOption
OptionWorkflowLogLevel sets the LogLevel option 0 = quiet 1 = info 2 = LogLevel
func OptionWorkflowManifest ¶
func OptionWorkflowManifest(v Manifest) WorkflowOption
OptionWorkflowManifest sets the manifest option - v: the manifest
type WriteConfigFunc ¶
WriteConfigFunc is the function definition that needs to be implemented to be able to write config values to the config store of choice - key: the key to write - value: the value to write - custom: the custom data that is used to to pass data to the config function
Source Files
¶
- action_func.go
- action_type.go
- answer_type.go
- job_func.go
- job_type.go
- loop_stack.go
- manifest_func.go
- manifest_type.go
- meta_type.go
- parameter_func.go
- parameter_type.go
- workflow_data_buckets.go
- workflow_func.go
- workflow_js_engine.go
- workflow_manifest_func.go
- workflow_result_processings.go
- workflow_run.go
- workflow_schema.go
- workflow_template.go
- workflow_type.go