Documentation
¶
Index ¶
- Variables
- type ArrayConfig
- type ArrayFlag
- type ArrayFlagHandler
- type ArrayMergeMode
- type ArrayOperation
- type ArrayOperationFlag
- type ArrayOperationFlagHandler
- func (h *ArrayOperationFlagHandler) CanHandle(flagName string) bool
- func (h *ArrayOperationFlagHandler) GetFlagType() FlagType
- func (h *ArrayOperationFlagHandler) MergeIntoConfiguration(flag ParsedFlag, config map[string]interface{}) error
- func (h *ArrayOperationFlagHandler) ParseFlag(flagName, flagValue string) (interface{}, error)
- type CLIIntegration
- func (c *CLIIntegration) FormatConflicts(conflicts []ConfigConflict, parsed *ParsedFlags) (string, error)
- func (c *CLIIntegration) FormatDiff(original, updated *Configuration, parsed *ParsedFlags) (string, error)
- func (c *CLIIntegration) FormatOutput(config *Configuration, parsed *ParsedFlags) (string, error)
- func (c *CLIIntegration) GetAllFlagHelp() (string, error)
- func (c *CLIIntegration) GetExamples() (string, error)
- func (c *CLIIntegration) GetFlagExamples(flagType FlagType) ([]string, error)
- func (c *CLIIntegration) GetFlagHelp(flagType FlagType) (string, error)
- func (c *CLIIntegration) ProcessFlags(args []string, configStruct interface{}, configMap map[string]interface{}) error
- func (c *CLIIntegration) ProcessFlagsWithValidation(args []string, configStruct interface{}, configMap map[string]interface{}, ...) error
- type ConfigConflict
- type ConfigError
- type ConfigFile
- type ConfigFileFlag
- type ConfigFileMergeType
- type ConfigMetadata
- type ConfigSource
- type ConfigValidationError
- type ConfigValidationWarning
- type Configuration
- type ConfigurationMerger
- type ConfigurationValidator
- type ConflictDetector
- type ConflictSource
- type DNSServerFlagHandler
- func (h *DNSServerFlagHandler) CanHandle(flagName string) bool
- func (h *DNSServerFlagHandler) GetFlagType() FlagType
- func (h *DNSServerFlagHandler) ParseArrayFlag(flagName, value string) (*ArrayConfig, error)
- func (h *DNSServerFlagHandler) ParseFlag(flagName, value string) (interface{}, error)
- func (h *DNSServerFlagHandler) SupportedTypes() []string
- func (h *DNSServerFlagHandler) ValidateArrayConfig(config *ArrayConfig) error
- type DefaultConfigurationMerger
- type DefaultConfigurationValidator
- type DefaultHelpSystem
- type DefaultOutputFormatter
- func (f *DefaultOutputFormatter) FormatConfiguration(config *Configuration, format OutputFormat, mode OutputMode) (string, error)
- func (f *DefaultOutputFormatter) FormatConflicts(conflicts []ConfigConflict, mode OutputMode) (string, error)
- func (f *DefaultOutputFormatter) FormatDiff(original, updated *Configuration, mode OutputMode) (string, error)
- type DefaultTemplateProcessor
- type DiffChange
- type DiffType
- type EncryptedConfigFlag
- type EncryptedConfigInfo
- type EnhancedFlagParser
- type EnhancedPathParser
- type EnhancedReflectionEngine
- func (e *EnhancedReflectionEngine) ExpandArray(obj interface{}, path string, index int) error
- func (e *EnhancedReflectionEngine) GetField(obj interface{}, path string) (interface{}, error)
- func (e *EnhancedReflectionEngine) SetField(obj interface{}, path string, value interface{}) error
- func (e *EnhancedReflectionEngine) SetFieldWithStructuredPath(obj interface{}, structuredPath *StructuredPath, value interface{}) error
- func (e *EnhancedReflectionEngine) SupportedSyntax() []string
- type ErrorBuilder
- type ErrorContext
- type ErrorReporter
- func (r *ErrorReporter) Add(err *ConfigError)
- func (r *ErrorReporter) AddError(err error, errorType ErrorType, path string)
- func (r *ErrorReporter) Clear()
- func (r *ErrorReporter) Error() string
- func (r *ErrorReporter) Errors() []*ConfigError
- func (r *ErrorReporter) GetErrorsByPath(path string) []*ConfigError
- func (r *ErrorReporter) GetErrorsByType(errorType ErrorType) []*ConfigError
- func (r *ErrorReporter) HasErrors() bool
- type ErrorTemplate
- type ErrorType
- type FileFlagHandler
- type FlagHandler
- type FlagParser
- type FlagType
- type HelpSystem
- type JSONFlag
- type JSONFlagHandler
- type MapFlag
- type MapFlagHandler
- type MapOperation
- type MaskSensitiveFlag
- type MergeStrategy
- type ObjectMergeMode
- type OutputFlagHandler
- type OutputFormat
- type OutputFormatFlag
- type OutputFormatter
- type OutputMode
- type OutputModeFlag
- type OutputOptions
- type ParsedFlag
- type ParsedFlags
- type PathParser
- type PathPart
- type ReflectionEngine
- type SOPSConfigFlag
- type SOPSIntegration
- func (s *SOPSIntegration) CreateSOPSConfig(configPath, ageKeyPath string) error
- func (s *SOPSIntegration) EncryptConfigFile(configPath string, config map[string]interface{}) error
- func (s *SOPSIntegration) GetEncryptedConfigInfo(configPath string) (*EncryptedConfigInfo, error)
- func (s *SOPSIntegration) GetSOPSStatus() SOPSStatus
- func (s *SOPSIntegration) LoadEncryptedConfig(configPath string) (map[string]interface{}, error)
- func (s *SOPSIntegration) MaskSensitiveConfigData(config map[string]interface{}) map[string]interface{}
- func (s *SOPSIntegration) ValidateSOPSConfig(sopsConfigPath string) error
- type SOPSStatus
- type SSHKeyFlagHandler
- func (h *SSHKeyFlagHandler) CanHandle(flagName string) bool
- func (h *SSHKeyFlagHandler) GetFlagType() FlagType
- func (h *SSHKeyFlagHandler) ParseArrayFlag(flagName, value string) (*ArrayConfig, error)
- func (h *SSHKeyFlagHandler) ParseFlag(flagName, value string) (interface{}, error)
- func (h *SSHKeyFlagHandler) SupportedTypes() []string
- func (h *SSHKeyFlagHandler) ValidateArrayConfig(config *ArrayConfig) error
- type SecureTemplateProcessor
- func (p *SecureTemplateProcessor) AddSecureVariable(key, value string, isFile bool) error
- func (p *SecureTemplateProcessor) ClearSecureVariables()
- func (p *SecureTemplateProcessor) GetAllSecureVariables() map[string]string
- func (p *SecureTemplateProcessor) GetSecureVariable(key string) (string, bool)
- func (p *SecureTemplateProcessor) GetSecureVariableCount() int
- func (p *SecureTemplateProcessor) HasSecureVariable(key string) bool
- func (p *SecureTemplateProcessor) LoadSecureVariableFromFile(key, filePath string) error
- func (p *SecureTemplateProcessor) LoadSecureVariablesFromEnv(prefix string) error
- func (p *SecureTemplateProcessor) MaskSecureVariablesInString(content string) string
- func (p *SecureTemplateProcessor) ProcessSecureTemplates(content string) (string, error)
- func (p *SecureTemplateProcessor) SetWarningsEnabled(enabled bool)
- func (p *SecureTemplateProcessor) ValidateSecureVariables(content string) []string
- type SecureTemplateVarFlag
- type SecurityFlag
- type SecurityFlagHandler
- func (h *SecurityFlagHandler) CanHandle(flagName string) bool
- func (h *SecurityFlagHandler) GetFlagType() FlagType
- func (h *SecurityFlagHandler) MaskFlagValue(flagName, value string) string
- func (h *SecurityFlagHandler) ParseFlag(flagName, value string) (interface{}, error)
- func (h *SecurityFlagHandler) ValidateSecurityConfiguration(config map[string]interface{}) []SecurityWarning
- type SecurityFlagType
- type SecurityWarning
- type SecurityWarningsFlag
- type ServerPoolConfig
- type ServerPoolFlagHandler
- func (h *ServerPoolFlagHandler) CanHandle(flagName string) bool
- func (h *ServerPoolFlagHandler) GetFlagType() FlagType
- func (h *ServerPoolFlagHandler) ParseArrayFlag(flagName, value string) (*ArrayConfig, error)
- func (h *ServerPoolFlagHandler) ParseFlag(flagName, value string) (interface{}, error)
- func (h *ServerPoolFlagHandler) SupportedTypes() []string
- func (h *ServerPoolFlagHandler) ToServerPoolConfig(fields map[string]interface{}) (*ServerPoolConfig, error)
- func (h *ServerPoolFlagHandler) ValidateArrayConfig(config *ArrayConfig) error
- type SourceType
- type StructuredPath
- type SubnetFlagHandler
- func (h *SubnetFlagHandler) CanHandle(flagName string) bool
- func (h *SubnetFlagHandler) GetFlagType() FlagType
- func (h *SubnetFlagHandler) ParseArrayFlag(flagName, value string) (*ArrayConfig, error)
- func (h *SubnetFlagHandler) ParseFlag(flagName, value string) (interface{}, error)
- func (h *SubnetFlagHandler) SupportedTypes() []string
- func (h *SubnetFlagHandler) ValidateArrayConfig(config *ArrayConfig) error
- type TemplateContext
- type TemplateFlagHandler
- type TemplateProcessor
- type TemplateVariable
- type ValidationMode
- type ValidationResult
- type ValidationSummary
- type YAMLFlag
- type YAMLFlagHandler
Constants ¶
This section is empty.
Variables ¶
var ( SyntaxError = NewErrorBuilder(ErrorTypeSyntax) ValidationError = NewErrorBuilder(ErrorTypeValidation) TypeError = NewErrorBuilder(ErrorTypeType) ConflictError = NewErrorBuilder(ErrorTypeConflict) TemplateError = NewErrorBuilder(ErrorTypeTemplate) PathError = NewErrorBuilder(ErrorTypePath) PermissionError = NewErrorBuilder(ErrorTypePermission) )
Predefined error builders for common error types
var ErrorTemplates = map[string]ErrorTemplate{ "invalid_array_index": { Message: "Array index %d is out of bounds for array of length %d", Suggestions: []string{ "Use --array-append to add new elements", "Check that the array has been initialized", "Array indices start at 0", }, Examples: []string{ "--field[0].value=data", "--array-append field=newvalue", }, }, "invalid_json_syntax": { Message: "Invalid JSON syntax in flag '%s': %s", Suggestions: []string{ "Check that all quotes are properly escaped", "Ensure JSON objects use double quotes for keys", "Validate JSON syntax using a JSON validator", }, Examples: []string{ `--json-set 'path={"key": "value"}'`, `--json-set 'config={"enabled": true, "count": 5}'`, }, }, "template_variable_undefined": { Message: "Template variable '%s' is undefined in path '%s'", Suggestions: []string{ "Define the variable with --template-var %s=value", "Check for typos in the variable name", "Use {{.VAR}} syntax for template variables", }, Examples: []string{ "--template-var NAME=myapp", "--template-var ENV=production", }, }, "conflicting_flags": { Message: "Conflicting values for path '%s': flag '%s' sets '%v', flag '%s' sets '%v'", Suggestions: []string{ "Later flags take precedence over earlier ones", "Remove duplicate flag definitions", "Use a single flag to set the value", }, Examples: []string{ "Remove one of the conflicting flags", "Combine values using JSON or YAML flags", }, }, "invalid_field_name": { Message: "Field '%s' not found in struct '%s'", Suggestions: []string{ "Check the field name spelling", "Use the YAML tag name if different from field name", "Check the configuration schema documentation", }, Examples: []string{ "--opencenter.meta.organization=myorg", "--opencenter.cluster.kubernetes.version=1.31.4", }, }, "type_conversion_failed": { Message: "Cannot convert value '%s' to type %s", Suggestions: []string{ "Check the expected data type for this field", "Use proper format for the target type", "For boolean fields, use 'true' or 'false'", "For numeric fields, use valid number format", }, Examples: []string{ "--field.enabled=true", "--field.count=42", "--field.name=string-value", }, }, "path_syntax_error": { Message: "Invalid path syntax: %s", Suggestions: []string{ "Use dot notation for nested fields: field.subfield", "Use bracket notation for arrays: field[0].subfield", "Field names must start with letter or underscore", "Array indices must be non-negative integers", }, Examples: []string{ "--opencenter.meta.organization=myorg", "--items[0].name=first-item", "--servers.0.hostname=server1", }, }, }
Error message templates with suggestions
Functions ¶
This section is empty.
Types ¶
type ArrayConfig ¶
ArrayConfig represents parsed array configuration
type ArrayFlag ¶
type ArrayFlag struct {
Type string
Config *ArrayConfig
}
ArrayFlag represents a parsed array flag (for dedicated handlers)
type ArrayFlagHandler ¶
type ArrayFlagHandler interface {
FlagHandler
// ParseArrayFlag converts string to array configuration
ParseArrayFlag(flagName, value string) (*ArrayConfig, error)
}
ArrayFlagHandler is a specialized handler for array-type flags
type ArrayMergeMode ¶
type ArrayMergeMode string
ArrayMergeMode defines how arrays are merged
const ( ArrayMergeAppend ArrayMergeMode = "append" // Append arrays together ArrayMergeReplace ArrayMergeMode = "replace" // Replace with higher precedence array ArrayMergeMerge ArrayMergeMode = "merge" // Merge arrays by index )
type ArrayOperation ¶
type ArrayOperation string
ArrayOperation represents different array operations
const ( ArrayOpAppend ArrayOperation = "append" ArrayOpInsert ArrayOperation = "insert" ArrayOpRemove ArrayOperation = "remove" )
type ArrayOperationFlag ¶
type ArrayOperationFlag struct {
Operation ArrayOperation
Path string
Index int // -1 for append/remove operations
Value interface{}
}
ArrayOperationFlag represents an array operation flag
func (*ArrayOperationFlag) GetPath ¶
func (f *ArrayOperationFlag) GetPath() string
GetPath returns the configuration path this flag affects
type ArrayOperationFlagHandler ¶
type ArrayOperationFlagHandler struct{}
ArrayOperationFlagHandler handles advanced array operations
func NewArrayFlagHandler ¶
func NewArrayFlagHandler() *ArrayOperationFlagHandler
NewArrayFlagHandler creates a new array flag handler
func (*ArrayOperationFlagHandler) CanHandle ¶
func (h *ArrayOperationFlagHandler) CanHandle(flagName string) bool
CanHandle returns true if this handler can process the given flag
func (*ArrayOperationFlagHandler) GetFlagType ¶
func (h *ArrayOperationFlagHandler) GetFlagType() FlagType
GetFlagType returns the type of flags this handler processes
func (*ArrayOperationFlagHandler) MergeIntoConfiguration ¶
func (h *ArrayOperationFlagHandler) MergeIntoConfiguration(flag ParsedFlag, config map[string]interface{}) error
MergeIntoConfiguration applies the array operation to the configuration
func (*ArrayOperationFlagHandler) ParseFlag ¶
func (h *ArrayOperationFlagHandler) ParseFlag(flagName, flagValue string) (interface{}, error)
ParseFlag parses array operation flags
type CLIIntegration ¶
type CLIIntegration struct {
// contains filtered or unexported fields
}
CLIIntegration provides integration between the enhanced flag parser and existing CLI commands
func NewCLIIntegration ¶
func NewCLIIntegration() (*CLIIntegration, error)
NewCLIIntegration creates a new CLI integration with registered handlers
func (*CLIIntegration) FormatConflicts ¶
func (c *CLIIntegration) FormatConflicts(conflicts []ConfigConflict, parsed *ParsedFlags) (string, error)
FormatConflicts formats conflict information
func (*CLIIntegration) FormatDiff ¶
func (c *CLIIntegration) FormatDiff(original, updated *Configuration, parsed *ParsedFlags) (string, error)
FormatDiff formats a diff between two configurations
func (*CLIIntegration) FormatOutput ¶
func (c *CLIIntegration) FormatOutput(config *Configuration, parsed *ParsedFlags) (string, error)
FormatOutput formats the configuration output based on parsed output flags
func (*CLIIntegration) GetAllFlagHelp ¶
func (c *CLIIntegration) GetAllFlagHelp() (string, error)
GetAllFlagHelp returns help information for all CLI flags
func (*CLIIntegration) GetExamples ¶
func (c *CLIIntegration) GetExamples() (string, error)
GetExamples returns common usage examples
func (*CLIIntegration) GetFlagExamples ¶
func (c *CLIIntegration) GetFlagExamples(flagType FlagType) ([]string, error)
GetFlagExamples returns examples for a specific flag type
func (*CLIIntegration) GetFlagHelp ¶
func (c *CLIIntegration) GetFlagHelp(flagType FlagType) (string, error)
GetFlagHelp returns help information for CLI flags
func (*CLIIntegration) ProcessFlags ¶
func (c *CLIIntegration) ProcessFlags(args []string, configStruct interface{}, configMap map[string]interface{}) error
ProcessFlags processes command line arguments and applies them to configuration
func (*CLIIntegration) ProcessFlagsWithValidation ¶
func (c *CLIIntegration) ProcessFlagsWithValidation(args []string, configStruct interface{}, configMap map[string]interface{}, validationMode ValidationMode) error
ProcessFlagsWithValidation processes command line arguments with validation mode
type ConfigConflict ¶
type ConfigConflict struct {
Path string `json:"path"`
Sources []ConflictSource `json:"sources"`
Resolution string `json:"resolution"`
ResolvedValue interface{} `json:"resolved_value"`
}
ConfigConflict represents a conflict between configuration sources
type ConfigError ¶
type ConfigError struct {
Type ErrorType `json:"type"`
Code string `json:"code"`
Message string `json:"message"`
Path string `json:"path,omitempty"`
Suggestions []string `json:"suggestions,omitempty"`
Context *ErrorContext `json:"context,omitempty"`
Cause error `json:"-"` // Original error that caused this
}
ConfigError represents a configuration-related error with detailed context
func CreateTemplatedError ¶
func CreateTemplatedError(templateKey string, errorType ErrorType, path string, args ...interface{}) *ConfigError
CreateTemplatedError creates a ConfigError using a predefined template
func (*ConfigError) Error ¶
func (e *ConfigError) Error() string
Error implements the error interface
func (*ConfigError) Unwrap ¶
func (e *ConfigError) Unwrap() error
Unwrap returns the underlying error
func (*ConfigError) WithCause ¶
func (e *ConfigError) WithCause(cause error) *ConfigError
WithCause sets the underlying cause of the error
func (*ConfigError) WithContext ¶
func (e *ConfigError) WithContext(context *ErrorContext) *ConfigError
WithContext adds context information to the error
func (*ConfigError) WithSuggestions ¶
func (e *ConfigError) WithSuggestions(suggestions ...string) *ConfigError
WithSuggestions adds suggestions to the error
type ConfigFile ¶
ConfigFile represents a configuration file to be loaded
type ConfigFileFlag ¶
type ConfigFileFlag struct {
Path string
Type string
Priority int
MergeType ConfigFileMergeType
}
ConfigFileFlag represents a parsed configuration file flag with merge information
func (*ConfigFileFlag) GetPath ¶
func (f *ConfigFileFlag) GetPath() string
GetPath returns the configuration path this flag affects (root path for file flags)
func (*ConfigFileFlag) MergeIntoConfiguration ¶
func (f *ConfigFileFlag) MergeIntoConfiguration(flag ParsedFlag, config map[string]interface{}) error
MergeIntoConfiguration applies this flag to the configuration
type ConfigFileMergeType ¶
type ConfigFileMergeType string
ConfigFileMergeType defines how configuration files should be merged
const ( ConfigFileMergeBase ConfigFileMergeType = "base" // Base configuration (lowest priority) ConfigFileMergeOverride ConfigFileMergeType = "override" // Override configuration (higher priority) ConfigFileMergeStack ConfigFileMergeType = "stack" // Stack configuration (priority by order) )
type ConfigMetadata ¶
type ConfigMetadata struct {
Sources []ConfigSource `json:"sources"`
ProcessedAt time.Time `json:"processed_at"`
Version string `json:"version"`
Checksum string `json:"checksum"`
}
ConfigMetadata tracks configuration source and processing info
type ConfigSource ¶
type ConfigSource struct {
Type SourceType `json:"type"`
Path string `json:"path"`
Priority int `json:"priority"`
}
ConfigSource tracks where configuration came from
type ConfigValidationError ¶
type ConfigValidationError struct {
Type string `json:"type"`
Path string `json:"path,omitempty"`
Message string `json:"message"`
Suggestion string `json:"suggestion,omitempty"`
Example string `json:"example,omitempty"`
}
ConfigValidationError represents a validation error
type ConfigValidationWarning ¶
type ConfigValidationWarning struct {
Type string `json:"type"`
Path string `json:"path,omitempty"`
Message string `json:"message"`
}
ConfigValidationWarning represents a validation warning
type Configuration ¶
type Configuration struct {
Data map[string]interface{} `json:"data"`
Sources []ConfigSource `json:"sources"`
Metadata ConfigMetadata `json:"metadata"`
}
Configuration represents a complete configuration
type ConfigurationMerger ¶
type ConfigurationMerger interface {
// MergeConfigurations combines configs with precedence rules
MergeConfigurations(configs []Configuration) (*Configuration, error)
// SetMergeStrategy defines how conflicts are resolved
SetMergeStrategy(strategy MergeStrategy) error
// AddConfigSource adds a new configuration source
AddConfigSource(source ConfigSource) error
}
ConfigurationMerger combines multiple configuration sources with precedence rules
type ConfigurationValidator ¶
type ConfigurationValidator interface {
// ValidateConfiguration validates a complete configuration
ValidateConfiguration(config *Configuration) (*ValidationResult, error)
// ValidateFlags validates parsed flags before applying them
ValidateFlags(flags *ParsedFlags) (*ValidationResult, error)
// ValidateFlag validates a single flag
ValidateFlag(flagName, value string) error
}
ConfigurationValidator validates configuration and flags
type ConflictDetector ¶
type ConflictDetector struct {
// contains filtered or unexported fields
}
ConflictDetector detects and reports configuration conflicts
func NewConflictDetector ¶
func NewConflictDetector() *ConflictDetector
NewConflictDetector creates a new conflict detector
func (*ConflictDetector) DetectConflicts ¶
func (d *ConflictDetector) DetectConflicts(configs []Configuration) ([]ConfigConflict, error)
DetectConflicts detects conflicts between configurations
func (*ConflictDetector) GetConflictReport ¶
func (d *ConflictDetector) GetConflictReport() string
GetConflictReport generates a human-readable conflict report
func (*ConflictDetector) GetConflicts ¶
func (d *ConflictDetector) GetConflicts() []ConfigConflict
GetConflicts returns all detected conflicts
func (*ConflictDetector) HasConflicts ¶
func (d *ConflictDetector) HasConflicts() bool
HasConflicts returns true if any conflicts were detected
type ConflictSource ¶
type ConflictSource struct {
Type SourceType `json:"type"`
Path string `json:"path"`
Value interface{} `json:"value"`
Priority int `json:"priority"`
}
ConflictSource represents a source involved in a conflict
type DNSServerFlagHandler ¶
type DNSServerFlagHandler struct{}
DNSServerFlagHandler handles --dns-server flags
func NewDNSServerFlagHandler ¶
func NewDNSServerFlagHandler() *DNSServerFlagHandler
NewDNSServerFlagHandler creates a new DNS server flag handler
func (*DNSServerFlagHandler) CanHandle ¶
func (h *DNSServerFlagHandler) CanHandle(flagName string) bool
CanHandle returns true if this handler can process the given flag
func (*DNSServerFlagHandler) GetFlagType ¶
func (h *DNSServerFlagHandler) GetFlagType() FlagType
GetFlagType returns the type of flags this handler processes
func (*DNSServerFlagHandler) ParseArrayFlag ¶
func (h *DNSServerFlagHandler) ParseArrayFlag(flagName, value string) (*ArrayConfig, error)
ParseArrayFlag converts string to array configuration
func (*DNSServerFlagHandler) ParseFlag ¶
func (h *DNSServerFlagHandler) ParseFlag(flagName, value string) (interface{}, error)
ParseFlag processes a single flag and returns the parsed result
func (*DNSServerFlagHandler) SupportedTypes ¶
func (h *DNSServerFlagHandler) SupportedTypes() []string
SupportedTypes returns array types this handler supports
func (*DNSServerFlagHandler) ValidateArrayConfig ¶
func (h *DNSServerFlagHandler) ValidateArrayConfig(config *ArrayConfig) error
ValidateArrayConfig ensures array configuration is valid
type DefaultConfigurationMerger ¶
type DefaultConfigurationMerger struct {
// contains filtered or unexported fields
}
DefaultConfigurationMerger implements the ConfigurationMerger interface
func NewDefaultConfigurationMerger ¶
func NewDefaultConfigurationMerger() *DefaultConfigurationMerger
NewDefaultConfigurationMerger creates a new configuration merger with default settings
func (*DefaultConfigurationMerger) AddConfigSource ¶
func (m *DefaultConfigurationMerger) AddConfigSource(source ConfigSource) error
AddConfigSource adds a new configuration source
func (*DefaultConfigurationMerger) MergeConfigurations ¶
func (m *DefaultConfigurationMerger) MergeConfigurations(configs []Configuration) (*Configuration, error)
MergeConfigurations combines configs with precedence rules
func (*DefaultConfigurationMerger) SetMergeStrategy ¶
func (m *DefaultConfigurationMerger) SetMergeStrategy(strategy MergeStrategy) error
SetMergeStrategy defines how conflicts are resolved
type DefaultConfigurationValidator ¶
type DefaultConfigurationValidator struct{}
DefaultConfigurationValidator implements the ConfigurationValidator interface
func NewDefaultConfigurationValidator ¶
func NewDefaultConfigurationValidator() *DefaultConfigurationValidator
NewDefaultConfigurationValidator creates a new configuration validator
func (*DefaultConfigurationValidator) ValidateConfiguration ¶
func (v *DefaultConfigurationValidator) ValidateConfiguration(config *Configuration) (*ValidationResult, error)
ValidateConfiguration validates a complete configuration
func (*DefaultConfigurationValidator) ValidateFlag ¶
func (v *DefaultConfigurationValidator) ValidateFlag(flagName, value string) error
ValidateFlag validates a single flag
func (*DefaultConfigurationValidator) ValidateFlags ¶
func (v *DefaultConfigurationValidator) ValidateFlags(flags *ParsedFlags) (*ValidationResult, error)
ValidateFlags validates parsed flags before applying them
type DefaultHelpSystem ¶
type DefaultHelpSystem struct{}
DefaultHelpSystem implements the HelpSystem interface
func NewDefaultHelpSystem ¶
func NewDefaultHelpSystem() *DefaultHelpSystem
NewDefaultHelpSystem creates a new help system
func (*DefaultHelpSystem) GetAllFlagHelp ¶
func (h *DefaultHelpSystem) GetAllFlagHelp() (string, error)
GetAllFlagHelp returns help text for all flag types
func (*DefaultHelpSystem) GetExamples ¶
func (h *DefaultHelpSystem) GetExamples() (string, error)
GetExamples returns common usage examples
func (*DefaultHelpSystem) GetFlagExamples ¶
func (h *DefaultHelpSystem) GetFlagExamples(flagType FlagType) ([]string, error)
GetFlagExamples returns examples for a specific flag type
func (*DefaultHelpSystem) GetFlagHelp ¶
func (h *DefaultHelpSystem) GetFlagHelp(flagType FlagType) (string, error)
GetFlagHelp returns help text for a specific flag type
type DefaultOutputFormatter ¶
type DefaultOutputFormatter struct{}
DefaultOutputFormatter implements the OutputFormatter interface
func NewDefaultOutputFormatter ¶
func NewDefaultOutputFormatter() *DefaultOutputFormatter
NewDefaultOutputFormatter creates a new default output formatter
func (*DefaultOutputFormatter) FormatConfiguration ¶
func (f *DefaultOutputFormatter) FormatConfiguration(config *Configuration, format OutputFormat, mode OutputMode) (string, error)
FormatConfiguration formats a configuration in the specified format
func (*DefaultOutputFormatter) FormatConflicts ¶
func (f *DefaultOutputFormatter) FormatConflicts(conflicts []ConfigConflict, mode OutputMode) (string, error)
FormatConflicts formats conflict information
func (*DefaultOutputFormatter) FormatDiff ¶
func (f *DefaultOutputFormatter) FormatDiff(original, updated *Configuration, mode OutputMode) (string, error)
FormatDiff formats a diff between two configurations
type DefaultTemplateProcessor ¶
type DefaultTemplateProcessor struct {
// contains filtered or unexported fields
}
DefaultTemplateProcessor implements the TemplateProcessor interface
func NewDefaultTemplateProcessor ¶
func NewDefaultTemplateProcessor() *DefaultTemplateProcessor
NewDefaultTemplateProcessor creates a new template processor with built-in functions
func (*DefaultTemplateProcessor) ProcessTemplates ¶
func (p *DefaultTemplateProcessor) ProcessTemplates(config *Configuration, vars map[string]string) error
ProcessTemplates substitutes variables in configuration
func (*DefaultTemplateProcessor) RegisterFunction ¶
func (p *DefaultTemplateProcessor) RegisterFunction(name string, fn interface{}) error
RegisterFunction adds custom template functions
func (*DefaultTemplateProcessor) ValidateTemplates ¶
func (p *DefaultTemplateProcessor) ValidateTemplates(config *Configuration) ([]string, error)
ValidateTemplates checks for undefined variables
type DiffChange ¶
DiffChange represents a single change in a diff
type EncryptedConfigFlag ¶
type EncryptedConfigFlag struct {
ConfigPath string
}
EncryptedConfigFlag represents an encrypted configuration file flag
func (*EncryptedConfigFlag) GetSecurityType ¶
func (f *EncryptedConfigFlag) GetSecurityType() SecurityFlagType
type EncryptedConfigInfo ¶
type EncryptedConfigInfo struct {
Path string `json:"path"`
Encrypted bool `json:"encrypted"`
KeyType string `json:"key_type"`
KeyCount int `json:"key_count"`
LastModified string `json:"last_modified"`
Metadata map[string]string `json:"metadata"`
}
EncryptedConfigInfo represents information about an encrypted configuration file
type EnhancedFlagParser ¶
type EnhancedFlagParser struct {
// contains filtered or unexported fields
}
EnhancedFlagParser implements the FlagParser interface
func NewEnhancedFlagParser ¶
func NewEnhancedFlagParser() *EnhancedFlagParser
NewEnhancedFlagParser creates a new enhanced flag parser
func (*EnhancedFlagParser) ParseFlags ¶
func (p *EnhancedFlagParser) ParseFlags(args []string) (*ParsedFlags, error)
ParseFlags processes all command-line flags
func (*EnhancedFlagParser) RegisterHandler ¶
func (p *EnhancedFlagParser) RegisterHandler(pattern string, handler FlagHandler) error
RegisterHandler adds a new flag type handler
func (*EnhancedFlagParser) SetPrecedence ¶
func (p *EnhancedFlagParser) SetPrecedence(order []FlagType) error
SetPrecedence defines flag type precedence order
type EnhancedPathParser ¶
type EnhancedPathParser struct {
// contains filtered or unexported fields
}
EnhancedPathParser implements PathParser with support for both bracket and dot syntax
func NewEnhancedPathParser ¶
func NewEnhancedPathParser() *EnhancedPathParser
NewEnhancedPathParser creates a new enhanced path parser
func (*EnhancedPathParser) ParsePath ¶
func (p *EnhancedPathParser) ParsePath(path string) (*StructuredPath, error)
ParsePath converts path string to structured path
func (*EnhancedPathParser) SupportedSyntax ¶
func (p *EnhancedPathParser) SupportedSyntax() []string
SupportedSyntax returns supported path syntax patterns
func (*EnhancedPathParser) ValidatePath ¶
func (p *EnhancedPathParser) ValidatePath(path string) error
ValidatePath ensures path syntax is correct
type EnhancedReflectionEngine ¶
type EnhancedReflectionEngine struct {
// contains filtered or unexported fields
}
EnhancedReflectionEngine implements ReflectionEngine with support for all Go types
func NewEnhancedReflectionEngine ¶
func NewEnhancedReflectionEngine() *EnhancedReflectionEngine
NewEnhancedReflectionEngine creates a new enhanced reflection engine
func (*EnhancedReflectionEngine) ExpandArray ¶
func (e *EnhancedReflectionEngine) ExpandArray(obj interface{}, path string, index int) error
ExpandArray automatically expands arrays to accommodate indices
func (*EnhancedReflectionEngine) GetField ¶
func (e *EnhancedReflectionEngine) GetField(obj interface{}, path string) (interface{}, error)
GetField retrieves a field value using path syntax
func (*EnhancedReflectionEngine) SetField ¶
func (e *EnhancedReflectionEngine) SetField(obj interface{}, path string, value interface{}) error
SetField sets a field using enhanced path syntax
func (*EnhancedReflectionEngine) SetFieldWithStructuredPath ¶
func (e *EnhancedReflectionEngine) SetFieldWithStructuredPath(obj interface{}, structuredPath *StructuredPath, value interface{}) error
SetFieldWithStructuredPath sets a field using a pre-parsed structured path
func (*EnhancedReflectionEngine) SupportedSyntax ¶
func (e *EnhancedReflectionEngine) SupportedSyntax() []string
SupportedSyntax returns supported path syntax patterns
type ErrorBuilder ¶
type ErrorBuilder struct {
// contains filtered or unexported fields
}
ErrorBuilder helps construct ConfigError instances
func NewErrorBuilder ¶
func NewErrorBuilder(errorType ErrorType) *ErrorBuilder
NewErrorBuilder creates a new error builder
func (*ErrorBuilder) Build ¶
func (b *ErrorBuilder) Build(message string, args ...interface{}) *ConfigError
Build creates a ConfigError with the specified message
func (*ErrorBuilder) WithCode ¶
func (b *ErrorBuilder) WithCode(code string) *ErrorBuilder
WithCode sets the error code
func (*ErrorBuilder) WithPath ¶
func (b *ErrorBuilder) WithPath(path string) *ErrorBuilder
WithPath sets the configuration path
type ErrorContext ¶
type ErrorContext struct {
Line int `json:"line,omitempty"`
Column int `json:"column,omitempty"`
Source string `json:"source,omitempty"`
RelatedPath []string `json:"related_paths,omitempty"`
Examples []string `json:"examples,omitempty"`
Value string `json:"value,omitempty"`
ExpectedType string `json:"expected_type,omitempty"`
}
ErrorContext provides additional error information
type ErrorReporter ¶
type ErrorReporter struct {
// contains filtered or unexported fields
}
ErrorReporter collects and formats multiple errors
func NewErrorReporter ¶
func NewErrorReporter() *ErrorReporter
NewErrorReporter creates a new error reporter
func (*ErrorReporter) Add ¶
func (r *ErrorReporter) Add(err *ConfigError)
Add adds an error to the reporter
func (*ErrorReporter) AddError ¶
func (r *ErrorReporter) AddError(err error, errorType ErrorType, path string)
AddError adds a regular error as a ConfigError
func (*ErrorReporter) Clear ¶
func (r *ErrorReporter) Clear()
Clear removes all errors from the reporter
func (*ErrorReporter) Error ¶
func (r *ErrorReporter) Error() string
Error returns a formatted string with all errors
func (*ErrorReporter) Errors ¶
func (r *ErrorReporter) Errors() []*ConfigError
Errors returns all collected errors
func (*ErrorReporter) GetErrorsByPath ¶
func (r *ErrorReporter) GetErrorsByPath(path string) []*ConfigError
GetErrorsByPath returns errors for a specific path
func (*ErrorReporter) GetErrorsByType ¶
func (r *ErrorReporter) GetErrorsByType(errorType ErrorType) []*ConfigError
GetErrorsByType returns errors of a specific type
func (*ErrorReporter) HasErrors ¶
func (r *ErrorReporter) HasErrors() bool
HasErrors returns true if there are any errors
type ErrorTemplate ¶
ErrorTemplate defines a template for error messages
type FileFlagHandler ¶
type FileFlagHandler struct {
// contains filtered or unexported fields
}
FileFlagHandler handles --base-config, --merge-config, and --config-stack flags
func NewFileFlagHandler ¶
func NewFileFlagHandler() *FileFlagHandler
NewFileFlagHandler creates a new file flag handler
func (*FileFlagHandler) CanHandle ¶
func (h *FileFlagHandler) CanHandle(flagName string) bool
CanHandle returns true if this handler can process the given flag
func (*FileFlagHandler) GetFlagType ¶
func (h *FileFlagHandler) GetFlagType() FlagType
GetFlagType returns the type of flags this handler processes
func (*FileFlagHandler) LoadConfigurationFile ¶
func (h *FileFlagHandler) LoadConfigurationFile(configFile *ConfigFileFlag) (*Configuration, error)
LoadConfigurationFile loads and parses a configuration file
func (*FileFlagHandler) ParseFlag ¶
func (h *FileFlagHandler) ParseFlag(flagName, value string) (interface{}, error)
ParseFlag processes a single flag and returns the parsed result
type FlagHandler ¶
type FlagHandler interface {
// CanHandle returns true if this handler can process the given flag
CanHandle(flagName string) bool
// ParseFlag processes a single flag and returns the parsed result
ParseFlag(flagName, value string) (interface{}, error)
// GetFlagType returns the type of flags this handler processes
GetFlagType() FlagType
}
FlagHandler processes specific types of flags
type FlagParser ¶
type FlagParser interface {
// ParseFlags processes all command-line flags
ParseFlags(args []string) (*ParsedFlags, error)
// RegisterHandler adds a new flag type handler
RegisterHandler(pattern string, handler FlagHandler) error
// SetPrecedence defines flag type precedence order
SetPrecedence(order []FlagType) error
}
FlagParser handles all types of CLI flag parsing
type FlagType ¶
type FlagType string
FlagType represents the type of flag being processed
const ( FlagTypeDotNotation FlagType = "dot_notation" FlagTypeArray FlagType = "array" FlagTypeArrayOp FlagType = "array_operation" // New type for array operations FlagTypeMapOp FlagType = "map_operation" // New type for map operations FlagTypeJSON FlagType = "json" FlagTypeYAML FlagType = "yaml" FlagTypeTemplate FlagType = "template" FlagTypeFile FlagType = "file" FlagTypeOutput FlagType = "output" // New type for output flags FlagTypeSecurity FlagType = "security" // New type for security flags )
type HelpSystem ¶
type HelpSystem interface {
// GetFlagHelp returns help text for a specific flag type
GetFlagHelp(flagType FlagType) (string, error)
// GetAllFlagHelp returns help text for all flag types
GetAllFlagHelp() (string, error)
// GetExamples returns common usage examples
GetExamples() (string, error)
// GetFlagExamples returns examples for a specific flag type
GetFlagExamples(flagType FlagType) ([]string, error)
}
HelpSystem provides help and examples for CLI flags
type JSONFlag ¶
type JSONFlag struct {
Path string
Value interface{}
}
JSONFlag represents a parsed JSON flag
type JSONFlagHandler ¶
type JSONFlagHandler struct{}
JSONFlagHandler handles --json-set flags with JSON-formatted configuration data
func NewJSONFlagHandler ¶
func NewJSONFlagHandler() *JSONFlagHandler
NewJSONFlagHandler creates a new JSON flag handler
func (*JSONFlagHandler) CanHandle ¶
func (h *JSONFlagHandler) CanHandle(flagName string) bool
CanHandle returns true if this handler can process the given flag
func (*JSONFlagHandler) GetFlagType ¶
func (h *JSONFlagHandler) GetFlagType() FlagType
GetFlagType returns the type of flags this handler processes
func (*JSONFlagHandler) MergeIntoConfiguration ¶
func (h *JSONFlagHandler) MergeIntoConfiguration(config *JSONFlag, target map[string]interface{}) error
MergeIntoConfiguration merges the JSON configuration into an existing configuration
func (*JSONFlagHandler) ParseFlag ¶
func (h *JSONFlagHandler) ParseFlag(flagName, value string) (interface{}, error)
ParseFlag processes a single flag and returns the parsed result
type MapFlag ¶
type MapFlag struct {
Operation MapOperation
Path string
Key string // For set/remove operations
Value interface{}
}
MapFlag represents a map operation flag
type MapFlagHandler ¶
type MapFlagHandler struct{}
MapFlagHandler handles advanced map operations
func NewMapFlagHandler ¶
func NewMapFlagHandler() *MapFlagHandler
NewMapFlagHandler creates a new map flag handler
func (*MapFlagHandler) CanHandle ¶
func (h *MapFlagHandler) CanHandle(flagName string) bool
CanHandle returns true if this handler can process the given flag
func (*MapFlagHandler) GetFlagType ¶
func (h *MapFlagHandler) GetFlagType() FlagType
GetFlagType returns the type of flags this handler processes
func (*MapFlagHandler) MergeIntoConfiguration ¶
func (h *MapFlagHandler) MergeIntoConfiguration(flag ParsedFlag, config map[string]interface{}) error
MergeIntoConfiguration applies the map operation to the configuration
func (*MapFlagHandler) ParseFlag ¶
func (h *MapFlagHandler) ParseFlag(flagName, flagValue string) (interface{}, error)
ParseFlag parses map operation flags
type MapOperation ¶
type MapOperation string
MapOperation represents different map operations
const ( MapOpSet MapOperation = "set" MapOpMerge MapOperation = "merge" MapOpRemove MapOperation = "remove" )
type MaskSensitiveFlag ¶
type MaskSensitiveFlag struct {
Enabled bool
}
MaskSensitiveFlag represents a flag to enable/disable sensitive data masking
func (*MaskSensitiveFlag) GetSecurityType ¶
func (f *MaskSensitiveFlag) GetSecurityType() SecurityFlagType
type MergeStrategy ¶
type MergeStrategy struct {
ArrayMergeMode ArrayMergeMode // append, replace, merge
ObjectMergeMode ObjectMergeMode // deep, shallow, replace
Precedence []SourceType // order of precedence
}
MergeStrategy defines conflict resolution behavior
type ObjectMergeMode ¶
type ObjectMergeMode string
ObjectMergeMode defines how objects are merged
const ( ObjectMergeDeep ObjectMergeMode = "deep" // Deep merge objects recursively ObjectMergeShallow ObjectMergeMode = "shallow" // Shallow merge objects ObjectMergeReplace ObjectMergeMode = "replace" // Replace with higher precedence object )
type OutputFlagHandler ¶
type OutputFlagHandler struct{}
OutputFlagHandler handles --output-format, --dry-run, and --quiet flags
func NewOutputFlagHandler ¶
func NewOutputFlagHandler() *OutputFlagHandler
NewOutputFlagHandler creates a new output flag handler
func (*OutputFlagHandler) CanHandle ¶
func (h *OutputFlagHandler) CanHandle(flagName string) bool
CanHandle returns true if this handler can process the given flag
func (*OutputFlagHandler) GetFlagType ¶
func (h *OutputFlagHandler) GetFlagType() FlagType
GetFlagType returns the type of flags this handler processes
func (*OutputFlagHandler) ParseFlag ¶
func (h *OutputFlagHandler) ParseFlag(flagName, value string) (interface{}, error)
ParseFlag processes a single flag and returns the parsed result
type OutputFormat ¶
type OutputFormat string
OutputFormat defines the supported output formats
const ( OutputFormatJSON OutputFormat = "json" OutputFormatYAML OutputFormat = "yaml" OutputFormatDiff OutputFormat = "diff" )
func ParseOutputFormat ¶
func ParseOutputFormat(format string) (OutputFormat, error)
ParseOutputFormat parses a string into an OutputFormat
type OutputFormatFlag ¶
type OutputFormatFlag struct {
Format OutputFormat
}
OutputFormatFlag represents a parsed output format flag
func (*OutputFormatFlag) GetPath ¶
func (f *OutputFormatFlag) GetPath() string
GetPath returns the configuration path this flag affects
func (*OutputFormatFlag) MergeIntoConfiguration ¶
func (f *OutputFormatFlag) MergeIntoConfiguration(flag ParsedFlag, config map[string]interface{}) error
MergeIntoConfiguration applies this flag to the configuration
type OutputFormatter ¶
type OutputFormatter interface {
// FormatConfiguration formats a configuration in the specified format
FormatConfiguration(config *Configuration, format OutputFormat, mode OutputMode) (string, error)
// FormatDiff formats a diff between two configurations
FormatDiff(original, updated *Configuration, mode OutputMode) (string, error)
// FormatConflicts formats conflict information
FormatConflicts(conflicts []ConfigConflict, mode OutputMode) (string, error)
}
OutputFormatter handles formatting configuration output in different formats
type OutputMode ¶
type OutputMode string
OutputMode defines the output mode
const ( OutputModeNormal OutputMode = "normal" // Normal output OutputModeDryRun OutputMode = "dry-run" // Preview mode without applying changes OutputModeQuiet OutputMode = "quiet" // Minimal output for scripting )
func ParseOutputMode ¶
func ParseOutputMode(mode string) (OutputMode, error)
ParseOutputMode parses a string into an OutputMode
type OutputModeFlag ¶
type OutputModeFlag struct {
Mode OutputMode
}
OutputModeFlag represents a parsed output mode flag
func (*OutputModeFlag) GetPath ¶
func (f *OutputModeFlag) GetPath() string
GetPath returns the configuration path this flag affects
func (*OutputModeFlag) MergeIntoConfiguration ¶
func (f *OutputModeFlag) MergeIntoConfiguration(flag ParsedFlag, config map[string]interface{}) error
MergeIntoConfiguration applies this flag to the configuration
type OutputOptions ¶
type OutputOptions struct {
Format OutputFormat `json:"format"`
Mode OutputMode `json:"mode"`
}
OutputOptions contains options for output formatting
type ParsedFlag ¶
type ParsedFlag interface {
// GetPath returns the configuration path this flag affects
GetPath() string
}
ParsedFlag represents a parsed flag that can be merged into configuration
type ParsedFlags ¶
type ParsedFlags struct {
DotNotation map[string]string
ArrayFlags []ArrayFlag
JSONFlags []JSONFlag
YAMLFlags []YAMLFlag
TemplateVars map[string]string
ConfigFiles []ConfigFile
ConfigFileFlags []*ConfigFileFlag // New configuration file flags with merge info
ArrayOperations []ArrayOperationFlag // Array operations (append, insert, remove)
MapOperations []MapFlag // Map operations (set, merge, remove)
OutputFormat *OutputFormatFlag // Output format flag
OutputMode *OutputModeFlag // Output mode flag
SecurityFlags []SecurityFlag // Security-related flags
}
ParsedFlags contains all parsed flag information
type PathParser ¶
type PathParser interface {
// ParsePath converts path string to structured path
ParsePath(path string) (*StructuredPath, error)
// ValidatePath ensures path syntax is correct
ValidatePath(path string) error
// SupportedSyntax returns supported path syntax patterns
SupportedSyntax() []string
}
PathParser handles different path syntax formats
type ReflectionEngine ¶
type ReflectionEngine interface {
// SetField sets a field using enhanced path syntax
SetField(obj interface{}, path string, value interface{}) error
// SetFieldWithStructuredPath sets a field using a pre-parsed structured path
SetFieldWithStructuredPath(obj interface{}, structuredPath *StructuredPath, value interface{}) error
// GetField retrieves a field value using path syntax
GetField(obj interface{}, path string) (interface{}, error)
// ExpandArray automatically expands arrays to accommodate indices
ExpandArray(obj interface{}, path string, index int) error
// SupportedSyntax returns supported path syntax patterns
SupportedSyntax() []string
}
ReflectionEngine handles struct field manipulation with enhanced path support
type SOPSConfigFlag ¶
type SOPSConfigFlag struct {
ConfigPath string
}
SOPSConfigFlag represents a SOPS configuration flag
func (*SOPSConfigFlag) GetSecurityType ¶
func (f *SOPSConfigFlag) GetSecurityType() SecurityFlagType
type SOPSIntegration ¶
type SOPSIntegration struct {
// contains filtered or unexported fields
}
SOPSIntegration handles SOPS integration for encrypted configuration files
func NewSOPSIntegration ¶
func NewSOPSIntegration(sopsManager sops.SOPSManager) *SOPSIntegration
NewSOPSIntegration creates a new SOPS integration handler
func (*SOPSIntegration) CreateSOPSConfig ¶
func (s *SOPSIntegration) CreateSOPSConfig(configPath, ageKeyPath string) error
CreateSOPSConfig creates a default SOPS configuration
func (*SOPSIntegration) EncryptConfigFile ¶
func (s *SOPSIntegration) EncryptConfigFile(configPath string, config map[string]interface{}) error
EncryptConfigFile encrypts a configuration file using SOPS
func (*SOPSIntegration) GetEncryptedConfigInfo ¶
func (s *SOPSIntegration) GetEncryptedConfigInfo(configPath string) (*EncryptedConfigInfo, error)
GetEncryptedConfigInfo returns information about an encrypted configuration file
func (*SOPSIntegration) GetSOPSStatus ¶
func (s *SOPSIntegration) GetSOPSStatus() SOPSStatus
GetSOPSStatus returns the status of SOPS integration
func (*SOPSIntegration) LoadEncryptedConfig ¶
func (s *SOPSIntegration) LoadEncryptedConfig(configPath string) (map[string]interface{}, error)
LoadEncryptedConfig loads and decrypts a SOPS-encrypted configuration file
func (*SOPSIntegration) MaskSensitiveConfigData ¶
func (s *SOPSIntegration) MaskSensitiveConfigData(config map[string]interface{}) map[string]interface{}
MaskSensitiveConfigData masks sensitive data in configuration for logging
func (*SOPSIntegration) ValidateSOPSConfig ¶
func (s *SOPSIntegration) ValidateSOPSConfig(sopsConfigPath string) error
ValidateSOPSConfig validates SOPS configuration
type SOPSStatus ¶
SOPSStatus represents the status of SOPS integration
type SSHKeyFlagHandler ¶
type SSHKeyFlagHandler struct{}
SSHKeyFlagHandler handles --ssh-key flags
func NewSSHKeyFlagHandler ¶
func NewSSHKeyFlagHandler() *SSHKeyFlagHandler
NewSSHKeyFlagHandler creates a new SSH key flag handler
func (*SSHKeyFlagHandler) CanHandle ¶
func (h *SSHKeyFlagHandler) CanHandle(flagName string) bool
CanHandle returns true if this handler can process the given flag
func (*SSHKeyFlagHandler) GetFlagType ¶
func (h *SSHKeyFlagHandler) GetFlagType() FlagType
GetFlagType returns the type of flags this handler processes
func (*SSHKeyFlagHandler) ParseArrayFlag ¶
func (h *SSHKeyFlagHandler) ParseArrayFlag(flagName, value string) (*ArrayConfig, error)
ParseArrayFlag converts string to array configuration
func (*SSHKeyFlagHandler) ParseFlag ¶
func (h *SSHKeyFlagHandler) ParseFlag(flagName, value string) (interface{}, error)
ParseFlag processes a single flag and returns the parsed result
func (*SSHKeyFlagHandler) SupportedTypes ¶
func (h *SSHKeyFlagHandler) SupportedTypes() []string
SupportedTypes returns array types this handler supports
func (*SSHKeyFlagHandler) ValidateArrayConfig ¶
func (h *SSHKeyFlagHandler) ValidateArrayConfig(config *ArrayConfig) error
ValidateArrayConfig ensures array configuration is valid
type SecureTemplateProcessor ¶
type SecureTemplateProcessor struct {
// contains filtered or unexported fields
}
SecureTemplateProcessor handles secure template variable processing
func NewSecureTemplateProcessor ¶
func NewSecureTemplateProcessor() *SecureTemplateProcessor
NewSecureTemplateProcessor creates a new secure template processor
func (*SecureTemplateProcessor) AddSecureVariable ¶
func (p *SecureTemplateProcessor) AddSecureVariable(key, value string, isFile bool) error
AddSecureVariable adds a secure template variable
func (*SecureTemplateProcessor) ClearSecureVariables ¶
func (p *SecureTemplateProcessor) ClearSecureVariables()
ClearSecureVariables clears all secure template variables
func (*SecureTemplateProcessor) GetAllSecureVariables ¶
func (p *SecureTemplateProcessor) GetAllSecureVariables() map[string]string
GetAllSecureVariables returns all secure template variables (masked for logging)
func (*SecureTemplateProcessor) GetSecureVariable ¶
func (p *SecureTemplateProcessor) GetSecureVariable(key string) (string, bool)
GetSecureVariable retrieves a secure template variable
func (*SecureTemplateProcessor) GetSecureVariableCount ¶
func (p *SecureTemplateProcessor) GetSecureVariableCount() int
GetSecureVariableCount returns the number of secure variables
func (*SecureTemplateProcessor) HasSecureVariable ¶
func (p *SecureTemplateProcessor) HasSecureVariable(key string) bool
HasSecureVariable checks if a secure variable exists
func (*SecureTemplateProcessor) LoadSecureVariableFromFile ¶
func (p *SecureTemplateProcessor) LoadSecureVariableFromFile(key, filePath string) error
LoadSecureVariableFromFile loads a secure variable from a file
func (*SecureTemplateProcessor) LoadSecureVariablesFromEnv ¶
func (p *SecureTemplateProcessor) LoadSecureVariablesFromEnv(prefix string) error
LoadSecureVariablesFromEnv loads secure variables from environment variables
func (*SecureTemplateProcessor) MaskSecureVariablesInString ¶
func (p *SecureTemplateProcessor) MaskSecureVariablesInString(content string) string
MaskSecureVariablesInString masks secure variables in a string for logging
func (*SecureTemplateProcessor) ProcessSecureTemplates ¶
func (p *SecureTemplateProcessor) ProcessSecureTemplates(content string) (string, error)
ProcessSecureTemplates processes templates with secure variables
func (*SecureTemplateProcessor) SetWarningsEnabled ¶
func (p *SecureTemplateProcessor) SetWarningsEnabled(enabled bool)
SetWarningsEnabled enables or disables security warnings
func (*SecureTemplateProcessor) ValidateSecureVariables ¶
func (p *SecureTemplateProcessor) ValidateSecureVariables(content string) []string
ValidateSecureVariables validates that all required secure variables are provided
type SecureTemplateVarFlag ¶
SecureTemplateVarFlag represents a secure template variable flag
func (*SecureTemplateVarFlag) GetSecurityType ¶
func (f *SecureTemplateVarFlag) GetSecurityType() SecurityFlagType
type SecurityFlag ¶
type SecurityFlag interface {
GetSecurityType() SecurityFlagType
}
SecurityFlag represents a security-related flag
type SecurityFlagHandler ¶
type SecurityFlagHandler struct {
// contains filtered or unexported fields
}
SecurityFlagHandler handles security-related flags and warnings
func NewSecurityFlagHandler ¶
func NewSecurityFlagHandler() *SecurityFlagHandler
NewSecurityFlagHandler creates a new security flag handler
func (*SecurityFlagHandler) CanHandle ¶
func (h *SecurityFlagHandler) CanHandle(flagName string) bool
CanHandle returns true if this handler can process the given flag
func (*SecurityFlagHandler) GetFlagType ¶
func (h *SecurityFlagHandler) GetFlagType() FlagType
GetFlagType returns the type of flags this handler processes
func (*SecurityFlagHandler) MaskFlagValue ¶
func (h *SecurityFlagHandler) MaskFlagValue(flagName, value string) string
MaskFlagValue masks sensitive data in flag values for logging/output
func (*SecurityFlagHandler) ParseFlag ¶
func (h *SecurityFlagHandler) ParseFlag(flagName, value string) (interface{}, error)
ParseFlag processes a single security flag
func (*SecurityFlagHandler) ValidateSecurityConfiguration ¶
func (h *SecurityFlagHandler) ValidateSecurityConfiguration(config map[string]interface{}) []SecurityWarning
ValidateSecurityConfiguration validates security-related configuration
type SecurityFlagType ¶
type SecurityFlagType string
SecurityFlagType represents the type of security flag
const ( SecurityFlagTypeSecureTemplateVar SecurityFlagType = "secure_template_var" SecurityFlagTypeMaskSensitive SecurityFlagType = "mask_sensitive" SecurityFlagTypeSecurityWarnings SecurityFlagType = "security_warnings" SecurityFlagTypeSOPSConfig SecurityFlagType = "sops_config" SecurityFlagTypeEncryptedConfig SecurityFlagType = "encrypted_config" )
type SecurityWarning ¶
type SecurityWarning struct {
Type string
Severity string
Message string
Field string
Suggestion string
}
SecurityWarning represents a security warning
type SecurityWarningsFlag ¶
type SecurityWarningsFlag struct {
Enabled bool
}
SecurityWarningsFlag represents a flag to enable/disable security warnings
func (*SecurityWarningsFlag) GetSecurityType ¶
func (f *SecurityWarningsFlag) GetSecurityType() SecurityFlagType
type ServerPoolConfig ¶
type ServerPoolConfig struct {
Name string `yaml:"name" validate:"required"`
WorkerCount int `yaml:"worker_count" validate:"min=0,max=100"`
FlavorWorker string `yaml:"flavor_worker" validate:"required"`
NodeWorker string `yaml:"node_worker" validate:"required"`
ServerGroupAffinity string `yaml:"server_group_affinity,omitempty"`
ImageID string `yaml:"image_id,omitempty"`
ImageName string `yaml:"image_name,omitempty"`
VolumeSize int `yaml:"volume_size,omitempty"`
VolumeType string `yaml:"volume_type,omitempty"`
CustomFields map[string]string `yaml:"custom_fields,omitempty"`
}
ServerPoolConfig represents the structure of a server pool configuration This matches the design document specification
type ServerPoolFlagHandler ¶
type ServerPoolFlagHandler struct{}
ServerPoolFlagHandler handles --server-pool flags with comma-separated key=value syntax
func NewServerPoolFlagHandler ¶
func NewServerPoolFlagHandler() *ServerPoolFlagHandler
NewServerPoolFlagHandler creates a new server pool flag handler
func (*ServerPoolFlagHandler) CanHandle ¶
func (h *ServerPoolFlagHandler) CanHandle(flagName string) bool
CanHandle returns true if this handler can process the given flag
func (*ServerPoolFlagHandler) GetFlagType ¶
func (h *ServerPoolFlagHandler) GetFlagType() FlagType
GetFlagType returns the type of flags this handler processes
func (*ServerPoolFlagHandler) ParseArrayFlag ¶
func (h *ServerPoolFlagHandler) ParseArrayFlag(flagName, value string) (*ArrayConfig, error)
ParseArrayFlag converts string to array configuration
func (*ServerPoolFlagHandler) ParseFlag ¶
func (h *ServerPoolFlagHandler) ParseFlag(flagName, value string) (interface{}, error)
ParseFlag processes a single flag and returns the parsed result
func (*ServerPoolFlagHandler) SupportedTypes ¶
func (h *ServerPoolFlagHandler) SupportedTypes() []string
SupportedTypes returns array types this handler supports
func (*ServerPoolFlagHandler) ToServerPoolConfig ¶
func (h *ServerPoolFlagHandler) ToServerPoolConfig(fields map[string]interface{}) (*ServerPoolConfig, error)
ToServerPoolConfig converts the parsed fields to a ServerPoolConfig struct
func (*ServerPoolFlagHandler) ValidateArrayConfig ¶
func (h *ServerPoolFlagHandler) ValidateArrayConfig(config *ArrayConfig) error
ValidateArrayConfig ensures array configuration is valid
type SourceType ¶
type SourceType string
SourceType defines the type of configuration source
const ( SourceCLI SourceType = "cli" SourceFile SourceType = "file" SourceTemplate SourceType = "template" SourceDefault SourceType = "default" )
type StructuredPath ¶
StructuredPath represents a parsed configuration path
func (*StructuredPath) GetFieldNames ¶
func (sp *StructuredPath) GetFieldNames() []string
GetFieldNames returns all field names in the path (excluding indices)
func (*StructuredPath) GetIndices ¶
func (sp *StructuredPath) GetIndices() []int
GetIndices returns all array indices in the path
func (*StructuredPath) GetLastPart ¶
func (sp *StructuredPath) GetLastPart() PathPart
GetLastPart returns the last part of the path
func (*StructuredPath) GetParentPath ¶
func (sp *StructuredPath) GetParentPath() *StructuredPath
GetParentPath returns the path without the last part
func (*StructuredPath) HasArrayAccess ¶
func (sp *StructuredPath) HasArrayAccess() bool
HasArrayAccess returns true if the path contains array access
func (*StructuredPath) String ¶
func (sp *StructuredPath) String() string
String returns a string representation of the structured path
type SubnetFlagHandler ¶
type SubnetFlagHandler struct{}
SubnetFlagHandler handles --subnet flags
func NewSubnetFlagHandler ¶
func NewSubnetFlagHandler() *SubnetFlagHandler
NewSubnetFlagHandler creates a new subnet flag handler
func (*SubnetFlagHandler) CanHandle ¶
func (h *SubnetFlagHandler) CanHandle(flagName string) bool
CanHandle returns true if this handler can process the given flag
func (*SubnetFlagHandler) GetFlagType ¶
func (h *SubnetFlagHandler) GetFlagType() FlagType
GetFlagType returns the type of flags this handler processes
func (*SubnetFlagHandler) ParseArrayFlag ¶
func (h *SubnetFlagHandler) ParseArrayFlag(flagName, value string) (*ArrayConfig, error)
ParseArrayFlag converts string to array configuration
func (*SubnetFlagHandler) ParseFlag ¶
func (h *SubnetFlagHandler) ParseFlag(flagName, value string) (interface{}, error)
ParseFlag processes a single flag and returns the parsed result
func (*SubnetFlagHandler) SupportedTypes ¶
func (h *SubnetFlagHandler) SupportedTypes() []string
SupportedTypes returns array types this handler supports
func (*SubnetFlagHandler) ValidateArrayConfig ¶
func (h *SubnetFlagHandler) ValidateArrayConfig(config *ArrayConfig) error
ValidateArrayConfig ensures array configuration is valid
type TemplateContext ¶
type TemplateContext struct {
Variables map[string]string `json:"variables"`
Functions map[string]interface{} `json:"functions"`
Config *Configuration `json:"config"`
}
TemplateContext provides context for template processing
type TemplateFlagHandler ¶
type TemplateFlagHandler struct{}
TemplateFlagHandler handles --template-var flags
func NewTemplateFlagHandler ¶
func NewTemplateFlagHandler() *TemplateFlagHandler
NewTemplateFlagHandler creates a new template flag handler
func (*TemplateFlagHandler) CanHandle ¶
func (h *TemplateFlagHandler) CanHandle(flagName string) bool
CanHandle returns true if this handler can process the given flag
func (*TemplateFlagHandler) GetFlagType ¶
func (h *TemplateFlagHandler) GetFlagType() FlagType
GetFlagType returns the type of flags this handler processes
func (*TemplateFlagHandler) ParseFlag ¶
func (h *TemplateFlagHandler) ParseFlag(flagName, value string) (interface{}, error)
ParseFlag processes a single flag and returns the parsed result
type TemplateProcessor ¶
type TemplateProcessor interface {
// ProcessTemplates substitutes variables in configuration
ProcessTemplates(config *Configuration, vars map[string]string) error
// ValidateTemplates checks for undefined variables
ValidateTemplates(config *Configuration) ([]string, error)
// RegisterFunction adds custom template functions
RegisterFunction(name string, fn interface{}) error
}
TemplateProcessor handles template variable substitution
type TemplateVariable ¶
TemplateVariable represents a parsed template variable
func (*TemplateVariable) String ¶
func (v *TemplateVariable) String() string
String returns a string representation of the template variable
type ValidationMode ¶
type ValidationMode string
ValidationMode defines the validation mode
const ( ValidationModeValidateOnly ValidationMode = "validate-only" // Only validate, don't apply ValidationModeNormal ValidationMode = "normal" // Normal validation and apply )
type ValidationResult ¶
type ValidationResult struct {
Valid bool `json:"valid"`
Errors []ConfigValidationError `json:"errors,omitempty"`
Warnings []ConfigValidationWarning `json:"warnings,omitempty"`
Summary ValidationSummary `json:"summary"`
}
ValidationResult represents the result of configuration validation
type ValidationSummary ¶
type ValidationSummary struct {
TotalErrors int `json:"total_errors"`
TotalWarnings int `json:"total_warnings"`
ConfigPaths int `json:"config_paths"`
FlagsProcessed int `json:"flags_processed"`
}
ValidationSummary provides a summary of validation results
type YAMLFlag ¶
type YAMLFlag struct {
Path string
Value interface{}
}
YAMLFlag represents a parsed YAML flag
type YAMLFlagHandler ¶
type YAMLFlagHandler struct{}
YAMLFlagHandler handles --yaml-set, --yaml-data, and --yaml-file flags
func NewYAMLFlagHandler ¶
func NewYAMLFlagHandler() *YAMLFlagHandler
NewYAMLFlagHandler creates a new YAML flag handler
func (*YAMLFlagHandler) CanHandle ¶
func (h *YAMLFlagHandler) CanHandle(flagName string) bool
CanHandle returns true if this handler can process the given flag
func (*YAMLFlagHandler) GetFlagType ¶
func (h *YAMLFlagHandler) GetFlagType() FlagType
GetFlagType returns the type of flags this handler processes
func (*YAMLFlagHandler) MergeIntoConfiguration ¶
func (h *YAMLFlagHandler) MergeIntoConfiguration(config *YAMLFlag, target map[string]interface{}) error
MergeIntoConfiguration merges the YAML configuration into an existing configuration
func (*YAMLFlagHandler) ParseFlag ¶
func (h *YAMLFlagHandler) ParseFlag(flagName, value string) (interface{}, error)
ParseFlag processes a single flag and returns the parsed result
Source Files
¶
- array_flag_handler.go
- configuration_merger.go
- conflict_detector.go
- dns_server_handler.go
- errors.go
- file_flag_handler.go
- integration.go
- interfaces.go
- json_flag_handler.go
- map_flag_handler.go
- output_flag_handler.go
- output_formatter.go
- parser.go
- path_parser.go
- reflection_engine.go
- secure_template_processor.go
- security_flag_handler.go
- server_pool_handler.go
- sops_integration.go
- ssh_key_handler.go
- subnet_handler.go
- template_flag_handler.go
- template_processor.go
- test_helpers.go
- validation_help_system.go
- yaml_flag_handler.go