workflow

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WorkflowVersionPendingStatus = "Pending"
	WorkflowVersionSuccessStatus = "Success"
	WorkflowVersionFailedStatus  = "Failed"
)
View Source
const (
	WorkflowSourceGit  = "git"
	WorkflowSourceFile = "file"
)
View Source
const (
	WorkflowGitTag   = "gitTag"
	WorkflowGitURL   = "gitURL"
	WorkflowGitToken = "gitToken"
)
View Source
const (
	Language         = "WDL"
	VersionRegexpStr = "^version\\s+([\\w-._]+)"
)
View Source
const (
	WorkflowCreated = "WorkflowCreated"
	WorkflowDeleted = "WorkflowDeleted"

	WorkflowVersionAdded = "WorkflowVersionAdded"

	ImportWorkflows = "ImportWorkflows"
)
View Source
const (
	CommandExecuteTimeout = time.Minute * 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory struct{}

func NewFactory

func NewFactory(_ context.Context) *Factory

func (*Factory) NewWorkflow

func (f *Factory) NewWorkflow(workspaceID string, param *WorkflowOption) (*Workflow, error)

type FileParam

type FileParam struct {
	Path    string
	Content string
}

type ImportWorkflowsEvent

type ImportWorkflowsEvent struct {
	WorkspaceID       string
	Schemas           []schema.WorkflowTypedSchema
	ImportFileBaseDir string
}

func NewImportWorkflowsEvent

func NewImportWorkflowsEvent(workspaceID, baseDir string, schemas []schema.WorkflowTypedSchema) *ImportWorkflowsEvent

func NewImportWorkflowsEventFromPayload

func NewImportWorkflowsEventFromPayload(data []byte) (*ImportWorkflowsEvent, error)

func (*ImportWorkflowsEvent) Delay

func (e *ImportWorkflowsEvent) Delay() time.Duration

func (*ImportWorkflowsEvent) EventType

func (e *ImportWorkflowsEvent) EventType() string

func (*ImportWorkflowsEvent) Payload

func (e *ImportWorkflowsEvent) Payload() []byte

type ImportWorkflowsHandler

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

func NewImportWorkflowsHandler

func NewImportWorkflowsHandler(repo Repository, readModel workflow.ReadModel, bus eventbus.EventBus, factory *Factory) *ImportWorkflowsHandler

func (*ImportWorkflowsHandler) Handle

type Param

type Param struct {
	ID            string
	Name          string
	WorkspaceID   string
	Description   string
	LatestVersion string
	CreateTime    time.Time
	UpdateTime    time.Time
	DeletedAt     time.Time
}

type Repository

type Repository interface {
	Save(context.Context, *Workflow) error
	Get(context.Context, string, string) (*Workflow, error)
	Delete(context.Context, *Workflow) error
	List(ctx context.Context, workspaceID string) ([]string, error)
}

Repository repository for workflow

type Service

type Service interface {
	Create(ctx context.Context, workspaceID string, workflowOption *WorkflowOption) (string, error)
	Delete(ctx context.Context, workspaceID string, workflowID string) error
	Update(ctx context.Context, workspaceID string, workflowID string, workflowOption *WorkflowOption) error
	AddVersion(ctx context.Context, workspaceID string, workflowOption *WorkflowOption, versionOption *VersionOption) (string, *WorkflowVersion, error)
	UpdateVersion(ctx context.Context, workspaceID string, workflowOption *WorkflowOption, versionOption *VersionUpdateOption) error
}

func NewService

func NewService(repo Repository, readModel workflow.ReadModel, bus eventbus.EventBus, factory *Factory, womtoolPath string) Service

type VersionOption

type VersionOption struct {
	Language         string
	MainWorkflowPath string
	Source           string
	Url              string
	Tag              string
	Token            string
}

type VersionUpdateOption

type VersionUpdateOption struct {
	Language         *string
	MainWorkflowPath *string
	Source           *string
	URL              *string
	Tag              *string
	Token            *string
}

type Workflow

type Workflow struct {
	// ID is the unique identifier of the workflow
	ID string
	// Name is the name of the workflow
	Name string
	// WorkspaceID is the ID of the workspace
	WorkspaceID string
	// Description is the description of the workflow
	Description string
	// LatestVersion is the latest version of the workflow
	LatestVersion string
	// Versions is the versions of the workflow
	Versions map[string]*WorkflowVersion
	// CreatedAt is the create time of workflow version
	CreatedAt time.Time
	// UpdatedAt is the update time of workflow version
	UpdatedAt time.Time
}

Workflow workflow entity

func (*Workflow) AddVersion

func (w *Workflow) AddVersion(param *VersionOption) (*WorkflowVersion, error)

func (*Workflow) UpdateDescription

func (w *Workflow) UpdateDescription(description string)

func (*Workflow) UpdateName

func (w *Workflow) UpdateName(name string)

type WorkflowEvent

type WorkflowEvent struct {
	WorkspaceID string
	WorkflowID  string
	Event       string
}

func NewWorkflowCreatedEvent

func NewWorkflowCreatedEvent(workspaceID, workflowID string) *WorkflowEvent

func NewWorkflowDeletedEvent

func NewWorkflowDeletedEvent(workspaceID, workflowID string) *WorkflowEvent

func NewWorkflowEventFromPayload

func NewWorkflowEventFromPayload(data []byte) (*WorkflowEvent, error)

func (*WorkflowEvent) Delay

func (e *WorkflowEvent) Delay() time.Duration

func (*WorkflowEvent) EventType

func (e *WorkflowEvent) EventType() string

func (*WorkflowEvent) Payload

func (e *WorkflowEvent) Payload() []byte

type WorkflowFile

type WorkflowFile struct {
	// ID is the unique identifier of the workflow file
	ID string
	// Path filename with path
	Path string
	// Content file content
	Content string
	// CreatedAt is the create time of workflow file
	CreatedAt time.Time
	// UpdatedAt is the update time of workflow file
	UpdatedAt time.Time
}

WorkflowFile workflow file

type WorkflowOption

type WorkflowOption struct {
	ID          string
	Name        string
	Description *string
}

func (*WorkflowOption) Validate

func (p *WorkflowOption) Validate() error

type WorkflowParam

type WorkflowParam struct {
	// Name param name
	Name string `json:"name"`
	// Type param type
	Type string `json:"type"`
	// Optional param is optional
	Optional bool `json:"optional"`
	// Default param default value
	Default string `json:"default,omitempty"`
}

type WorkflowVersion

type WorkflowVersion struct {
	// ID is the unique identifier of the workflow version
	ID string
	// Status is the status of the workflow version
	Status string
	// Message is the message of the workflow version
	Message string
	// Language is the language of the workflow version
	Language string
	// LanguageVersion is the language version of the workflow version
	LanguageVersion string
	// MainWorkflowPath is the main file of the workflow version
	MainWorkflowPath string
	// Inputs is the inputs of the workflow version
	Inputs []WorkflowParam
	// Outputs is the outputs of the workflow version
	Outputs []WorkflowParam
	// Graph is the graph of the workflow version
	Graph string
	// Metadata is the metadata of the workflow version
	Metadata map[string]string
	// Source is the source of the workflow version, eg. git,file
	Source string
	// Files is the files of the workflow
	Files map[string]*WorkflowFile
	// CreatedAt is the create time of workflow version
	CreatedAt time.Time
	// UpdatedAt is the update time of workflow version
	UpdatedAt time.Time
}

WorkflowVersion workflow version

func (*WorkflowVersion) AddFile

func (v *WorkflowVersion) AddFile(param *FileParam) (*WorkflowFile, error)

type WorkflowVersionAddedEvent

type WorkflowVersionAddedEvent struct {
	WorkspaceID       string
	WorkflowID        string
	WorkflowVersionID string
	GitRepo           string
	GitTag            string
	GitToken          string
	//used to import workflow version from file. its priority is over Git
	FilesBaseDir string
}

func NewWorkflowVersionAddedEvent

func NewWorkflowVersionAddedEvent(workspaceID, workflowID, versionID, repo, tag, token, filesBaseDir string) *WorkflowVersionAddedEvent

func NewWorkflowVersionAddedEventFromPayload

func NewWorkflowVersionAddedEventFromPayload(data []byte) (*WorkflowVersionAddedEvent, error)

func (*WorkflowVersionAddedEvent) Delay

func (*WorkflowVersionAddedEvent) EventType

func (e *WorkflowVersionAddedEvent) EventType() string

func (*WorkflowVersionAddedEvent) Payload

func (e *WorkflowVersionAddedEvent) Payload() []byte

type WorkflowVersionAddedHandler

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

func NewWorkflowVersionAddedHandler

func NewWorkflowVersionAddedHandler(repo Repository, womtoolPath string) *WorkflowVersionAddedHandler

func (*WorkflowVersionAddedHandler) Handle

type WorkspaceDeletedHandler

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

func NewWorkspaceDeletedHandler

func NewWorkspaceDeletedHandler(repo Repository) *WorkspaceDeletedHandler

func (*WorkspaceDeletedHandler) Handle

Jump to

Keyboard shortcuts

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