model

package
v0.77.4 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: Apache-2.0 Imports: 29 Imported by: 11

Documentation

Index

Constants

View Source
const (
	//CatchTask  represent a task name that execute if error occurred and defined
	CatchTask = "catch"
	//DeferredTask represent a task name that always execute if defined
	DeferredTask = "defer"
	//ExplicitActionAttributePrefix represent model attribute prefix
	ExplicitActionAttributePrefix  = ":"
	ExplicitRequestAttributePrefix = "@"
)
View Source
const (
	OwnerURL = "ownerURL"
)
View Source
const SliceKey = "data"

SliceKey represents slice key

Variables

This section is empty.

Functions

This section is empty.

Types

type AbstractNode

type AbstractNode struct {
	Name        string
	Description string    `yaml:",omitempty"`
	Init        Variables `description:"state init instruction " yaml:",omitempty"`
	Post        Variables `description:"post execution state update instruction" yaml:",omitempty"`
	When        string    `description:"run criteria" yaml:",omitempty"`
	SleepTimeMs int       `yaml:",omitempty"`
	Logging     *bool     `description:"optional flag to disable logging, enabled by default" yaml:",omitempty"`
	// contains filtered or unexported fields
}

AbstractNode represents an abstract workflow node(of a workflow, task or acton type)

func (*AbstractNode) Clone added in v0.70.1

func (n *AbstractNode) Clone() *AbstractNode

func (*AbstractNode) WhenEval added in v0.70.1

func (n *AbstractNode) WhenEval() *eval.Compute

type Action

type Action struct {
	*AbstractNode   `yaml:",inline"`
	*ServiceRequest `yaml:",inline"`
	*MetaTag        `yaml:",inline"`
	*Repeater       `yaml:",inline"`
	Async           bool   `description:"flag to run action async" yaml:",omitempty"`
	Skip            string `description:"criteria to skip current TagID"  yaml:",omitempty"`
	// contains filtered or unexported fields
}

Action represents a workflow service action

func (*Action) Clone added in v0.35.0

func (a *Action) Clone() *Action

Clone clones this actions

func (*Action) ID

func (a *Action) ID() string

ID returns action identified

func (*Action) Init

func (a *Action) Init() error

NewActivity returns pipeline activity

func (*Action) SkipEval added in v0.70.1

func (a *Action) SkipEval() *eval.Compute

type ActionSelector

type ActionSelector string

ActionSelector represents an expression to invoke endly action: service.Action (for workflow service workflow keyword can be skipped)

func (*ActionSelector) Action

func (s *ActionSelector) Action() string

Action returns action

func (ActionSelector) Service

func (s ActionSelector) Service() string

Service returns service

type Activities

type Activities struct {
	Activity *Activity
	// contains filtered or unexported fields
}

Activities represents activities

func NewActivities

func NewActivities() *Activities

NewActivities creates a new activites

func (*Activities) First

func (a *Activities) First() *Activity

func (*Activities) Get

func (a *Activities) Get(index int) *Activity

Get returns activity for index

func (*Activities) Last

func (a *Activities) Last() *Activity

func (*Activities) Len

func (a *Activities) Len() int

func (*Activities) Pop

func (a *Activities) Pop() *Activity

Pop removes last activity

func (*Activities) Push

func (a *Activities) Push(activity *Activity)

Push add activity

func (*Activities) Range added in v0.25.1

func (a *Activities) Range(handler func(activity *Activity) bool, reverse bool)

Range iterates over all activities

type Activity

type Activity struct {
	*MetaTag
	Caller          string
	Task            string
	Service         string
	Action          string
	Description     string
	Error           string
	StartTime       time.Time
	Ineligible      bool
	Request         interface{}
	Response        map[string]interface{}
	ServiceResponse *endly.ServiceResponse
	Logging         *bool
}

Activity represents pipeline or workflow activity

func NewActivity

func NewActivity(context *endly.Context, action *Action, state data.Map) *Activity

NewActivity returns a new workflow Activity.

func (*Activity) FormatTag

func (a *Activity) FormatTag() string

FormatTag return a formatted tag

type ActivityEndEvent

type ActivityEndEvent struct {
	Response interface{}
}

ActivityEndEvent represents Activity end event type.

func NewActivityEndEvent

func NewActivityEndEvent(response interface{}) *ActivityEndEvent

NewActivityEndEvent creates a new ActivityEndEvent

type ExecutionError

type ExecutionError struct {
	Error    string
	Caller   string
	TaskName string
	Request  interface{}
	Response interface{}
}

Error represent workflow error

func (*ExecutionError) AsMap

func (e *ExecutionError) AsMap() map[string]interface{}

AsMap returns error map

type Extract

type Extract struct {
	RegExpr  string `description:"regular expression with oval bracket to extract match pattern"`            //regular expression
	Key      string `description:"state key to store a match"`                                               //state key to store a match
	Reset    bool   `description:"reset the key in the context before evaluating this data extraction rule"` //reset the key in the context before evaluating this data extraction rule
	Required bool   `description:"require that at least one pattern match is returned"`                      //require that at least one pattern match is returned
}

Extract represents a data extraction

func NewExtract

func NewExtract(key, regExpr string, reset bool, required bool) *Extract

NewExtract creates a new data extraction

type ExtractEvent added in v0.25.1

type ExtractEvent struct {
	Output           string
	StructuredOutput interface{}
	Data             interface{}
}

ExtractEvent represents data extraction event

func NewExtractEvent

func NewExtractEvent(output string, structuredOutput, extracted interface{}) *ExtractEvent

NewExtractEvent creates a new event.

type Extracts

type Extracts []*Extract

Extracts represents an expected data collection

func NewExtracts

func NewExtracts() Extracts

NewExtracts creates a new NewExtracts

func (*Extracts) Extract

func (d *Extracts) Extract(context *endly.Context, extracted map[string]interface{}, inputs ...string) error

Extracts extract data from provided inputs, the result is placed to expected map, or error

func (*Extracts) Reset

func (d *Extracts) Reset(state data.Map)

Reset removes key from supplied state map.

type Inlined added in v0.70.1

type Inlined struct {
	Init     interface{}
	Post     interface{}
	Logging  *bool
	Defaults map[string]interface{}
	Data     map[string]interface{}
	Pipeline []*MapEntry
	State    data.Map
	// contains filtered or unexported fields
}

Inlined represents inline workflow

func (*Inlined) AsWorkflow added in v0.70.1

func (p *Inlined) AsWorkflow(name string, baseURL string) (*Workflow, error)

type MapEntry

type MapEntry struct {
	Key   string      `description:"preserved order map entry key"`
	Value interface{} `description:"preserved order map entry value"`
}

type MetaTag added in v0.25.1

type MetaTag struct {
	Tag            string `yaml:",omitempty"` //tag
	TagIndex       string `yaml:",omitempty"` //tag index
	TagID          string `yaml:",omitempty"` //tag id
	TagDescription string `yaml:",omitempty"` //tag description
	Comments       string `yaml:",omitempty"`
}

MetaTag represent a node tag

type ModifiedStateEvent

type ModifiedStateEvent struct {
	Variables Variables
	In        map[string]interface{}
	Modified  map[string]interface{}
}

ModifiedStateEvent represent modified state event

func NewModifiedStateEvent

func NewModifiedStateEvent(variables Variables, in, out data.Map) *ModifiedStateEvent

NewModifiedStateEvent creates a new modified state event.

type OperatingSystem

type OperatingSystem struct {
	*gosh.OSInfo
	*gosh.HardwareInfo
}

Os represents an Os

func (*OperatingSystem) Matches

func (s *OperatingSystem) Matches(target *OsTarget) bool

Matches returns true if operating system matches provided target

type OsTarget

type OsTarget struct {
	System             string
	Architecture       string
	Name               string
	MinRequiredVersion string
	MaxAllowedVersion  string
}

OsTarget represents operating system target

type Path

type Path struct {
	Items []string
	// contains filtered or unexported fields
}

Path represents a system path

func NewPath

func NewPath(items ...string) *Path

NewSystemPath create a new system path.

func (*Path) EnvValue

func (p *Path) EnvValue() string

EnvValue returns evn values

func (*Path) Unshift

func (p *Path) Unshift(paths ...string)

Unshift add path at the begining to the system paths

type Process

type Process struct {
	Source   *location.Resource
	Owner    string
	TagIDs   map[string]bool
	HasTagID bool
	Workflow *Workflow
	Task     *Task
	TaskNode *TasksNode
	*Activities
	State      data.Map
	Terminated int32
	Scheduled  *Task
	*ExecutionError
}

Process represents a running instance of workflow/pipeline process.

func NewProcess

func NewProcess(source *location.Resource, workflow *Workflow, upstream *Process) *Process

NewProcess creates a new workflow, pipeline process

func (*Process) AddTagIDs

func (p *Process) AddTagIDs(tagIDs ...string)

Push adds a workflow to the workflow stack.

func (*Process) CanRun

func (p *Process) CanRun() bool

CanRun returns true if current workflow can run

func (*Process) IsTerminated

func (p *Process) IsTerminated() bool

IsTerminated returns true if current workflow has been terminated

func (*Process) Push

func (p *Process) Push(activity *Activity)

Push adds supplied activity

func (*Process) SetTask

func (p *Process) SetTask(task *Task)

SetTask sets process task

func (*Process) Terminate

func (p *Process) Terminate()

Terminate flags current workflow as terminated

type Processes

type Processes struct {
	// contains filtered or unexported fields
}

processes represents running workflow/pipe process stack.

func NewProcesses

func NewProcesses() *Processes

NewProcesses creates a new processes

func (*Processes) First

func (p *Processes) First() *Process

First returns the first process.

func (*Processes) FirstWorkflow

func (p *Processes) FirstWorkflow() *Process

FirstWorkflow returns the first workflow.

func (*Processes) Last

func (p *Processes) Last() *Process

Last returns the last process.

func (*Processes) LastWorkflow

func (p *Processes) LastWorkflow() *Process

LastWorkflow returns the last workflow.

func (*Processes) Pop

func (p *Processes) Pop() *Process

Pop removes the first workflow from the workflow stack.

func (*Processes) Push

func (p *Processes) Push(process *Process)

Push adds a workflow to the workflow stack.

func (*Processes) Recent

func (p *Processes) Recent(count int) []*Process

Recent returns the most reset process.

type Repeater

type Repeater struct {
	Extract     Extracts  `yaml:",omitempty"` //textual regexp based data extraction
	Variables   Variables `yaml:",omitempty"` //structure data based data extraction
	Repeat      int       `yaml:",omitempty"` //how many time send this request
	ThinkTimeMs int       `yaml:",omitempty"` //Sleep time after request send, this only makes sense with repeat option
	Exit        string    `yaml:",omitempty"` //Exit criteria, it uses expected variable to determine repeat termination
	// contains filtered or unexported fields
}

Repeater represent repeated execution

func NewRepeater

func NewRepeater() *Repeater

NewRepeater creates a new repeatable struct

func (*Repeater) Eval added in v0.72.0

func (r *Repeater) Eval(context *endly.Context, callerInfo string, out interface{}, extracted map[string]interface{}) (bool, error)

func (*Repeater) EvaluateExitCriteria

func (r *Repeater) EvaluateExitCriteria(callerInfo string, context *endly.Context, extracted map[string]interface{}) (bool, error)

EvaluateExitCriteria check is exit criteria is met.

func (*Repeater) Init

func (r *Repeater) Init() *Repeater

Get returns non empty instance of default instance

func (*Repeater) Run

func (r *Repeater) Run(context *endly.Context, callerInfo string, service *endly.AbstractService, handler func() (interface{}, error), extracted map[string]interface{}) error

Run repeats x times supplied handler

type ServiceRequest

type ServiceRequest struct {
	Service string      `description:"service SessionID"`
	Action  string      `description:"service's'action "`
	Request interface{} `description:"service request" `
}

ServiceRequest represent an action request

func (*ServiceRequest) Init

func (r *ServiceRequest) Init() *ServiceRequest

Init initialises action

func (*ServiceRequest) NewAction

func (r *ServiceRequest) NewAction() *Action

func (*ServiceRequest) Validate

func (r *ServiceRequest) Validate() error

Validate check is action request is valid

type Session

type Session struct {
	ID string
	*gosh.Service
	DaemonType    int
	Username      string
	SuperUSerAuth bool
	//Path             *Path
	EnvVariables     map[string]string
	CurrentDirectory string
	Deployed         map[string]string
	Cacheable        map[string]interface{}
	Mutex            *sync.RWMutex
}

Session represents a system terminal session

func NewSession

func NewSession(id string, connection *gosh.Service) (*Session, error)

NewSession create a new client session

type Sessions

type Sessions map[string]*Session

Sessions represents a map of client sessions keyed by session id

func (*Sessions) Has

func (s *Sessions) Has(id string) bool

Has checks if client session exists for provided id.

type Tag added in v0.70.1

type Tag struct {
	OwnerSource *location.Resource
	OwnerName   string
	Name        string
	Group       string
	IsArray     bool
	Iterator    *TagIterator
	LineNumber  int
	Subpath     string
	PathMatch   string
	// contains filtered or unexported fields
}

Tag represents a tag

func NewTag added in v0.70.1

func NewTag(ownerName string, ownerSource *location.Resource, key string, lineNumber int) *Tag

NewTag creates a new neatly tag

func (*Tag) Expand added in v0.70.1

func (t *Tag) Expand(text string) string

func (*Tag) HasActiveIterator added in v0.70.1

func (t *Tag) HasActiveIterator() bool

HasActiveIterator returns true if tag has active iterator

func (*Tag) TagID added in v0.70.1

func (t *Tag) TagID() string

TagID returns tag ID

type TagIterator added in v0.70.1

type TagIterator struct {
	Template string
	Min      int
	Max      int
	// contains filtered or unexported fields
}

TagIterator represents tag iterator to produce Instance

func (*TagIterator) Has added in v0.70.1

func (i *TagIterator) Has() bool

Has return true if iterator has not been exhausted

func (*TagIterator) Index added in v0.70.1

func (i *TagIterator) Index() string

Index returns an index of the iterator

func (*TagIterator) Next added in v0.70.1

func (i *TagIterator) Next() bool

Next eturns increment counter and checks if it is has next.

type Task

type Task struct {
	*AbstractNode `yaml:",inline"` //abstract node
	Actions       []*Action        ` yaml:",omitempty"` //actions
	*TasksNode    ` yaml:",inline"`
	Fail          bool      ` yaml:",omitempty"` //controls if return fail status workflow on catch task
	Template      *Template ` yaml:",omitempty"`
	// contains filtered or unexported fields
}

Task represents a group of action

func NewTask

func NewTask(name string, multiAction bool) *Task

NewTask creates a new task

func (*Task) AsyncActions added in v0.21.2

func (t *Task) AsyncActions() []*Action

AsyncActions returns async actions

func (*Task) Clone added in v0.70.1

func (t *Task) Clone() *Task

func (*Task) HasTagID

func (t *Task) HasTagID(tagIDs map[string]bool) bool

HasTagID checks if task has supplied tagIDs

type Tasks added in v0.70.1

type Tasks []*Task

type TasksNode

type TasksNode struct {
	Tasks        Tasks  ` yaml:",omitempty"` //sub tasks
	OnErrorTask  string ` yaml:",omitempty"` //task that will run if error occur, the final workflow will return this task response
	DeferredTask string ` yaml:",omitempty"` //task that will always run if there has been previous  error or not
}

TasksNode represents a task node

func (*TasksNode) Clone added in v0.70.1

func (t *TasksNode) Clone() *TasksNode

func (*TasksNode) Has

func (t *TasksNode) Has(name string) bool

Task returns a task for supplied name

func (*TasksNode) Select

func (t *TasksNode) Select(selector TasksSelector) *TasksNode

Select selects tasks matching supplied selector

func (*TasksNode) Task

func (t *TasksNode) Task(name string) (*Task, error)

Task returns a task for supplied name

type TasksSelector

type TasksSelector string

TasksSelector represents a task selector

func (*TasksSelector) RunAll

func (t *TasksSelector) RunAll() bool

RunAll returns true if no individual tasks are selected

func (*TasksSelector) Tasks

func (t *TasksSelector) Tasks() []string

Tasks return tasks

type Template

type Template struct {
	SubPath     string            `description:"sub path for dynamic resource template expansion: i.e. use_cases/${index}*"`
	Tag         string            `description:"grouping tag i.e Test"`
	Range       string            `description:"range expression i.e 2..003  where upper bound number drives padding $index variable"`
	Description string            `description:"reference to file containing tagDescription i.e. @use_case,  file reference has to start with @"`
	Data        map[string]string `` /* 181-byte string literal not displayed */
	Tasks       []*Task           `description:"tasks to expand"`
}

type TransientTemplate added in v0.70.1

type TransientTemplate struct {
	SubPath     string            `description:"sub path for dynamic resource template expansion: i.e. use_cases/${index}*"`
	Tag         string            `description:"grouping tag i.e Test"`
	Range       string            `description:"range expression i.e 2..003  where upper bound number drives padding $index variable"`
	Description string            `description:"reference to file containing tagDescription i.e. @use_case,  file reference has to start with @"`
	Data        map[string]string `` /* 181-byte string literal not displayed */
	Template    []interface{}     `description:"template to expand"`
	// contains filtered or unexported fields
}

TransientTemplate represents inline workflow template to dynamically Expand actions - idea borrowed from neatly format: https://github.com/viant/neatly/

func (*TransientTemplate) Expand added in v0.70.1

func (t *TransientTemplate) Expand(task *Task, parentTag string, inline *Inlined) error

type Variable

type Variable struct {
	Name              string            `description:"name"`
	Value             interface{}       `description:"default value"`
	From              string            `description:"context state map key to pull data"`
	When              string            `` /* 139-byte string literal not displayed */
	Else              interface{}       `description:"if when criteria is not met then else can provide variable value alternative"`
	Required          bool              `description:"flag that validates that from returns non empty value or error is generated"`
	EmptyIfUnexpanded bool              `description:"threat variable value empty if it was not expanded"`
	Replace           map[string]string `` /* 147-byte string literal not displayed */
	// contains filtered or unexported fields
}

Variable represents a variable

func NewVariable

func NewVariable(name, form, when string, required bool, value, elseValue interface{}, replace map[string]string, emptyIfUnexpanded bool) *Variable

NewVariable creates a new variable

func (*Variable) Apply

func (v *Variable) Apply(in, out data.Map) error

func (*Variable) MarshalYAML added in v0.70.1

func (v *Variable) MarshalYAML() (interface{}, error)

type VariableExpression

type VariableExpression string

VariableExpression represent a variable expression [!] VariableName = [when ?] value : otherwiseValue, exclamation mark flags variable as required

func (*VariableExpression) AsVariable

func (e *VariableExpression) AsVariable() (*Variable, error)

AsVariable converts expression to variable

type Variables

type Variables []*Variable

Variables a slice of variables

func GetVariables

func GetVariables(baseURLs []string, source interface{}) (Variables, error)

GetVariables returns variables from Variables ([]*Variable), []string (as expression) or from []interface{} (where interface is a map matching Variable struct)

func (*Variables) Apply

func (v *Variables) Apply(in, out data.Map) error

Apply evaluates all variable from in map to out map

func (Variables) MarshalYAML added in v0.70.1

func (v Variables) MarshalYAML() (interface{}, error)

func (Variables) String

func (v Variables) String() string

String returns a variable info

type Workflow

type Workflow struct {
	Source        *location.Resource ` yaml:",omitempty"` //source definition of the workflow
	Data          data.Map           `yaml:"-"`           //workflow data
	*AbstractNode `yaml:",inline"`   //workflow node`
	*TasksNode    `yaml:"pipeline"`  ///workflow tasks
}

Workflow represents a workflow

func (*Workflow) Init

func (w *Workflow) Init() error

Init validates this workflow

func (*Workflow) MarshalYAML added in v0.70.1

func (t *Workflow) MarshalYAML() (interface{}, error)

func (*Workflow) Validate

func (w *Workflow) Validate() error

Validate validates this workflow

type WorkflowSelector

type WorkflowSelector string

WorkflowSelector represents an expression to invoke workflow with all or specified task: URL[:tasks]

func (WorkflowSelector) IsRelative

func (s WorkflowSelector) IsRelative() bool

IsRelative returns true if selector is relative path

func (WorkflowSelector) Name

func (s WorkflowSelector) Name() string

Name returns selector workflow name

func (WorkflowSelector) Tasks

func (s WorkflowSelector) Tasks() string

TasksSelector returns selector tasks

func (WorkflowSelector) URL

func (s WorkflowSelector) URL() string

URL returns workflow url

Directories

Path Synopsis
ast
yml
Package project package project defines project model
Package project package project defines project model
dao

Jump to

Keyboard shortcuts

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