Documentation
¶
Index ¶
- type Applier
- type ChangeResult
- type EvalContext
- func (ctx *EvalContext) Evaluate(valueFrom config.ValueFrom) (string, error)
- func (ctx *EvalContext) GetVariable(name string) (string, bool)
- func (ctx *EvalContext) SetVariable(name, value string)
- func (ctx *EvalContext) WithDocument(doc *yaml.Node) *EvalContext
- func (ctx *EvalContext) WithFile(filePath string) *EvalContext
- func (ctx *EvalContext) WithVariables(vars map[string]string) *EvalContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Applier ¶
type Applier struct {
// contains filtered or unexported fields
}
Applier applies changes to configurations using the evaluation system.
func NewApplier ¶
NewApplier creates a new change applier for the given configuration.
func (*Applier) ApplyChanges ¶
func (a *Applier) ApplyChanges(filePath string, tags []string) ([]ChangeResult, error)
ApplyChanges applies all matching changes to a file context This is a simplified version - a full implementation would need to: - Parse YAML files - Apply fileSelector and keySelector matching - Modify the YAML documents - Write back the results .
func (*Applier) EvaluateChangeValue ¶
EvaluateChangeValue evaluates a change order's value in the context of a specific file.
func (*Applier) GetEvalContext ¶
func (a *Applier) GetEvalContext() *EvalContext
GetEvalContext returns the evaluation context for this applier.
type ChangeResult ¶
type ChangeResult struct {
Change config.ChangeOrder
FilePath string
Value string
KeyPath string
}
ChangeResult represents the result of applying a change.
func (ChangeResult) String ¶
func (cr ChangeResult) String() string
String returns a string representation of the change result.
type EvalContext ¶
type EvalContext struct {
// CurrentFile is the path to the file being processed
CurrentFile string
// CurrentDocument is the YAML document being processed (can be nil)
CurrentDocument *yaml.Node
// Variables is a scratchpad of variables in scope for argument resolution
Variables map[string]string
// Functions is the list of available functions
Functions []config.FunctionDefinition
// CloudHome is the base directory for resolving relative paths
CloudHome string
// ScriptsDir is the directory containing scripts
ScriptsDir string
// FilesDir is the directory containing files
FilesDir string
}
EvalContext provides the context for evaluating ValueFrom expressions. It contains the current file and document being processed, as well as a scratchpad of variables available for argument resolution.
func NewEvalContext ¶
func NewEvalContext(cloudHome, scriptsDir, filesDir string, functions []config.FunctionDefinition) *EvalContext
NewEvalContext creates a new evaluation context.
func (*EvalContext) Evaluate ¶
func (ctx *EvalContext) Evaluate(valueFrom config.ValueFrom) (string, error)
Evaluate evaluates a ValueFrom expression and returns the resulting value.
func (*EvalContext) GetVariable ¶
func (ctx *EvalContext) GetVariable(name string) (string, bool)
GetVariable retrieves a variable from the current context.
func (*EvalContext) SetVariable ¶
func (ctx *EvalContext) SetVariable(name, value string)
SetVariable sets a variable in the current context.
func (*EvalContext) WithDocument ¶
func (ctx *EvalContext) WithDocument(doc *yaml.Node) *EvalContext
WithDocument returns a new context with the specified document set.
func (*EvalContext) WithFile ¶
func (ctx *EvalContext) WithFile(filePath string) *EvalContext
WithFile returns a new context with the specified file set.
func (*EvalContext) WithVariables ¶
func (ctx *EvalContext) WithVariables(vars map[string]string) *EvalContext
WithVariables returns a new context with additional variables.