Documentation
¶
Index ¶
- Constants
- Variables
- type Action
- type AuthMethod
- type ExecResults
- type Flow
- type FlowExecutionPayload
- type FlowLoaderFn
- type HookFn
- type Input
- type InputType
- type Metadata
- type Node
- type NodeAuth
- type Output
- type Scheduler
- func (s *Scheduler) CancelTask(ctx context.Context, execID string) error
- func (s *Scheduler) QueueTask(ctx context.Context, payload FlowExecutionPayload) (string, error)
- func (s *Scheduler) SetFlowLoader(fl FlowLoaderFn)
- func (s *Scheduler) SetSecretsProvider(sp SecretsProviderFn)
- func (s *Scheduler) Start(ctx context.Context) error
- func (s *Scheduler) Stop(ctx context.Context) error
- type SchedulerBuilder
- func (b *SchedulerBuilder) Build() (*Scheduler, error)
- func (b *SchedulerBuilder) WithCronSyncInterval(s time.Duration) *SchedulerBuilder
- func (b *SchedulerBuilder) WithFlowLoader(fl FlowLoaderFn) *SchedulerBuilder
- func (b *SchedulerBuilder) WithJobStore(jobStore storage.Storage) *SchedulerBuilder
- func (b *SchedulerBuilder) WithLogManager(lm streamlogger.LogManager) *SchedulerBuilder
- func (b *SchedulerBuilder) WithMetrics(m *metrics.Manager) *SchedulerBuilder
- func (b *SchedulerBuilder) WithSecretsProvider(sp SecretsProviderFn) *SchedulerBuilder
- func (b *SchedulerBuilder) WithStore(store repo.Store) *SchedulerBuilder
- func (b *SchedulerBuilder) WithWorkerCount(c int) *SchedulerBuilder
- type SchedulerDependencies
- type Scheduling
- type SecretsProviderFn
- type Task
- type TaskScheduler
- type TriggerType
- type Variable
Constants ¶
const ( TaskStatusPending = "pending" TaskStatusRunning = "running" TaskStatusCompleted = "completed" TaskStatusFailed = "failed" TaskStatusCancelled = "cancelled" )
Variables ¶
var (
ErrExecutionCancelled = errors.New("execution cancelled")
)
var (
ErrPendingApproval = errors.New("pending approval")
)
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
ID string `yaml:"id" validate:"required,alphanum_underscore"`
Name string `yaml:"name" validate:"required"`
Executor string `yaml:"executor" validate:"required,oneof=script docker"`
With map[string]any `yaml:"with" validate:"required"`
Approval bool `yaml:"approval"`
Variables []Variable `yaml:"variables"`
On []Node `yaml:"on"`
}
type AuthMethod ¶
type AuthMethod string
const ( AuthMethodPrivateKey AuthMethod = "private_key" AuthMethodPassword AuthMethod = "password" )
type ExecResults ¶
type ExecResults struct {
// contains filtered or unexported fields
}
type Flow ¶
type Flow struct {
Meta Metadata `yaml:"metadata" validate:"required"`
Inputs []Input `yaml:"inputs" validate:"required"`
Actions []Action `yaml:"actions" validate:"required"`
Outputs []Output `yaml:"outputs"`
Schedules []Scheduling `yaml:"scheduling"`
}
type FlowExecutionPayload ¶
type FlowLoaderFn ¶
type Input ¶
type Input struct {
Name string `yaml:"name" json:"name" validate:"required,alphanum_underscore"`
Type InputType `yaml:"type" json:"type" validate:"required,oneof=string int float bool slice_string slice_int slice_uint slice_float"`
Label string `yaml:"label" json:"label"`
Description string `yaml:"description" json:"description"`
Validation string `yaml:"validation" json:"validation"`
Required bool `yaml:"required" json:"required"`
Default string `yaml:"default" json:"default"`
}
type InputType ¶
type InputType string
const ( INPUT_TYPE_STRING InputType = "string" INPUT_TYPE_INT InputType = "int" INPUT_TYPE_FLOAT InputType = "float" INPUT_TYPE_BOOL InputType = "bool" INPUT_TYPE_SLICE_STRING InputType = "slice_string" INPUT_TYPE_SLICE_INT InputType = "slice_int" INPUT_TYPE_SLICE_UINT InputType = "slice_uint" INPUT_TYPE_SLICE_FLOAT InputType = "slice_float" )
type Node ¶
type Node struct {
ID string
Name string
Hostname string
Port int
Username string
OSFamily string
ConnectionType string
Tags []string
Auth NodeAuth
}
func (*Node) CheckConnectivity ¶
CheckConnectivity can be used to check if a remote node is accessible at the given IP:Port The default connection timeout is 5 seconds Non-nil error is returned if the node is not accessible
type NodeAuth ¶
type NodeAuth struct {
CredentialID string
Method AuthMethod
Key string
}
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler implements TaskScheduler
func (*Scheduler) CancelTask ¶
CancelTask cancels a running or pending execution
func (*Scheduler) SetFlowLoader ¶
func (s *Scheduler) SetFlowLoader(fl FlowLoaderFn)
SetFlowLoader allows updating flow loader after build
func (*Scheduler) SetSecretsProvider ¶
func (s *Scheduler) SetSecretsProvider(sp SecretsProviderFn)
SetSecretsProvider allows updating secrets provider after build
type SchedulerBuilder ¶
type SchedulerBuilder struct {
// contains filtered or unexported fields
}
SchedulerBuilder provides a fluent interface for building schedulers
func NewSchedulerBuilder ¶
func NewSchedulerBuilder(logger *slog.Logger) *SchedulerBuilder
NewSchedulerBuilder creates a new scheduler builder
func (*SchedulerBuilder) Build ¶
func (b *SchedulerBuilder) Build() (*Scheduler, error)
Build creates the scheduler instance
func (*SchedulerBuilder) WithCronSyncInterval ¶
func (b *SchedulerBuilder) WithCronSyncInterval(s time.Duration) *SchedulerBuilder
func (*SchedulerBuilder) WithFlowLoader ¶
func (b *SchedulerBuilder) WithFlowLoader(fl FlowLoaderFn) *SchedulerBuilder
WithFlowLoader sets the flow loader
func (*SchedulerBuilder) WithJobStore ¶
func (b *SchedulerBuilder) WithJobStore(jobStore storage.Storage) *SchedulerBuilder
WithJobStore sets the job store
func (*SchedulerBuilder) WithLogManager ¶
func (b *SchedulerBuilder) WithLogManager(lm streamlogger.LogManager) *SchedulerBuilder
WithLogManager sets the log manager
func (*SchedulerBuilder) WithMetrics ¶
func (b *SchedulerBuilder) WithMetrics(m *metrics.Manager) *SchedulerBuilder
func (*SchedulerBuilder) WithSecretsProvider ¶
func (b *SchedulerBuilder) WithSecretsProvider(sp SecretsProviderFn) *SchedulerBuilder
WithSecretsProvider sets the secrets provider
func (*SchedulerBuilder) WithStore ¶
func (b *SchedulerBuilder) WithStore(store repo.Store) *SchedulerBuilder
WithStore sets the store
func (*SchedulerBuilder) WithWorkerCount ¶
func (b *SchedulerBuilder) WithWorkerCount(c int) *SchedulerBuilder
type SchedulerDependencies ¶
type SchedulerDependencies struct {
OnBeforeAction HookFn
OnAfterAction HookFn
SecretsProvider SecretsProviderFn
FlowLoader FlowLoaderFn
LogManager interface{} // streamlogger.LogManager
}
SchedulerDependencies contains dependencies needed by the scheduler
type Scheduling ¶
type SecretsProviderFn ¶
type TaskScheduler ¶
type TriggerType ¶
type TriggerType string
const ( TriggerTypeManual TriggerType = "manual" TriggerTypeScheduled TriggerType = "scheduled" )