types

package
v0.0.0-...-2873e01 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FunctionKindFunction = "function"
	FunctionKindIterator = "iterator"
)
View Source
const (
	WorkflowResourceType  = "corteza::automation:workflow"
	SessionResourceType   = "corteza::automation:session"
	TriggerResourceType   = "corteza::automation:trigger"
	ComponentResourceType = "corteza::automation"
)
View Source
const (
	WorkflowResourceTranslationType = "automation:workflow"
)

Types and stuff

Variables

View Source
var (
	LocaleKeyWorkflowName = LocaleKey{
		Name:     "name",
		Resource: WorkflowResourceTranslationType,
		Path:     "name",
	}
	LocaleKeyWorkflowDescription = LocaleKey{
		Name:     "description",
		Resource: WorkflowResourceTranslationType,
		Path:     "description",
	}
)

Functions

func ComponentRbacResource

func ComponentRbacResource() string

ComponentRbacResource returns string representation of RBAC resource for Component

RBAC resource is in the corteza::automation/ format

This function is auto-generated

func ComponentRbacResourceTpl

func ComponentRbacResourceTpl() string

func DebugStep

func DebugStep(log *zap.Logger) *debugStep

DebugStep creates a step that logs entire contents of the scope

func DelayStep

func DelayStep(args ExprSet) *delayStep

DelayStep creates a step that logs entire contents of the scope

func ErrorHandlerStep

func ErrorHandlerStep(h wfexec.Step, rr *expr.Vars) *errorHandlerStep

func ExpressionsStep

func ExpressionsStep(ee ...*Expr) *expressionsStep

func FunctionStep

func FunctionStep(def *Function, arguments, results ExprSet) (*functionStep, error)

FunctionStep initializes new function step with function definition and configured arguments and results

func IsArray

func IsArray(p *Param)

func IteratorStep

func IteratorStep(def *Function, arguments, results ExprSet, next, exit wfexec.Step) (*iteratorStep, error)

IteratorStep initializes new iterator step with function (iterator) and other parameters

Pointers to next and exit steps are are given and then passed on to the iterator

func ParseWorkflowVariables

func ParseWorkflowVariables(ss []string) (p *expr.Vars, err error)

func Required

func Required(p *Param)

func Types

func Types(tt ...expr.Type) paramOpt

func WorkflowRbacResource

func WorkflowRbacResource(id uint64) string

WorkflowRbacResource returns string representation of RBAC resource for Workflow

RBAC resource is in the corteza::automation:workflow/... format

This function is auto-generated

func WorkflowRbacResourceTpl

func WorkflowRbacResourceTpl() string

func WorkflowResourceTranslation

func WorkflowResourceTranslation(id uint64) string

WorkflowResourceTranslation returns string representation of Locale resource for Workflow

Locale resource is in the automation:workflow/... format

This function is auto-generated

func WorkflowResourceTranslationTpl

func WorkflowResourceTranslationTpl() string

@todo template

Types

type Component

type Component struct{}

Component struct serves as a virtual resource type for the automation component

This struct is auto-generated

func (Component) RbacResource

func (r Component) RbacResource() string

RbacResource returns string representation of RBAC resource for Component by calling ComponentRbacResource fn

RBAC resource is in the corteza::automation/... format

This function is auto-generated

type Expr

type Expr struct {
	// Variable name to set results of the expression to
	Target string `json:"target"`

	// Source of the value / name of the variable from scope; if set value is copied target
	//
	// Takes precedence to value
	//
	Source string `json:"source,omitempty"`

	// Expression to evaluate over the input variables; results will be set to target
	//
	Expr string `json:"expr,omitempty"`

	// Raw value to be set to target
	//
	// If expression is set and fails, evaluation defaults to value and suppresses the error
	Value interface{} `json:"value,omitempty"`

	// Expected type of the input value
	Type string `json:"type,omitempty"`

	// Set of tests that can be run before input is evaluated and result copied to scope
	Tests TestSet `json:"tests,omitempty"`
	// contains filtered or unexported fields
}

Used for expression steps, arguments/results mapping and for input validation

func NewExpr

func NewExpr(target, typ, expr string) (e *Expr, err error)

func NewTypedExpr

func NewTypedExpr(target string, expr string, typ expr.Type) *Expr

func (Expr) Eval

func (e Expr) Eval(ctx context.Context, scope *expr.Vars) (interface{}, error)

func (Expr) GetExpr

func (e Expr) GetExpr() string

func (*Expr) SetEval

func (e *Expr) SetEval(eval expr.Evaluable)

func (*Expr) SetType

func (e *Expr) SetType(fn func(string) (expr.Type, error)) error

func (Expr) Test

func (e Expr) Test(ctx context.Context, scope *expr.Vars) (bool, error)

type ExprSet

type ExprSet []*Expr

func (ExprSet) Eval

func (set ExprSet) Eval(ctx context.Context, in *expr.Vars) (*expr.Vars, error)

Eval on expression set (ExprSet) evaluates all expressions in the set and returns new scope with all set targets

func (ExprSet) GetByTarget

func (set ExprSet) GetByTarget(t string) *Expr

func (ExprSet) Validate

func (set ExprSet) Validate(ctx context.Context, in *expr.Vars) (TestSet, error)

type Function

type Function struct {
	Ref        string        `json:"ref,omitempty"`
	Kind       string        `json:"kind,omitempty"`
	Meta       *FunctionMeta `json:"meta,omitempty"`
	Parameters ParamSet      `json:"parameters,omitempty"`
	Results    ParamSet      `json:"results,omitempty"`

	Handler  FunctionHandler `json:"-"`
	Iterator IteratorHandler `json:"-"`

	Labels   map[string]string `json:"labels,omitempty"`
	Disabled bool              `json:"disabled,omitempty"`
}

workflow functions are defined in the core code

type FunctionHandler

type FunctionHandler func(ctx context.Context, in *expr.Vars) (*expr.Vars, error)

type FunctionMeta

type FunctionMeta struct {
	Short       string                 `json:"short,omitempty"`
	Description string                 `json:"description,omitempty"`
	Visual      map[string]interface{} `json:"visual,omitempty"`
}

type IteratorHandler

type IteratorHandler func(ctx context.Context, in *expr.Vars) (wfexec.IteratorHandler, error)

type LocaleKey

type LocaleKey struct {
	Name          string
	Resource      string
	Path          string
	CustomHandler string
}

type Param

type Param struct {
	Name     string     `json:"name,omitempty"`
	Types    []string   `json:"types,omitempty"`
	Required bool       `json:"required,omitempty"`
	IsArray  bool       `json:"isArray,omitempty"`
	Meta     *ParamMeta `json:"meta,omitempty"`
}

func NewParam

func NewParam(name string, opts ...paramOpt) *Param

const

func (Param) HasType

func (p Param) HasType(t string) bool

type ParamMeta

type ParamMeta struct {
	Label       string                 `json:"label,omitempty"`
	Description string                 `json:"description,omitempty"`
	Visual      map[string]interface{} `json:"visual,omitempty"`
}

type ParamSet

type ParamSet []*Param

func (ParamSet) GetByName

func (set ParamSet) GetByName(name string) *Param

func (ParamSet) VerifyArguments

func (set ParamSet) VerifyArguments(ee ExprSet) error

CheckArguments validates (at compile-time) input data (arguments)

func (ParamSet) VerifyResults

func (set ParamSet) VerifyResults(ee ExprSet) error

CheckArguments validates (at compile-time) input data (arguments)

type Session

type Session struct {
	ID         uint64 `json:"sessionID,string"`
	WorkflowID uint64 `json:"workflowID,string"`

	Status SessionStatus `json:"status,string"`

	EventType    string `json:"eventType"`
	ResourceType string `json:"resourceType"`

	Input  *expr.Vars `json:"input"`
	Output *expr.Vars `json:"output"`

	// Stacktrace that gets stored (if/when configured)
	Stacktrace Stacktrace `json:"stacktrace"`

	CreatedAt time.Time  `json:"createdAt,omitempty"`
	CreatedBy uint64     `json:"createdBy,string"`
	PurgeAt   *time.Time `json:"purgeAt,omitempty"`

	// here we join suspended & prompted state;
	// we treat both states as suspended
	SuspendedAt *time.Time `json:"suspendedAt,omitempty"`
	CompletedAt *time.Time `json:"completedAt,omitempty"`
	Error       string     `json:"error,omitempty"`

	// For keeping runtime stacktrace,
	// even if we do not want to store it on every update
	//
	// This will aid us when session fails and we can access
	// the whole stacktrace
	RuntimeStacktrace Stacktrace `json:"-"`

	// FlushCounter helps us keep track of when we should forcefully flush
	// the session to the database.
	//
	// This is required due to the change in exec stack traces.
	FlushCounter int `json:"-"`
	// contains filtered or unexported fields
}

Instance of single workflow execution

func NewSession

func NewSession(s *wfexec.Session) *Session

func (*Session) AppendRuntimeStacktrace

func (s *Session) AppendRuntimeStacktrace(frame *wfexec.Frame)

func (*Session) Apply

func (s *Session) Apply(ssp SessionStartParams)

func (*Session) Cancel

func (s *Session) Cancel()

func (*Session) CopyRuntimeStacktrace

func (s *Session) CopyRuntimeStacktrace()

func (*Session) DisableStacktrace

func (s *Session) DisableStacktrace()

func (*Session) Exec

func (s *Session) Exec(ctx context.Context, step wfexec.Step, input *expr.Vars) error

func (*Session) FullStacktrace

func (s *Session) FullStacktrace()

func (*Session) GC

func (s *Session) GC() bool

func (Session) GetID

func (r Session) GetID() uint64

func (*Session) GetValue

func (r *Session) GetValue(name string, pos uint) (any, error)

func (*Session) PendingPrompts

func (s *Session) PendingPrompts(ownerId uint64) []*wfexec.PendingPrompt

func (*Session) Resume

func (s *Session) Resume(ctx context.Context, stateID uint64, input *expr.Vars) (*wfexec.ResumedPrompt, error)

func (*Session) SetValue

func (r *Session) SetValue(name string, pos uint, value any) (err error)

func (*Session) WaitResults

func (s *Session) WaitResults(ctx context.Context) (*expr.Vars, wfexec.SessionStatus, Stacktrace, error)

WaitResults wait blocks until workflow session is completed or fails (or context is canceled) and returns resuts

type SessionFilter

type SessionFilter struct {
	SessionID    []string `json:"sessionID"`
	WorkflowID   []string `json:"workflowID"`
	CreatedBy    []string `json:"createdBy"`
	EventType    string   `json:"eventType"`
	ResourceType string   `json:"resourceType"`

	Completed filter.State `json:"deleted"`
	Status    []uint       `json:"status"`

	// Check fn is called by store backend for each resource found function can
	// modify the resource and return false if store should not return it
	//
	// Store then loads additional resources to satisfy the paging parameters
	Check func(*Session) (bool, error) `json:"-"`

	// Standard helpers for paging and sorting
	filter.Sorting
	filter.Paging
}

type SessionSet

type SessionSet []*Session

SessionSet slice of Session

This type is auto-generated.

func (SessionSet) Filter

func (set SessionSet) Filter(f func(*Session) (bool, error)) (out SessionSet, err error)

Filter iterates through every slice item, calls f(Session) (bool, err) and return filtered slice

This function is auto-generated.

func (SessionSet) FindByID

func (set SessionSet) FindByID(ID uint64) *Session

FindByID finds items from slice by its ID property

This function is auto-generated.

func (SessionSet) IDs

func (set SessionSet) IDs() (IDs []uint64)

IDs returns a slice of uint64s from all items in the set

This function is auto-generated.

func (SessionSet) Walk

func (set SessionSet) Walk(w func(*Session) error) (err error)

Walk iterates through every slice item and calls w(Session) err

This function is auto-generated.

type SessionStartParams

type SessionStartParams struct {
	// Always set, users that invoked/started the workflow session
	Invoker auth.Identifiable

	// Optional, (alternative) user that is running the workflow
	Runner auth.Identifiable

	WorkflowID   uint64
	KeepFor      int
	Trace        bool
	Input        *expr.Vars
	StepID       uint64
	EventType    string
	ResourceType string

	CallStack []uint64
}

type SessionStatus

type SessionStatus uint
const (
	SessionStarted SessionStatus = iota
	SessionPrompted
	SessionSuspended
	SessionFailed
	SessionCompleted
	SessionCanceled
)

func (SessionStatus) MarshalJSON

func (s SessionStatus) MarshalJSON() ([]byte, error)

func (SessionStatus) String

func (s SessionStatus) String() string

type Stacktrace

type Stacktrace []*wfexec.Frame

func (*Stacktrace) Scan

func (set *Stacktrace) Scan(src any) error

func (Stacktrace) String

func (set Stacktrace) String() (str string)

func (Stacktrace) Value

func (set Stacktrace) Value() (driver.Value, error)

type State

type State struct {
	ID        uint64 `json:"stateID,string"`
	SessionID uint64 `json:"sessionID,string"`

	ResumeAt        *time.Time `json:"resumeAt"`
	WaitingForInput bool       `json:"waitingForInput"`

	CreatedAt time.Time `json:"createdAt,omitempty"`
	CreatedBy uint64    `json:"createdBy,string"`

	CallerID uint64     `json:"callerID,string"`
	StepID   uint64     `json:"stepID,string"`
	Scope    *expr.Vars `json:"scope"`
}

WorkflowState tracks suspended sessions Session can have more than one state

type StateSet

type StateSet []*State

StateSet slice of State

This type is auto-generated.

func (StateSet) Filter

func (set StateSet) Filter(f func(*State) (bool, error)) (out StateSet, err error)

Filter iterates through every slice item, calls f(State) (bool, err) and return filtered slice

This function is auto-generated.

func (StateSet) FindByID

func (set StateSet) FindByID(ID uint64) *State

FindByID finds items from slice by its ID property

This function is auto-generated.

func (StateSet) IDs

func (set StateSet) IDs() (IDs []uint64)

IDs returns a slice of uint64s from all items in the set

This function is auto-generated.

func (StateSet) Walk

func (set StateSet) Walk(w func(*State) error) (err error)

Walk iterates through every slice item and calls w(State) err

This function is auto-generated.

type Test

type Test struct {
	// Expression to evaluate over the input variables; results will be set to scope under variable Name
	Expr string `json:"expr,omitempty"`

	// Error to be   if test fails
	Error string `json:"error"`
	// contains filtered or unexported fields
}

Used for input evaluation

func NewTest

func NewTest(expr, error string) (t *Test, err error)

func (Test) Eval

func (t Test) Eval(ctx context.Context, scope *expr.Vars) (interface{}, error)

func (Test) GetExpr

func (t Test) GetExpr() string

func (*Test) SetEval

func (t *Test) SetEval(eval expr.Evaluable)

func (Test) Test

func (t Test) Test(ctx context.Context, scope *expr.Vars) (bool, error)

type TestSet

type TestSet []*Test

func (TestSet) Test

func (set TestSet) Test(ctx context.Context, scope *expr.Vars) (bool, error)

func (TestSet) TestAll

func (set TestSet) TestAll(ctx context.Context, scope *expr.Vars) (bool, error)

func (TestSet) TestAny

func (set TestSet) TestAny(ctx context.Context, scope *expr.Vars) (bool, error)

Returns true on first true

func (TestSet) Validate

func (set TestSet) Validate(ctx context.Context, scope *expr.Vars) (TestSet, error)

type Trigger

type Trigger struct {
	ID      uint64 `json:"triggerID,string"`
	Enabled bool   `json:"enabled"`

	WorkflowID uint64 `json:"workflowID,string"`
	// Start workflow on this step. If 0, find first (only) orphan
	StepID uint64 `json:"stepID,string"`

	// Resource type that can trigger the workflow
	ResourceType string `json:"resourceType"`

	// Event type that can trigger the workflow
	EventType string `json:"eventType"`

	// Trigger constraints
	Constraints TriggerConstraintSet `json:"constraints"`

	// Initial input scope,
	// will be merged merged with workflow variables
	Input *expr.Vars `json:"input"`

	Labels map[string]string `json:"labels,omitempty"`
	Meta   *TriggerMeta      `json:"meta,omitempty"`

	OwnedBy   uint64     `json:"ownedBy,string"`
	CreatedAt time.Time  `json:"createdAt,omitempty"`
	CreatedBy uint64     `json:"createdBy,string" `
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`
	UpdatedBy uint64     `json:"updatedBy,string,omitempty"`
	DeletedAt *time.Time `json:"deletedAt,omitempty"`
	DeletedBy uint64     `json:"deletedBy,string,omitempty"`
}

func (Trigger) GetID

func (r Trigger) GetID() uint64

func (Trigger) GetLabels

func (m Trigger) GetLabels() map[string]string

GetLabels adds new label to label map

func (*Trigger) GetValue

func (r *Trigger) GetValue(name string, pos uint) (any, error)

func (Trigger) LabelResourceID

func (m Trigger) LabelResourceID() uint64

GetLabels adds new label to label map

func (Trigger) LabelResourceKind

func (Trigger) LabelResourceKind() string

GetLabels adds new label to label map

func (*Trigger) SetLabel

func (m *Trigger) SetLabel(key string, value string)

SetLabel adds new label to label map

func (*Trigger) SetValue

func (r *Trigger) SetValue(name string, pos uint, value any) (err error)

type TriggerConstraint

type TriggerConstraint struct {
	Name   string   `json:"name"`
	Op     string   `json:"op,omitempty"`
	Values []string `json:"values,omitempty"`
}

type TriggerConstraintSet

type TriggerConstraintSet []*TriggerConstraint

TriggerConstraintSet slice of TriggerConstraint

This type is auto-generated.

func ParseTriggerConstraintSet

func ParseTriggerConstraintSet(ss []string) (p TriggerConstraintSet, err error)

func (TriggerConstraintSet) Filter

func (set TriggerConstraintSet) Filter(f func(*TriggerConstraint) (bool, error)) (out TriggerConstraintSet, err error)

Filter iterates through every slice item, calls f(TriggerConstraint) (bool, err) and return filtered slice

This function is auto-generated.

func (*TriggerConstraintSet) Scan

func (vv *TriggerConstraintSet) Scan(src any) error

func (TriggerConstraintSet) Value

func (vv TriggerConstraintSet) Value() (driver.Value, error)

func (TriggerConstraintSet) Walk

func (set TriggerConstraintSet) Walk(w func(*TriggerConstraint) error) (err error)

Walk iterates through every slice item and calls w(TriggerConstraint) err

This function is auto-generated.

type TriggerFilter

type TriggerFilter struct {
	TriggerID  []string `json:"triggerID"`
	WorkflowID []string `json:"workflowID"`

	EventType    string `json:"eventType"`
	ResourceType string `json:"resourceType"`

	Deleted  filter.State `json:"deleted"`
	Disabled filter.State `json:"disabled"`

	LabeledIDs []uint64          `json:"-"`
	Labels     map[string]string `json:"labels,omitempty"`

	// Check fn is called by store backend for each resource found function can
	// modify the resource and return false if store should not return it
	//
	// Store then loads additional resources to satisfy the paging parameters
	Check func(*Trigger) (bool, error) `json:"-"`

	// Standard helpers for paging and sorting
	filter.Sorting
	filter.Paging
}

type TriggerMeta

type TriggerMeta struct {
	Description string                 `json:"description"`
	Visual      map[string]interface{} `json:"visual"`
}

func ParseTriggerMeta

func ParseTriggerMeta(ss []string) (p *TriggerMeta, err error)

func (*TriggerMeta) Scan

func (vv *TriggerMeta) Scan(src any) error

func (*TriggerMeta) Value

func (vv *TriggerMeta) Value() (driver.Value, error)

type TriggerSet

type TriggerSet []*Trigger

TriggerSet slice of Trigger

This type is auto-generated.

func (TriggerSet) Filter

func (set TriggerSet) Filter(f func(*Trigger) (bool, error)) (out TriggerSet, err error)

Filter iterates through every slice item, calls f(Trigger) (bool, err) and return filtered slice

This function is auto-generated.

func (TriggerSet) FilterByWorkflowID

func (set TriggerSet) FilterByWorkflowID(workflowID uint64) (vv TriggerSet)

func (TriggerSet) FindByID

func (set TriggerSet) FindByID(ID uint64) *Trigger

FindByID finds items from slice by its ID property

This function is auto-generated.

func (TriggerSet) IDs

func (set TriggerSet) IDs() (IDs []uint64)

IDs returns a slice of uint64s from all items in the set

This function is auto-generated.

func (TriggerSet) Walk

func (set TriggerSet) Walk(w func(*Trigger) error) (err error)

Walk iterates through every slice item and calls w(Trigger) err

This function is auto-generated.

type Workflow

type Workflow struct {
	ID      uint64            `json:"workflowID,string"`
	Handle  string            `json:"handle"`
	Labels  map[string]string `json:"labels,omitempty"`
	Meta    *WorkflowMeta     `json:"meta,omitempty"`
	Enabled bool              `json:"enabled"`

	Trace bool `json:"trace"`

	// how much time do we keep completed sessions (in sec)
	KeepSessions int `json:"keepSessions"`

	// Initial input scope
	Scope *expr.Vars `json:"scope"`

	Steps WorkflowStepSet `json:"steps"`
	Paths WorkflowPathSet `json:"paths"`

	// Collection of issues from the last parse
	Issues WorkflowIssueSet `json:"issues,omitempty"`

	RunAs uint64 `json:"runAs,string"`

	OwnedBy   uint64     `json:"ownedBy,string"`
	CreatedAt time.Time  `json:"createdAt,omitempty"`
	CreatedBy uint64     `json:"createdBy,string" `
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`
	UpdatedBy uint64     `json:"updatedBy,string,omitempty"`
	DeletedAt *time.Time `json:"deletedAt,omitempty"`
	DeletedBy uint64     `json:"deletedBy,string,omitempty"`
}

Workflow represents entire workflow definition

func (Workflow) CheckDeferred

func (r Workflow) CheckDeferred() bool

CheckDeferred returns true if any of the steps is deferred.

Workflow is considered deferred when delay or prompt step types are used. Deferred workflows cannot short-circuit triggers or prevent creation/update on before triggers

@todo add flag on workflow to explicitly mark workflow as deferred even when there are no delay or prompt steps

func (*Workflow) DecodeTranslations

func (r *Workflow) DecodeTranslations(tt locale.ResourceTranslationIndex)

func (Workflow) Dict

func (r Workflow) Dict() map[string]interface{}

func (*Workflow) EncodeTranslations

func (r *Workflow) EncodeTranslations() (out locale.ResourceTranslationSet)

func (Workflow) Executable

func (r Workflow) Executable() bool

Executable returns true if workflow is valid and enabled

func (Workflow) GetID

func (r Workflow) GetID() uint64

func (Workflow) GetLabels

func (m Workflow) GetLabels() map[string]string

GetLabels adds new label to label map

func (*Workflow) GetValue

func (r *Workflow) GetValue(name string, pos uint) (any, error)

func (Workflow) LabelResourceID

func (m Workflow) LabelResourceID() uint64

GetLabels adds new label to label map

func (Workflow) LabelResourceKind

func (Workflow) LabelResourceKind() string

GetLabels adds new label to label map

func (Workflow) RbacResource

func (r Workflow) RbacResource() string

RbacResource returns string representation of RBAC resource for Workflow by calling WorkflowRbacResource fn

RBAC resource is in the corteza::automation:workflow/... format

This function is auto-generated

func (Workflow) ResourceTranslation

func (r Workflow) ResourceTranslation() string

ResourceTranslation returns string representation of Locale resource for Workflow by calling WorkflowResourceTranslation fn

Locale resource is in the automation:workflow/... format

This function is auto-generated

func (*Workflow) SetLabel

func (m *Workflow) SetLabel(key string, value string)

SetLabel adds new label to label map

func (*Workflow) SetValue

func (r *Workflow) SetValue(name string, pos uint, value any) (err error)

type WorkflowExecParams

type WorkflowExecParams struct {
	// When executed as a sub-workflow
	CallerWorkflowID uint64

	// When executed as a sub-workflow
	CallerSessionID uint64

	// When executed as a sub-workflow
	CallerStepID uint64

	// Start with this specific step
	StepID uint64

	EventType    string
	ResourceType string

	// Enable execution tracing
	Trace bool

	// Do not wait for workflow to be finished
	Async bool

	// Wait for workflow to be executed even if it's deferred
	Wait bool

	Input *expr.Vars
}

type WorkflowFilter

type WorkflowFilter struct {
	WorkflowID []string `json:"workflowID"`

	Handle string `json:"handle"`

	Query string `json:"query"`

	Deleted  filter.State `json:"deleted"`
	Disabled filter.State `json:"disabled"`

	// include sub-workflows
	SubWorkflow filter.State `json:"subWorkflow"`

	LabeledIDs []uint64          `json:"-"`
	Labels     map[string]string `json:"labels,omitempty"`

	// Check fn is called by store backend for each resource found function can
	// modify the resource and return false if store should not return it
	//
	// Store then loads additional resources to satisfy the paging parameters
	Check func(*Workflow) (bool, error) `json:"-"`

	// Standard helpers for paging and sorting
	filter.Sorting
	filter.Paging
}

type WorkflowIssue

type WorkflowIssue struct {
	// url encoded location of the error:
	Culprit     map[string]int `json:"culprit"`
	Description string         `json:"description"`
}

func (*WorkflowIssue) String

func (issue *WorkflowIssue) String() string

type WorkflowIssueSet

type WorkflowIssueSet []*WorkflowIssue

WorkflowIssueSet slice of WorkflowIssue

This type is auto-generated.

func (WorkflowIssueSet) Append

func (set WorkflowIssueSet) Append(err error, culprit map[string]int) WorkflowIssueSet

func (WorkflowIssueSet) Distinct

func (set WorkflowIssueSet) Distinct() (out WorkflowIssueSet)

Distinct returns set of issues without duplicates

func (WorkflowIssueSet) Error

func (set WorkflowIssueSet) Error() string

func (WorkflowIssueSet) Filter

func (set WorkflowIssueSet) Filter(f func(*WorkflowIssue) (bool, error)) (out WorkflowIssueSet, err error)

Filter iterates through every slice item, calls f(WorkflowIssue) (bool, err) and return filtered slice

This function is auto-generated.

func (*WorkflowIssueSet) Scan

func (set *WorkflowIssueSet) Scan(src any) error

func (WorkflowIssueSet) SetCulprit

func (set WorkflowIssueSet) SetCulprit(name string, pos int) WorkflowIssueSet

func (WorkflowIssueSet) Value

func (set WorkflowIssueSet) Value() (driver.Value, error)

func (WorkflowIssueSet) Walk

func (set WorkflowIssueSet) Walk(w func(*WorkflowIssue) error) (err error)

Walk iterates through every slice item and calls w(WorkflowIssue) err

This function is auto-generated.

type WorkflowMeta

type WorkflowMeta struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	Visual      map[string]interface{} `json:"visual"`

	// list as one of the sub-workflows, when set to true
	// there should be no enabled triggers on this workflow
	SubWorkflow bool `json:"subWorkflow,omitempty"`
}

func ParseWorkflowMeta

func ParseWorkflowMeta(ss []string) (p *WorkflowMeta, err error)

func (*WorkflowMeta) Scan

func (vv *WorkflowMeta) Scan(src any) error

func (*WorkflowMeta) Value

func (vv *WorkflowMeta) Value() (driver.Value, error)

type WorkflowPath

type WorkflowPath struct {
	// Expression to evaluate over the input variables; results will be set to scope under variable Name
	Expr string `json:"expr,omitempty"`

	ParentID uint64           `json:"parentID,string"`
	ChildID  uint64           `json:"childID,string"`
	Meta     WorkflowPathMeta `json:"meta,omitempty"`
	// contains filtered or unexported fields
}

WorkflowPath defines connection between two workflow steps

func (WorkflowPath) Eval

func (t WorkflowPath) Eval(ctx context.Context, scope *expr.Vars) (interface{}, error)

func (WorkflowPath) GetExpr

func (t WorkflowPath) GetExpr() string

func (*WorkflowPath) SetEval

func (t *WorkflowPath) SetEval(eval expr.Evaluable)

func (WorkflowPath) Test

func (t WorkflowPath) Test(ctx context.Context, scope *expr.Vars) (bool, error)

type WorkflowPathMeta

type WorkflowPathMeta struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	Visual      map[string]interface{} `json:"visual"`
}

type WorkflowPathSet

type WorkflowPathSet []*WorkflowPath

WorkflowPathSet slice of WorkflowPath

This type is auto-generated.

func ParseWorkflowPathSet

func ParseWorkflowPathSet(ss []string) (p WorkflowPathSet, err error)

func (WorkflowPathSet) Filter

func (set WorkflowPathSet) Filter(f func(*WorkflowPath) (bool, error)) (out WorkflowPathSet, err error)

Filter iterates through every slice item, calls f(WorkflowPath) (bool, err) and return filtered slice

This function is auto-generated.

func (*WorkflowPathSet) Scan

func (vv *WorkflowPathSet) Scan(src any) error

func (WorkflowPathSet) Value

func (vv WorkflowPathSet) Value() (driver.Value, error)

func (WorkflowPathSet) Walk

func (set WorkflowPathSet) Walk(w func(*WorkflowPath) error) (err error)

Walk iterates through every slice item and calls w(WorkflowPath) err

This function is auto-generated.

type WorkflowSet

type WorkflowSet []*Workflow

WorkflowSet slice of Workflow

This type is auto-generated.

func (WorkflowSet) Filter

func (set WorkflowSet) Filter(f func(*Workflow) (bool, error)) (out WorkflowSet, err error)

Filter iterates through every slice item, calls f(Workflow) (bool, err) and return filtered slice

This function is auto-generated.

func (WorkflowSet) FindByID

func (set WorkflowSet) FindByID(ID uint64) *Workflow

FindByID finds items from slice by its ID property

This function is auto-generated.

func (WorkflowSet) IDs

func (set WorkflowSet) IDs() (IDs []uint64)

IDs returns a slice of uint64s from all items in the set

This function is auto-generated.

func (WorkflowSet) Walk

func (set WorkflowSet) Walk(w func(*Workflow) error) (err error)

Walk iterates through every slice item and calls w(Workflow) err

This function is auto-generated.

type WorkflowStep

type WorkflowStep struct {
	ID   uint64           `json:"stepID,string"`
	Kind WorkflowStepKind `json:"kind"`

	// reference to function or subprocess (workflow)
	Ref string `json:"ref"`

	// set of expressions to evaluate, test or pass to function
	// invalid for for kind=~gateway:*
	Arguments []*Expr `json:"arguments"`

	// only valid when kind=function
	Results []*Expr `json:"results"`

	Meta WorkflowStepMeta `json:"meta,omitempty"`

	Labels map[string]string `json:"labels,omitempty"`
}

WorkflowStep describes one workflow step

func (WorkflowStep) IsDeferred

func (s WorkflowStep) IsDeferred() (is bool)

IsDeferred fn returns true if type of step is delay or prompt

type WorkflowStepKind

type WorkflowStepKind string
const (
	WorkflowStepKindExpressions  WorkflowStepKind = "expressions"   // no ref
	WorkflowStepKindGateway      WorkflowStepKind = "gateway"       // ref = join|fork|excl|incl
	WorkflowStepKindFunction     WorkflowStepKind = "function"      // ref = <function ref>
	WorkflowStepKindIterator     WorkflowStepKind = "iterator"      // ref = <iterator function ref>
	WorkflowStepKindError        WorkflowStepKind = "error"         // no ref
	WorkflowStepKindTermination  WorkflowStepKind = "termination"   // no ref
	WorkflowStepKindPrompt       WorkflowStepKind = "prompt"        // ref = <client function>
	WorkflowStepKindDelay        WorkflowStepKind = "delay"         // no ref
	WorkflowStepKindErrHandler   WorkflowStepKind = "error-handler" // no ref
	WorkflowStepKindVisual       WorkflowStepKind = "visual"        // ref = <*>
	WorkflowStepKindDebug        WorkflowStepKind = "debug"         // ref = <*>
	WorkflowStepKindBreak        WorkflowStepKind = "break"         // ref = <*>
	WorkflowStepKindContinue     WorkflowStepKind = "continue"      // ref = <*>
	WorkflowStepKindExecWorkflow WorkflowStepKind = "exec-workflow" // no ref
)

type WorkflowStepMeta

type WorkflowStepMeta struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	Visual      map[string]interface{} `json:"visual"`
}

type WorkflowStepSet

type WorkflowStepSet []*WorkflowStep

WorkflowStepSet slice of WorkflowStep

This type is auto-generated.

func ParseWorkflowStepSet

func ParseWorkflowStepSet(ss []string) (p WorkflowStepSet, err error)

func (WorkflowStepSet) Filter

func (set WorkflowStepSet) Filter(f func(*WorkflowStep) (bool, error)) (out WorkflowStepSet, err error)

Filter iterates through every slice item, calls f(WorkflowStep) (bool, err) and return filtered slice

This function is auto-generated.

func (WorkflowStepSet) FindByID

func (set WorkflowStepSet) FindByID(ID uint64) *WorkflowStep

FindByID finds items from slice by its ID property

This function is auto-generated.

func (WorkflowStepSet) HasDeferred

func (vv WorkflowStepSet) HasDeferred() bool

HasDeferred fn returns true if wf-step is delay or prompt

func (WorkflowStepSet) IDs

func (set WorkflowStepSet) IDs() (IDs []uint64)

IDs returns a slice of uint64s from all items in the set

This function is auto-generated.

func (*WorkflowStepSet) Scan

func (vv *WorkflowStepSet) Scan(src any) error

func (WorkflowStepSet) Value

func (vv WorkflowStepSet) Value() (driver.Value, error)

func (WorkflowStepSet) Walk

func (set WorkflowStepSet) Walk(w func(*WorkflowStep) error) (err error)

Walk iterates through every slice item and calls w(WorkflowStep) err

This function is auto-generated.

Jump to

Keyboard shortcuts

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