resourcepack

package
v0.1.66 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package resourcepack plans and applies immutable, parameterized resource configuration packages. It deliberately has no provider or guest-transport dependency: those are supplied by the executor at the application boundary. Compile turns the supported package-manager package into the same inline shell or PowerShell package format used by ordinary manifests.

Index

Constants

View Source
const BuiltinPackageManager = "package-manager"

BuiltinPackageManager identifies the declarative package-manager package.

Variables

View Source
var (
	ErrRegistryRequired    = errors.New("resource package registry is required")
	ErrExecutorRequired    = errors.New("resource package executor is required")
	ErrUnsupportedMethod   = errors.New("resource package method is not supported")
	ErrInvalidManifest     = errors.New("resource package manifest is invalid")
	ErrInvalidPackageScope = errors.New("resource package scope is invalid for event")
)

Functions

This section is empty.

Types

type AppliedPackage

type AppliedPackage struct {
	Reference   string `json:"reference" yaml:"reference"`
	InputDigest string `json:"input_digest" yaml:"input_digest"`
}

type Engine

type Engine struct {
	Registry artifact.Registry
}

func (Engine) Apply

func (e Engine) Apply(ctx context.Context, plan Plan, executor Executor) ([]AppliedPackage, error)

func (Engine) Plan

func (e Engine) Plan(ctx context.Context, request Request) (Plan, error)

func (Engine) Validate added in v0.1.63

func (e Engine) Validate(ctx context.Context, refs []string, scope Scope, event Event) error

Validate resolves and validates a reference graph without producing an executable plan. Servers use it at startup for packages that live in a remote artifact store; the package registry abstraction keeps this check identical to the defensive planner validation performed later.

type Event

type Event string
const (
	EventProvision  Event = "provision"
	EventPromotion  Event = "promotion"
	EventAllocation Event = "allocation"
)

type Executor

type Executor interface {
	Execute(ctx context.Context, target Target, operation Operation) error
}

Executor is the only side-effecting dependency of Engine.Apply.

type Manifest

type Manifest struct {
	Name         string         `json:"name" yaml:"name"`
	Version      string         `json:"version" yaml:"version"`
	Builtin      string         `json:"builtin,omitempty" yaml:"builtin,omitempty"`
	Method       Method         `json:"method" yaml:"method"`
	Scopes       []Scope        `json:"scopes" yaml:"scopes"`
	Events       []Event        `json:"events" yaml:"events"`
	Dependencies []string       `json:"dependencies,omitempty" yaml:"dependencies,omitempty"`
	Defaults     map[string]any `json:"defaults,omitempty" yaml:"defaults,omitempty"`
	Inputs       map[string]any `json:"inputs,omitempty" yaml:"inputs,omitempty"`
}

Manifest is the typed content of a published resource package.

func Compile added in v0.1.61

func Compile(manifest Manifest) (Manifest, error)

Compile validates and normalizes a package manifest. Built-in packages are compiled into the existing immutable inline-script package format. Regular manifests are validated and returned unchanged.

func (Manifest) Validate

func (m Manifest) Validate() error

type Method

type Method string
const (
	MethodShell      Method = "shell"
	MethodPowerShell Method = "powershell"
	MethodDSC        Method = "dsc"
	MethodAnsible    Method = "ansible"
)

func (Method) Supported

func (m Method) Supported() bool

Supported reports whether Boxy currently has an executor for the method. DSC and Ansible remain valid manifest vocabulary for future implementations, but cannot be used by the current lifecycle executor.

type Operation

type Operation struct {
	Reference   string
	Method      Method
	Inputs      map[string]any
	Parameters  map[string]any
	InputDigest string
	Content     []byte
}

type Plan

type Plan struct {
	Target   Target
	Event    Event
	Packages []PlannedPackage
}

type PlannedPackage

type PlannedPackage struct {
	Reference   string
	Manifest    Manifest
	Inputs      map[string]any
	Parameters  map[string]any
	InputDigest string
	Content     []byte
}

type Request

type Request struct {
	Target     Target
	Event      Event
	Scope      Scope
	References []string
	Overrides  map[string]any
	Applied    []AppliedPackage
}

Request describes one lifecycle package application.

type Scope

type Scope string
const (
	ScopeResource   Scope = "resource"
	ScopeAllocation Scope = "allocation"
)

type Target

type Target struct {
	ResourceID string
	Provider   string
	AgentID    string
}

Target identifies the concrete resource receiving an operation. Provider and credential details remain opaque to this package and may be carried by the executor's adapter.

Jump to

Keyboard shortcuts

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