bundle

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidBundle         = errors.New("invalid bundle")
	ErrInvalidPackageJSON    = errors.New("invalid package.json")
	ErrBundleRuntimePrepared = errors.New("bundle runtime has already been prepared")
)

Functions

This section is empty.

Types

type AutomationAnnotation

type AutomationAnnotation struct {
}

type Bundle

type Bundle struct {
	// Path holds the path to the bundle root
	Path string

	// Main holds the path of the entrypoint script that
	// should be executed.
	Main string

	// Version holds the bundle version.
	Version string

	// License is the SPDX license identifier for the automation bundle.
	License string

	// ScriptContent holds the content of the main entrypoint file.
	ScriptContent string
	// contains filtered or unexported fields
}

func Discover

func Discover(root string) ([]*Bundle, error)

Discover discovers all automation bundles at a specified root.

func Load

func Load(path string) (*Bundle, error)

func (*Bundle) Error

func (bundle *Bundle) Error(msg string)

Error logs an error level message. It implements the console.Printer interface.

func (*Bundle) Log

func (bundle *Bundle) Log(msg string)

Log logs an info level message. It implements the console.Printer interface.

func (*Bundle) Prepare

func (bundle *Bundle) Prepare(cfg config.Config, broker automation.Broker, opts ...automation.EngineOption) error

func (*Bundle) ReadLogs

func (bundle *Bundle) ReadLogs(minLevel slog.Level) []Log

func (*Bundle) Runtime

func (bundle *Bundle) Runtime() *automation.Engine

Runtime returns the bundle's automation runtime. This returns nil until bundle.Prepare() is called once.

func (*Bundle) Warn

func (bundle *Bundle) Warn(msg string)

Warn logs an warn level message. It implements the console.Printer interface.

type Log

type Log struct {
	Time    time.Time
	Level   slog.Level
	Message string
}

type PackageJSON

type PackageJSON struct {
	// Main defines the entrypoint script
	Main string `json:"main"`

	// Version holds the version of the package
	Version string `json:"version"`

	// License describes the package license
	License string `json:"license"`

	// Automation holds additional information for the automation
	// engine.
	Automation AutomationAnnotation `json:"automation"`
}

Jump to

Keyboard shortcuts

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