Documentation
¶
Index ¶
- func ConfigExists(filename string) bool
- func CreateDefaultConfigFile(filename string) error
- func GetConfigFilePath(configFile string) string
- func SaveConfig(config *Config, filename string) error
- func ValidateConfig(config *Config) error
- type APIKeyAuth
- type AlertChannelConfig
- type AlertRuleConfig
- type AlertingConfig
- type AuthConfig
- type AuthType
- type BasicAuth
- type BearerAuth
- type Config
- func (c *Config) AddEndpoint(endpoint EndpointConfig) error
- func (c *Config) GetEnabledEndpoints() []EndpointConfig
- func (c *Config) GetEndpoint(id string) (*EndpointConfig, error)
- func (c *Config) ListEndpoints() []EndpointConfig
- func (c *Config) RemoveEndpoint(id string) error
- func (c *Config) UpdateEndpoint(id string, updated EndpointConfig) error
- type EndpointConfig
- type GlobalConfig
- type OAuth2Auth
- type ProjectConfig
- type ReportingConfig
- type RetentionConfig
- type ValidationConfig
- type ValidationError
- type ValidationErrors
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigExists ¶
ConfigExists checks if a configuration file exists
func CreateDefaultConfigFile ¶
CreateDefaultConfigFile creates a default configuration file
func GetConfigFilePath ¶
GetConfigFilePath returns the path to the configuration file
func SaveConfig ¶
SaveConfig saves the configuration to a YAML file
func ValidateConfig ¶
ValidateConfig validates the entire configuration
Types ¶
type APIKeyAuth ¶
type APIKeyAuth struct {
Header string `yaml:"header" mapstructure:"header"`
Value string `yaml:"value" mapstructure:"value"`
}
APIKeyAuth represents API key authentication via custom headers
type AlertChannelConfig ¶
type AlertChannelConfig struct {
Type string `yaml:"type" mapstructure:"type"` // slack, email, webhook
Name string `yaml:"name" mapstructure:"name"`
Enabled bool `yaml:"enabled" mapstructure:"enabled"`
Settings map[string]interface{} `yaml:"settings" mapstructure:"settings"`
}
AlertChannelConfig represents a single alert channel
type AlertRuleConfig ¶
type AlertRuleConfig struct {
Name string `yaml:"name" mapstructure:"name"`
Severity []string `yaml:"severity" mapstructure:"severity"` // low, medium, high, critical
Endpoints []string `yaml:"endpoints,omitempty" mapstructure:"endpoints"` // empty means all
Channels []string `yaml:"channels" mapstructure:"channels"`
}
AlertRuleConfig defines when alerts should be triggered
type AlertingConfig ¶
type AlertingConfig struct {
Enabled bool `yaml:"enabled" mapstructure:"enabled"`
Channels []AlertChannelConfig `yaml:"channels" mapstructure:"channels"`
Rules []AlertRuleConfig `yaml:"rules" mapstructure:"rules"`
}
AlertingConfig contains alerting configuration
type AuthConfig ¶
type AuthConfig struct {
Type AuthType `yaml:"type" mapstructure:"type"`
Bearer *BearerAuth `yaml:"bearer,omitempty" mapstructure:"bearer"`
Basic *BasicAuth `yaml:"basic,omitempty" mapstructure:"basic"`
APIKey *APIKeyAuth `yaml:"api_key,omitempty" mapstructure:"api_key"`
OAuth2 *OAuth2Auth `yaml:"oauth2,omitempty" mapstructure:"oauth2"`
}
AuthConfig contains authentication configuration for endpoints
type BasicAuth ¶
type BasicAuth struct {
Username string `yaml:"username" mapstructure:"username"`
Password string `yaml:"password" mapstructure:"password"`
}
BasicAuth represents HTTP Basic authentication
type BearerAuth ¶
type BearerAuth struct {
Token string `yaml:"token" mapstructure:"token"`
}
BearerAuth represents Bearer token authentication
type Config ¶
type Config struct {
Project ProjectConfig `yaml:"project" mapstructure:"project"`
Global GlobalConfig `yaml:"global" mapstructure:"global"`
Endpoints []EndpointConfig `yaml:"endpoints" mapstructure:"endpoints"`
Alerting AlertingConfig `yaml:"alerting" mapstructure:"alerting"`
Reporting ReportingConfig `yaml:"reporting" mapstructure:"reporting"`
Retention RetentionConfig `yaml:"retention" mapstructure:"retention"`
}
Config represents the complete DriftWatch configuration
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a configuration with sensible defaults
func LoadConfig ¶
LoadConfig loads configuration from file and environment variables
func (*Config) AddEndpoint ¶
func (c *Config) AddEndpoint(endpoint EndpointConfig) error
AddEndpoint adds a new endpoint to the configuration
func (*Config) GetEnabledEndpoints ¶
func (c *Config) GetEnabledEndpoints() []EndpointConfig
GetEnabledEndpoints returns only enabled endpoints
func (*Config) GetEndpoint ¶
func (c *Config) GetEndpoint(id string) (*EndpointConfig, error)
GetEndpoint retrieves an endpoint by ID
func (*Config) ListEndpoints ¶
func (c *Config) ListEndpoints() []EndpointConfig
ListEndpoints returns all endpoints
func (*Config) RemoveEndpoint ¶
RemoveEndpoint removes an endpoint from the configuration
func (*Config) UpdateEndpoint ¶
func (c *Config) UpdateEndpoint(id string, updated EndpointConfig) error
UpdateEndpoint updates an existing endpoint
type EndpointConfig ¶
type EndpointConfig struct {
ID string `yaml:"id" mapstructure:"id"`
URL string `yaml:"url" mapstructure:"url"`
Method string `yaml:"method" mapstructure:"method"`
SpecFile string `yaml:"spec_file,omitempty" mapstructure:"spec_file"`
Interval time.Duration `yaml:"interval" mapstructure:"interval"`
Headers map[string]string `yaml:"headers,omitempty" mapstructure:"headers"`
Auth *AuthConfig `yaml:"auth,omitempty" mapstructure:"auth"`
Validation ValidationConfig `yaml:"validation" mapstructure:"validation"`
RequestBodyFile string `yaml:"request_body_file,omitempty" mapstructure:"request_body_file"`
Timeout time.Duration `yaml:"timeout,omitempty" mapstructure:"timeout"`
RetryCount int `yaml:"retry_count,omitempty" mapstructure:"retry_count"`
Enabled bool `yaml:"enabled" mapstructure:"enabled"`
}
EndpointConfig represents configuration for a single API endpoint
type GlobalConfig ¶
type GlobalConfig struct {
UserAgent string `yaml:"user_agent" mapstructure:"user_agent"`
Timeout time.Duration `yaml:"timeout" mapstructure:"timeout"`
RetryCount int `yaml:"retry_count" mapstructure:"retry_count"`
RetryDelay time.Duration `yaml:"retry_delay" mapstructure:"retry_delay"`
MaxWorkers int `yaml:"max_workers" mapstructure:"max_workers"`
DatabaseURL string `yaml:"database_url" mapstructure:"database_url"`
}
GlobalConfig contains global settings that apply to all endpoints
type OAuth2Auth ¶
type OAuth2Auth struct {
TokenURL string `yaml:"token_url" mapstructure:"token_url"`
ClientID string `yaml:"client_id" mapstructure:"client_id"`
ClientSecret string `yaml:"client_secret" mapstructure:"client_secret"`
Scopes []string `yaml:"scopes,omitempty" mapstructure:"scopes"`
ExtraParams map[string]string `yaml:"extra_params,omitempty" mapstructure:"extra_params"`
}
OAuth2Auth represents OAuth 2.0 client credentials flow
type ProjectConfig ¶
type ProjectConfig struct {
Name string `yaml:"name" mapstructure:"name"`
Description string `yaml:"description" mapstructure:"description"`
Version string `yaml:"version" mapstructure:"version"`
}
ProjectConfig contains project-level settings
type ReportingConfig ¶
type ReportingConfig struct {
RetentionDays int `yaml:"retention_days" mapstructure:"retention_days"`
ExportFormat string `yaml:"export_format" mapstructure:"export_format"` // json, csv, yaml
IncludeBody bool `yaml:"include_body" mapstructure:"include_body"`
}
ReportingConfig contains reporting configuration
type RetentionConfig ¶
type RetentionConfig struct {
MonitoringRunsDays int `yaml:"monitoring_runs_days" mapstructure:"monitoring_runs_days"`
DriftsDays int `yaml:"drifts_days" mapstructure:"drifts_days"`
AlertsDays int `yaml:"alerts_days" mapstructure:"alerts_days"`
AutoCleanup bool `yaml:"auto_cleanup" mapstructure:"auto_cleanup"`
CleanupInterval time.Duration `yaml:"cleanup_interval" mapstructure:"cleanup_interval"`
}
RetentionConfig contains data retention policies
type ValidationConfig ¶
type ValidationConfig struct {
StrictMode bool `yaml:"strict_mode" mapstructure:"strict_mode"`
IgnoreFields []string `yaml:"ignore_fields,omitempty" mapstructure:"ignore_fields"`
RequiredFields []string `yaml:"required_fields,omitempty" mapstructure:"required_fields"`
}
ValidationConfig contains validation-specific settings
type ValidationError ¶
ValidationError represents a configuration validation error
func (ValidationError) Error ¶
func (e ValidationError) Error() string
type ValidationErrors ¶
type ValidationErrors []ValidationError
ValidationErrors represents multiple validation errors
func (ValidationErrors) Error ¶
func (e ValidationErrors) Error() string