infra

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InfraConfig

type InfraConfig struct {
	Resources []ResourceConfig `json:"resources" yaml:"resources"`
}

InfraConfig represents the infrastructure block in a workflow config.

func ParseConfig

func ParseConfig(raw map[string]any) (*InfraConfig, error)

ParseConfig parses a raw map (from YAML) into an InfraConfig.

type ProvisionPlan

type ProvisionPlan struct {
	Create  []ResourceConfig `json:"create"`
	Update  []ResourceConfig `json:"update"`
	Delete  []ResourceConfig `json:"delete"`
	Current []ResourceConfig `json:"current"` // existing resources
}

ProvisionPlan describes what would be created, modified, or deleted.

type ProvisionedResource

type ProvisionedResource struct {
	Config    ResourceConfig `json:"config"`
	Status    string         `json:"status"` // "provisioned", "pending", "failed", "destroying"
	CreatedAt time.Time      `json:"created_at"`
	Error     string         `json:"error,omitempty"`
}

ProvisionedResource tracks a live provisioned resource.

type Provisioner

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

Provisioner manages infrastructure resources declared in workflow configs.

func NewProvisioner

func NewProvisioner(logger *slog.Logger) *Provisioner

NewProvisioner creates a new Provisioner.

func (*Provisioner) Apply

func (p *Provisioner) Apply(ctx context.Context, plan *ProvisionPlan) error

Apply executes a provision plan, creating, updating, and deleting resources. For now this performs mock/local provisioning (no real cloud resources).

func (*Provisioner) Destroy

func (p *Provisioner) Destroy(ctx context.Context, name string) error

Destroy tears down a single named resource.

func (*Provisioner) Plan

func (p *Provisioner) Plan(desired InfraConfig) (*ProvisionPlan, error)

Plan computes the diff between the current state and the desired InfraConfig.

func (*Provisioner) Status

func (p *Provisioner) Status() map[string]*ProvisionedResource

Status returns the current state of all provisioned resources.

type ResourceConfig

type ResourceConfig struct {
	Name     string         `json:"name" yaml:"name"`
	Type     string         `json:"type" yaml:"type"`         // "database", "cache", "queue", "storage"
	Provider string         `json:"provider" yaml:"provider"` // "sqlite", "postgres", "redis", "memory", "s3"
	Config   map[string]any `json:"config,omitempty" yaml:"config,omitempty"`
}

ResourceConfig describes a single infrastructure resource to provision.

Jump to

Keyboard shortcuts

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