Help us shape the future of Go! Take the 2026 Go Developer Survey

infra

package
v0.87.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 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 MemoryProvider added in v0.3.39

type MemoryProvider struct{}

MemoryProvider is an in-memory resource provider for testing and local dev.

func (*MemoryProvider) Destroy added in v0.3.39

func (m *MemoryProvider) Destroy(_ context.Context, _ string) error

func (*MemoryProvider) Provision added in v0.3.39

func (m *MemoryProvider) Provision(_ context.Context, _ ResourceConfig) error

func (*MemoryProvider) Supports added in v0.3.39

func (m *MemoryProvider) Supports(_, _ string) bool

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) AddProvider added in v0.3.39

func (p *Provisioner) AddProvider(rp ResourceProvider)

AddProvider registers a ResourceProvider with the provisioner. Providers are tried in order; the first one that returns Supports==true is used.

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.

type ResourceProvider added in v0.3.39

type ResourceProvider interface {
	Provision(ctx context.Context, rc ResourceConfig) error
	Destroy(ctx context.Context, name string) error
	Supports(resourceType, provider string) bool
}

ResourceProvider provisions and destroys a specific resource type.

Jump to

Keyboard shortcuts

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