Documentation
¶
Index ¶
- Constants
- func InitConfig(override, defaultConfig string)
- type AppConfig
- type AppGlobals
- type Configuration
- func (s *Configuration) ChangeContext(name string)
- func (s *Configuration) ClearContexts()
- func (s *Configuration) CopyContext(src, dest string)
- func (s *Configuration) DeleteContext(name string)
- func (s *Configuration) GetAppConfig() *AppConfig
- func (s *Configuration) GetCloudConfiguration(configName string) (string, map[string]string)
- func (s *Configuration) GetContexts() map[string]*GrafanaConfig
- func (s *Configuration) GetDefaultGrafanaConfig() *GrafanaConfig
- func (s *Configuration) IgnoreSSL() bool
- func (s *Configuration) IsDebug() bool
- func (s *Configuration) NewContext(name string)
- func (s *Configuration) PrintContext(name string)
- func (s *Configuration) SaveToDisk(useViper bool) error
- func (s *Configuration) ViperConfig() *viper.Viper
- type CredentialRule
- type DataSourceFilters
- type DataSourceSettings
- type FilterOverrides
- type GrafanaConfig
- func (s *GrafanaConfig) GetAlertNotificationOutput() string
- func (s *GrafanaConfig) GetCredentials(dataSourceName models.AddDataSourceCommand) (*GrafanaDataSource, error)
- func (s *GrafanaConfig) GetDashboardOutput() string
- func (s *GrafanaConfig) GetDataSourceOutput() string
- func (s *GrafanaConfig) GetDataSourceSettings() *DataSourceSettings
- func (s *GrafanaConfig) GetFilterOverrides() *FilterOverrides
- func (s *GrafanaConfig) GetFolderOutput() string
- func (s *GrafanaConfig) GetMonitoredFolders() []string
- func (s *GrafanaConfig) GetPath(r ResourceType) string
- func (s *GrafanaConfig) GetTeamOutput() string
- func (s *GrafanaConfig) GetUserOutput() string
- type GrafanaDataSource
- type MatchingRule
- type RegexMatchesList
- type ResourceType
Constants ¶
const ( UserResource = "users" TeamResource = "teams" DashboardResource = "dashboards" DataSourceResource = "datasources" FolderResource = "folders" FolderPermissionResource = "folders-permissions" AlertNotificationResource = "alertnotifications" LibraryElementResource = "libraryelements" )
Variables ¶
This section is empty.
Functions ¶
func InitConfig ¶
func InitConfig(override, defaultConfig string)
Types ¶
type AppConfig ¶ added in v0.4.5
type AppConfig struct {
ContextName string `mapstructure:"context_name" yaml:"context_name"`
StorageEngine map[string]map[string]string `mapstructure:"storage_engine" yaml:"storage_engine"`
Contexts map[string]*GrafanaConfig `mapstructure:"contexts" yaml:"contexts"`
Global *AppGlobals `mapstructure:"global" yaml:"global"`
}
func (*AppConfig) GetContext ¶ added in v0.4.5
func (*AppConfig) GetContextMap ¶ added in v0.4.5
Temporary function
func (*AppConfig) GetContexts ¶ added in v0.4.5
func (app *AppConfig) GetContexts() map[string]*GrafanaConfig
type AppGlobals ¶ added in v0.4.5
type Configuration ¶
type Configuration struct {
AppConfig *AppConfig
// contains filtered or unexported fields
}
func Config ¶
func Config() *Configuration
func (*Configuration) ChangeContext ¶ added in v0.4.5
func (s *Configuration) ChangeContext(name string)
ChangeContext
func (*Configuration) ClearContexts ¶ added in v0.4.5
func (s *Configuration) ClearContexts()
func (*Configuration) CopyContext ¶ added in v0.4.5
func (s *Configuration) CopyContext(src, dest string)
CopyContext Makes a copy of the specified context and write to disk
func (*Configuration) DeleteContext ¶ added in v0.4.5
func (s *Configuration) DeleteContext(name string)
DeleteContext remove a given context
func (*Configuration) GetAppConfig ¶ added in v0.4.5
func (s *Configuration) GetAppConfig() *AppConfig
func (*Configuration) GetCloudConfiguration ¶ added in v0.4.5
func (s *Configuration) GetCloudConfiguration(configName string) (string, map[string]string)
GetCloudConfiguration Returns storage type and configuration
func (*Configuration) GetContexts ¶ added in v0.4.5
func (s *Configuration) GetContexts() map[string]*GrafanaConfig
GetContexts returns map of all contexts
func (*Configuration) GetDefaultGrafanaConfig ¶ added in v0.4.5
func (s *Configuration) GetDefaultGrafanaConfig() *GrafanaConfig
GetDefaultGrafanaConfig returns the default aka. selected grafana config
func (*Configuration) IgnoreSSL ¶
func (s *Configuration) IgnoreSSL() bool
IgnoreSSL returns true if SSL errors should be ignored
func (*Configuration) IsDebug ¶
func (s *Configuration) IsDebug() bool
IsDebug returns true if debug mode is enabled
func (*Configuration) NewContext ¶ added in v0.4.5
func (s *Configuration) NewContext(name string)
func (*Configuration) PrintContext ¶ added in v0.4.5
func (s *Configuration) PrintContext(name string)
func (*Configuration) SaveToDisk ¶ added in v0.4.5
func (s *Configuration) SaveToDisk(useViper bool) error
SaveToDisk Persists current configuration to disk
func (*Configuration) ViperConfig ¶
func (s *Configuration) ViperConfig() *viper.Viper
ViperConfig returns the loaded configuration via a viper reference
type CredentialRule ¶
type CredentialRule struct {
RegexMatchesList
Auth *GrafanaDataSource `yaml:"auth,omitempty"`
}
type DataSourceFilters ¶
type DataSourceSettings ¶
type DataSourceSettings struct {
FilterRules []MatchingRule `yaml:"exclude_filters,omitempty"`
MatchingRules []RegexMatchesList `yaml:"credential_rules,omitempty"`
}
func (*DataSourceSettings) FiltersEnabled ¶
func (ds *DataSourceSettings) FiltersEnabled() bool
func (*DataSourceSettings) GetCredentials ¶
func (ds *DataSourceSettings) GetCredentials(dataSourceName models.AddDataSourceCommand) (*GrafanaDataSource, error)
func (*DataSourceSettings) IsExcluded ¶
func (ds *DataSourceSettings) IsExcluded(item interface{}) bool
type FilterOverrides ¶
type FilterOverrides struct {
IgnoreDashboardFilters bool `yaml:"ignore_dashboard_filters"`
}
type GrafanaConfig ¶
type GrafanaConfig struct {
Storage string `yaml:"storage"`
AdminEnabled bool `yaml:"-"`
URL string `yaml:"url"`
APIToken string `yaml:"token"`
UserName string `yaml:"user_name"`
Password string `yaml:"password"`
Organization string `yaml:"organization"`
MonitoredFolders []string `yaml:"watched"`
DataSourceSettings *DataSourceSettings `yaml:"datasources"`
FilterOverrides *FilterOverrides `yaml:"filter_override"`
OutputPath string `yaml:"output_path"`
}
GrafanaConfig model wraps auth and watched list for grafana
func (*GrafanaConfig) GetAlertNotificationOutput ¶
func (s *GrafanaConfig) GetAlertNotificationOutput() string
func (*GrafanaConfig) GetCredentials ¶
func (s *GrafanaConfig) GetCredentials(dataSourceName models.AddDataSourceCommand) (*GrafanaDataSource, error)
GetCredentials return credentials for a given datasource or falls back on default value
func (*GrafanaConfig) GetDashboardOutput ¶
func (s *GrafanaConfig) GetDashboardOutput() string
func (*GrafanaConfig) GetDataSourceOutput ¶
func (s *GrafanaConfig) GetDataSourceOutput() string
func (*GrafanaConfig) GetDataSourceSettings ¶
func (s *GrafanaConfig) GetDataSourceSettings() *DataSourceSettings
func (*GrafanaConfig) GetFilterOverrides ¶
func (s *GrafanaConfig) GetFilterOverrides() *FilterOverrides
func (*GrafanaConfig) GetFolderOutput ¶
func (s *GrafanaConfig) GetFolderOutput() string
func (*GrafanaConfig) GetMonitoredFolders ¶
func (s *GrafanaConfig) GetMonitoredFolders() []string
GetMonitoredFolders return a list of the monitored folders alternatively returns the "General" folder.
func (*GrafanaConfig) GetPath ¶
func (s *GrafanaConfig) GetPath(r ResourceType) string
func (*GrafanaConfig) GetTeamOutput ¶
func (s *GrafanaConfig) GetTeamOutput() string
func (*GrafanaConfig) GetUserOutput ¶
func (s *GrafanaConfig) GetUserOutput() string
type GrafanaDataSource ¶
GrafanaDataSource Default datasource credentials
type MatchingRule ¶
type RegexMatchesList ¶
type RegexMatchesList struct {
Rules []MatchingRule `yaml:"rules,omitempty"`
Auth *GrafanaDataSource `yaml:"auth,omitempty"`
}
type ResourceType ¶
type ResourceType string
func (*ResourceType) GetPath ¶
func (s *ResourceType) GetPath(basePath string) string
func (*ResourceType) String ¶
func (s *ResourceType) String() string