core

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action int

Action represents the type of action to be performed

const (
	ActionCreate Action = iota
	ActionUpdate
	ActionDelete
	ActionNoOp
)

func (Action) String

func (a Action) String() string

String returns the string representation of an action

type Change

type Change struct {
	Action   Action              `json:"action"`
	Resource types.Resource      `json:"resource"`
	Diff     *types.ResourceDiff `json:"diff,omitempty"`
	Error    error               `json:"error,omitempty"`
}

Change represents a planned change to a resource

type ChangeResult

type ChangeResult struct {
	Change    Change        `json:"change"`
	Success   bool          `json:"success"`
	Error     error         `json:"error,omitempty"`
	Duration  time.Duration `json:"duration"`
	StartTime time.Time     `json:"start_time"`
	EndTime   time.Time     `json:"end_time"`
}

ChangeResult represents the result of executing a single change

type ExecuteOptions

type ExecuteOptions struct {
	DryRun     bool `json:"dry_run"`
	Parallel   bool `json:"parallel"`
	FailFast   bool `json:"fail_fast"`
	MaxRetries int  `json:"max_retries"`
}

ExecuteWithOptions executes a plan with additional options

type ExecutionResult

type ExecutionResult struct {
	Changes []ChangeResult   `json:"changes"`
	Summary ExecutionSummary `json:"summary"`
}

ExecutionResult represents the result of executing a plan

func NewExecutionResult

func NewExecutionResult() *ExecutionResult

NewExecutionResult creates a new execution result

func (*ExecutionResult) AddChangeResult

func (er *ExecutionResult) AddChangeResult(result ChangeResult)

AddChangeResult adds a change result and updates the summary

func (*ExecutionResult) Finalize

func (er *ExecutionResult) Finalize()

Finalize finalizes the execution result by setting end time and duration

type ExecutionSummary

type ExecutionSummary struct {
	Total     int           `json:"total"`
	Succeeded int           `json:"succeeded"`
	Failed    int           `json:"failed"`
	Duration  time.Duration `json:"duration"`
	StartTime time.Time     `json:"start_time"`
	EndTime   time.Time     `json:"end_time"`
}

ExecutionSummary provides a summary of execution results

type Executor

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

Executor executes plans by applying changes

func NewExecutor

func NewExecutor(registry *types.ProviderRegistry) *Executor

NewExecutor creates a new executor with the given provider registry

func (*Executor) ExecutePlan

func (e *Executor) ExecutePlan(ctx context.Context, plan *Plan) (*ExecutionResult, error)

ExecutePlan executes all changes in a plan

func (*Executor) ExecutePlanWithOptions

func (e *Executor) ExecutePlanWithOptions(ctx context.Context, plan *Plan, options ExecuteOptions) (*ExecutionResult, error)

ExecutePlanWithOptions executes a plan with the given options

type Module

type Module struct {
	APIVersion string         `yaml:"apiVersion"`
	Kind       string         `yaml:"kind"`
	Metadata   ModuleMetadata `yaml:"metadata"`
	Spec       ModuleSpec     `yaml:"spec"`
}

Module represents a Chisel configuration module

func LoadModuleFromFile

func LoadModuleFromFile(filename string) (*Module, error)

LoadModuleFromFile loads a module from a YAML file

func (*Module) SaveToFile

func (m *Module) SaveToFile(filename string) error

SaveModuleToFile saves a module to a YAML file

func (*Module) Validate

func (m *Module) Validate() error

Validate validates the module configuration

type ModuleMetadata

type ModuleMetadata struct {
	Name        string            `yaml:"name"`
	Version     string            `yaml:"version"`
	Description string            `yaml:"description,omitempty"`
	Labels      map[string]string `yaml:"labels,omitempty"`
}

ModuleMetadata contains metadata about the module

type ModuleSpec

type ModuleSpec struct {
	Resources []types.Resource `yaml:"resources"`
}

ModuleSpec contains the module specification

type Plan

type Plan struct {
	Changes []Change `json:"changes"`
}

Plan represents a collection of planned changes

func NewPlan

func NewPlan() *Plan

NewPlan creates a new empty plan

func (*Plan) AddChange

func (p *Plan) AddChange(change Change)

AddChange adds a change to the plan

func (*Plan) HasChanges

func (p *Plan) HasChanges() bool

HasChanges returns true if the plan has any changes that need to be applied

func (*Plan) Summary

func (p *Plan) Summary() PlanSummary

Summary returns a summary of the plan

type PlanSummary

type PlanSummary struct {
	ToCreate  int `json:"to_create"`
	ToUpdate  int `json:"to_update"`
	ToDelete  int `json:"to_delete"`
	NoChanges int `json:"no_changes"`
	Errors    int `json:"errors"`
}

PlanSummary provides a summary of planned changes

type Planner

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

Planner creates execution plans for modules

func NewPlanner

func NewPlanner(registry *types.ProviderRegistry) *Planner

NewPlanner creates a new planner with the given provider registry

func (*Planner) CreatePlan

func (p *Planner) CreatePlan(module *Module) (*Plan, error)

CreatePlan creates an execution plan for the given module

Jump to

Keyboard shortcuts

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