executor

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllExecutors

func GetAllExecutors() []string

func GetSchema

func GetSchema(name string) (interface{}, error)

GetSchema returns the config schema of the executor

func RegisterCapabilities added in v0.7.0

func RegisterCapabilities(name string, caps Capability)

RegisterCapabilities registers the capabilities for a named executor.

func RegisterExecutor

func RegisterExecutor(name string, factory NewExecutorFunc)

RegisterExecutor registers an executor new func under the given name.

func RegisterSchema

func RegisterSchema(name string, schema interface{})

RegisterSchema should be called by executor modules to register their config schema

Types

type APIClient added in v0.7.0

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

APIClient is an HTTP client for interacting with the server

func NewAPIClient added in v0.7.0

func NewAPIClient(baseURL, apiKey, userUUID string) *APIClient

func (*APIClient) GetFlowStatus added in v0.7.0

func (c *APIClient) GetFlowStatus(ctx context.Context, namespace, execID string) (FlowStatusResponse, error)

GetFlowStatus retrieves the execution status of a flow.

func (*APIClient) TriggerFlow added in v0.7.0

func (c *APIClient) TriggerFlow(ctx context.Context, namespace, flowID string, params map[string]any) (TriggerFlowResponse, error)

TriggerFlow triggers a flow execution via the HTTP API. Params are sent as form-encoded data

type Capability added in v0.7.0

type Capability uint64
const (
	RemoteExecution Capability = 1 << iota
	EnvironmentVariables
	FileTransfer
	StreamingOutput
)

func GetCapabilities added in v0.7.0

func GetCapabilities(name string) (Capability, error)

GetCapabilities returns the capabilities of a named executor.

type ExecutionContext

type ExecutionContext struct {
	// WithConfig is the yaml config passed to the executor
	WithConfig    []byte
	Inputs        map[string]any
	Stdout        io.Writer
	Stderr        io.Writer
	UserUUID      string
	NamespaceName string // human-readable namespace name for API calls
	APIKey        string // executor API key for authenticating with the server
	APIBaseURL    string // server base URL for API calls
}

type Executor

type Executor interface {
	Execute(ctx context.Context, execCtx ExecutionContext) (outputs map[string]string, err error)
	GetArtifactsDir() string
}

type FlowStatusResponse added in v0.7.0

type FlowStatusResponse struct {
	ID              string          `json:"id"`
	FlowName        string          `json:"flow_name"`
	FlowID          string          `json:"flow_id"`
	Status          string          `json:"status"`
	TriggerType     string          `json:"trigger_type"`
	Input           json.RawMessage `json:"input,omitempty"`
	TriggeredBy     string          `json:"triggered_by"`
	CurrentActionID string          `json:"current_action_id"`
	CreatedAt       string          `json:"created_at"`
	StartedAt       string          `json:"started_at"`
	CompletedAt     string          `json:"completed_at"`
	ScheduledAt     string          `json:"scheduled_at,omitempty"`
}

type LocalLinuxDriver

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

func (*LocalLinuxDriver) Close

func (d *LocalLinuxDriver) Close() error

func (*LocalLinuxDriver) CreateDir

func (d *LocalLinuxDriver) CreateDir(ctx context.Context, path string) error

func (*LocalLinuxDriver) CreateFile

func (d *LocalLinuxDriver) CreateFile(ctx context.Context, path string) error

func (*LocalLinuxDriver) Dial

func (d *LocalLinuxDriver) Dial(network, address string) (net.Conn, error)

func (*LocalLinuxDriver) Download

func (d *LocalLinuxDriver) Download(ctx context.Context, remotePath, localPath string) error

func (*LocalLinuxDriver) Exec

func (d *LocalLinuxDriver) Exec(ctx context.Context, command string, workingDir string, env []string, stdout, stderr io.Writer) error

func (*LocalLinuxDriver) GetWorkingDirectory

func (d *LocalLinuxDriver) GetWorkingDirectory() string

func (*LocalLinuxDriver) IsRemote

func (d *LocalLinuxDriver) IsRemote() bool

func (*LocalLinuxDriver) Join

func (d *LocalLinuxDriver) Join(parts ...string) string

func (*LocalLinuxDriver) ListFiles

func (d *LocalLinuxDriver) ListFiles(ctx context.Context, dirPath string) ([]string, error)

func (*LocalLinuxDriver) Remove

func (d *LocalLinuxDriver) Remove(ctx context.Context, path string) error

func (*LocalLinuxDriver) SetPermissions

func (d *LocalLinuxDriver) SetPermissions(ctx context.Context, path string, perms os.FileMode) error

func (*LocalLinuxDriver) TempDir

func (d *LocalLinuxDriver) TempDir() string

func (*LocalLinuxDriver) Upload

func (d *LocalLinuxDriver) Upload(ctx context.Context, localPath, remotePath string) error

type NewExecutorFunc

type NewExecutorFunc func(name string, driver NodeDriver, execID string) (Executor, error)

NewExecutorFunc defines the signature for a function that can create an executor.

func GetNewExecutorFunc

func GetNewExecutorFunc(name string) (NewExecutorFunc, error)

GetNewExecutorFunc is used to retrieve the NewExecutorFunc for an executor

type Node

type Node struct {
	Hostname       string
	Port           int
	Username       string
	Auth           NodeAuth
	ConnectionType string
	OSFamily       string
}

type NodeAuth

type NodeAuth struct {
	Method string
	Key    string
}

type NodeDriver

type NodeDriver interface {
	Upload(ctx context.Context, localPath, remotePath string) error
	Download(ctx context.Context, remotePath, localPath string) error
	CreateDir(ctx context.Context, path string) error
	CreateFile(ctx context.Context, path string) error
	GetWorkingDirectory() string
	Remove(ctx context.Context, path string) error
	SetPermissions(ctx context.Context, path string, perms os.FileMode) error
	Exec(ctx context.Context, command string, workingDir string, env []string, stdout, stderr io.Writer) error
	Dial(network, address string) (net.Conn, error)
	IsRemote() bool
	TempDir() string
	Join(parts ...string) string
	// ListFiles should only return top level files and no directories
	ListFiles(ctx context.Context, dirPath string) ([]string, error)
	Close() error
}

func NewLocalLinux

func NewLocalLinux() (NodeDriver, error)

func NewNodeDriver

func NewNodeDriver(ctx context.Context, node Node) (NodeDriver, error)

func NewRemoteLinux

func NewRemoteLinux(client remoteclient.RemoteClient) (NodeDriver, error)

type RemoteLinuxDriver

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

func (*RemoteLinuxDriver) Close

func (d *RemoteLinuxDriver) Close() error

func (*RemoteLinuxDriver) CreateDir

func (d *RemoteLinuxDriver) CreateDir(ctx context.Context, dirPath string) error

func (*RemoteLinuxDriver) CreateFile

func (d *RemoteLinuxDriver) CreateFile(ctx context.Context, filePath string) error

func (*RemoteLinuxDriver) Dial

func (d *RemoteLinuxDriver) Dial(network, address string) (net.Conn, error)

func (*RemoteLinuxDriver) Download

func (d *RemoteLinuxDriver) Download(ctx context.Context, remotePath, localPath string) error

func (*RemoteLinuxDriver) Exec

func (d *RemoteLinuxDriver) Exec(ctx context.Context, command string, workingDir string, env []string, stdout, stderr io.Writer) error

func (*RemoteLinuxDriver) GetWorkingDirectory

func (d *RemoteLinuxDriver) GetWorkingDirectory() string

func (*RemoteLinuxDriver) IsRemote

func (d *RemoteLinuxDriver) IsRemote() bool

func (*RemoteLinuxDriver) Join

func (d *RemoteLinuxDriver) Join(parts ...string) string

func (*RemoteLinuxDriver) ListFiles

func (d *RemoteLinuxDriver) ListFiles(ctx context.Context, dirPath string) ([]string, error)

func (*RemoteLinuxDriver) Remove

func (d *RemoteLinuxDriver) Remove(ctx context.Context, filePath string) error

func (*RemoteLinuxDriver) SetPermissions

func (d *RemoteLinuxDriver) SetPermissions(ctx context.Context, filePath string, perms os.FileMode) error

func (*RemoteLinuxDriver) TempDir

func (d *RemoteLinuxDriver) TempDir() string

func (*RemoteLinuxDriver) Upload

func (d *RemoteLinuxDriver) Upload(ctx context.Context, localPath, remotePath string) error

type TriggerFlowResponse added in v0.7.0

type TriggerFlowResponse struct {
	ExecID      string  `json:"exec_id"`
	ScheduledAt *string `json:"scheduled_at,omitempty"`
}

Jump to

Keyboard shortcuts

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