Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExportEffectiveConfig ¶
func ExportEffectiveConfig(cfg interface{}, appliedDefaults map[string]DefaultSource) (string, error)
ExportEffectiveConfig exports the configuration with applied defaults as comments. This allows users to see which values came from defaults vs explicit configuration.
func FormatAppliedDefaults ¶
func FormatAppliedDefaults(appliedDefaults map[string]DefaultSource) string
FormatAppliedDefaults returns a formatted string of applied defaults for display.
Types ¶
type DefaultSource ¶
type DefaultSource string
DefaultSource indicates where a default value came from.
const ( SourceExplicit DefaultSource = "explicit" // User-provided value SourceCLIConfig DefaultSource = "cli_config" // CLI configuration file SourceProviderRegion DefaultSource = "provider_region" // Provider-region registry SourceProvider DefaultSource = "provider" // Provider-level default SourceGlobal DefaultSource = "global" // Global default )
type FlavorDefaults ¶
FlavorDefaults holds default instance type/flavor names for different node types.
type Hydrator ¶
type Hydrator interface {
// Hydrate applies defaults to the configuration
Hydrate(cfg interface{}, provider, region string) error
// GetAppliedDefaults returns a map of field paths to their default sources
GetAppliedDefaults() map[string]DefaultSource
}
Hydrator applies default values to configuration without overwriting explicit values.
func NewHydrator ¶
NewHydrator creates a new hydrator with the given registry.
type ProviderDefaults ¶
type ProviderDefaults interface {
// GetImageID returns the default image ID for the specified OS version
GetImageID(osVersion string) string
// GetAvailabilityZones returns the default availability zones for the region
GetAvailabilityZones() []string
// GetNTPServers returns the default NTP servers for the region
GetNTPServers() []string
// GetDNSNameservers returns the default DNS nameservers for the region
GetDNSNameservers() []string
// GetDefaultStorageClass returns the default storage class for the provider
GetDefaultStorageClass() string
// GetDefaultFlavors returns the default instance type flavors
GetDefaultFlavors() FlavorDefaults
}
ProviderDefaults defines the interface for provider-region specific defaults. Implementations supply context-aware default values based on infrastructure provider and region.
type Registry ¶
type Registry interface {
// GetDefaults retrieves the defaults for a specific provider-region combination
GetDefaults(provider, region string) (ProviderDefaults, error)
// RegisterDefaults registers defaults for a provider-region combination
RegisterDefaults(provider, region string, defaults ProviderDefaults)
// ListProviders returns all registered provider names
ListProviders() []string
// ListRegions returns all registered regions for a specific provider
ListRegions(provider string) []string
}
Registry defines the interface for managing provider-region defaults. It maintains a registry of ProviderDefaults implementations keyed by provider and region.
func GetGlobalRegistry ¶
func GetGlobalRegistry() Registry
GetGlobalRegistry returns the singleton global registry instance.
func NewRegistry ¶
func NewRegistry() Registry
NewRegistry creates a new provider-region defaults registry.