workflow

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

README

Workflow service

Workflow Service

Workflow service provide capability to run task, action from any defined workflow.

Service Id Action Description Request Response
workflow run run workflow with specified tasks and parameters RunRequest RunResponse
workflow goto switch current execution to the specified task on current workflow GotoRequest GotoResponse
workflow switch run matched case action or task SwitchRequest SwitchResponse
workflow exit terminate execution of active workflow (caller) n/a n/a
workflow fail fail workflow FailRequest n/a

Predefined workflows

Predefined workflows

Predefined set provides commonly used workflow for services, app to build, deploy and testing.

Workflows

Documentation

Index

Constants

View Source
const (
	//ServiceID represents workflow Service id
	ServiceID = "workflow"
)

Variables

This section is empty.

Functions

func FirstWorkflow

func FirstWorkflow(context *endly.Context) *model.Process

FirstWorkflow returns last workflow

func GetResource

func GetResource(dao *Dao, state data.Map, URL string) *url.Resource

GetResource returns workflow resource

func Last

func Last(context *endly.Context) *model.Process

Last returns last process

func LastWorkflow

func LastWorkflow(context *endly.Context) *model.Process

LastWorkflow returns last workflow

func New

func New() endly.Service

New returns a new workflow Service.

func Pop

func Pop(context *endly.Context) *model.Process

Remove push process to context

func Push

func Push(context *endly.Context, process *model.Process)

Push push process to context

Types

type AsyncEvent

type AsyncEvent struct {
	ServiceAction *model.Action
}

AsyncEvent represents an async action event.

func NewAsyncEvent

func NewAsyncEvent(action *model.Action) *AsyncEvent

NewAsyncEvent creates a new AsyncEvent.

type Dao

type Dao struct {
	Dao *neatly.Dao
}

Dao represents a workflow loader

func NewDao

func NewDao() *Dao

NewDao returns a new NewDao

func (*Dao) Load

func (d *Dao) Load(context *endly.Context, source *url.Resource) (*model.Workflow, error)

Load loads workflow into memory

func (*Dao) NewRepoResource

func (d *Dao) NewRepoResource(context data.Map, URI string) (*url.Resource, error)

NewRepoResource returns new woorkflow repo resource, it takes context map and resource URI

type EndEvent

type EndEvent struct {
	SessionID string
}

EndEvent represents Activity end event type.

func NewEndEvent

func NewEndEvent(sessionID string) *EndEvent

NewEndEvent create a new EndEvent

type ExitRequest

type ExitRequest struct {
	Source *url.Resource
}

ExitRequest represents workflow exit request, to exit a caller workflow

type ExitResponse

type ExitResponse struct{}

ExitResponse represents workflow exit response

type FailRequest

type FailRequest struct {
	Message string
}

FailRequest represents fail request

type FailResponse

type FailResponse struct{}

FailResponse represents workflow exit response

type GotoRequest

type GotoRequest struct {
	Task string
}

GotoRequest represents goto task action, this request will terminate current task execution to switch to specified task

type GotoResponse

type GotoResponse interface{}

GotoResponse represents workflow task response

type InitEvent

type InitEvent struct {
	Tasks string
	State map[string]interface{}
}

InitEvent represents a new workflow init event

func NewInitEvent

func NewInitEvent(tasks string, state data.Map) *InitEvent

NewInitEvent creates a new workflow init event.

type LoadRequest

type LoadRequest struct {
	Source *url.Resource
}

LoadRequest represents workflow load request from the specified source

func (*LoadRequest) Validate added in v0.8.0

func (r *LoadRequest) Validate() error

Validate checks if request is valid

type LoadResponse

type LoadResponse struct {
	*model.Workflow
}

LoadResponse represents loaded workflow

type LoadedEvent

type LoadedEvent struct {
	Workflow *model.Workflow
}

LoadedEvent represents workflow load event

func NewLoadedEvent

func NewLoadedEvent(workflow *model.Workflow) *LoadedEvent

NewLoadedEvent create a new workflow load event.

type Logger

type Logger struct {
	*model.Activities
	Listener msg.Listener
	// contains filtered or unexported fields
}

Logger represent event logger to drop event details in the provied directory.

func NewLogger

func NewLogger(directory string, listener msg.Listener) *Logger

New creates a new event logger

func (*Logger) AsEventListener

func (l *Logger) AsEventListener() msg.Listener

AsEventListener returns an event Listener

func (*Logger) OnEvent

func (l *Logger) OnEvent(event msg.Event)

OnEvent handles supplied event.

type ModifiedStateEvent

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

ModifiedStateEvent represent modified state event

func NewModifiedStateEvent

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

NewModifiedStateEvent creates a new modified state event.

type NopParrotRequest

type NopParrotRequest struct {
	In interface{}
}

NopParrotRequest represent parrot request

type NopRequest

type NopRequest struct{}

NopRequest represent no operation

type PrintRequest

type PrintRequest struct {
	Message string
	Style   int
	Error   string
}

PrintRequest represent print request

func (*PrintRequest) Messages

func (r *PrintRequest) Messages() []*msg.Message

Messages returns messages

type RegisterRequest

type RegisterRequest struct {
	*model.Workflow
}

RegisterRequest represents workflow register request

type RegisterResponse

type RegisterResponse struct {
	Source *url.Resource
}

RegisterResponse represents workflow register response

type RunRequest

type RunRequest struct {
	EnableLogging     bool                   `description:"flag to enable logging"`
	LogDirectory      string                 `description:"log directory"`
	EventFilter       map[string]bool        `description:"optional CLI filter option,key is either package name or package name.request/event prefix "`
	Async             bool                   `description:"flag to runWorkflow it asynchronously. Do not set it your self runner sets the flag for the first workflow"`
	Params            map[string]interface{} `` /* 132-byte string literal not displayed */
	PublishParameters bool                   `default:"true" description:"flag to publish parameters directly into context state"`
	SharedStateMode   bool                   `` /* 129-byte string literal not displayed */
	URL               string                 `description:"workflow URL if workflow is not found in the registry, it is loaded"`
	Name              string                 `required:"true" description:"name defined in workflow document"`
	Source            *url.Resource          `description:"run request location "`
	AssetURL          string
	TagIDs            string `description:"coma separated TagID list, if present in a task, only matched runs, other task runWorkflow as normal"`
	Tasks             string `required:"true" description:"coma separated task list, if empty or '*' runs all tasks sequentially"` //tasks to runWorkflow with coma separated list or '*', or empty string for all tasks
	*model.Pipelines
	// contains filtered or unexported fields
}

RunRequest represents workflow runWorkflow request

func NewRunRequest

func NewRunRequest(workflow string, params map[string]interface{}, publishParams bool) *RunRequest

NewRunRequest creates a new runWorkflow request

func NewRunRequestFromURL

func NewRunRequestFromURL(URL string) (*RunRequest, error)

NewRunRequestFromURL creates a new request from URL

func (*RunRequest) Init

func (r *RunRequest) Init() (err error)

Init initialises request

func (*RunRequest) Validate

func (r *RunRequest) Validate() error

Validate checks if request is valid

type RunResponse

type RunResponse struct {
	Data      map[string]interface{} //  data populated by  .Post variable section.
	SessionID string                 //session id
}

RunResponse represents workflow runWorkflow response

type Service

type Service struct {
	*endly.AbstractService
	Dao *Dao
	// contains filtered or unexported fields
}

Service represents a workflow service.

func (*Service) HasWorkflow

func (s *Service) HasWorkflow(name string) bool

HasWorkflow returns true if service has registered workflow.

func (*Service) Register

func (s *Service) Register(workflow *model.Workflow) error

Register register workflow.

func (*Service) Workflow

func (s *Service) Workflow(name string) (*model.Workflow, error)

Workflow returns a workflow for supplied name.

type SwitchCase

type SwitchCase struct {
	*model.ServiceRequest `description:"action to runWorkflow if matched"`
	Task                  string      `description:"task to runWorkflow if matched"`
	Value                 interface{} `required:"true" description:"matching sourceKey value"`
}

SwitchCase represent matching candidate case

type SwitchRequest

type SwitchRequest struct {
	SourceKey string        `required:"true" description:"sourceKey for matching value"`
	Cases     []*SwitchCase `required:"true" description:"matching value cases"`
	Default   *SwitchCase   `description:"in case no value was match case"`
}

SwitchRequest represent switch action request

func (*SwitchRequest) Match

func (r *SwitchRequest) Match(source interface{}) *SwitchCase

Match matches source with supplied action request.

func (*SwitchRequest) Validate

func (r *SwitchRequest) Validate() error

Validate checks if workflow is valid

type SwitchResponse

type SwitchResponse interface{}

SwitchResponse represents actual action or task response

Jump to

Keyboard shortcuts

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