Documentation
¶
Index ¶
- Constants
- func InitConfig(override, defaultConfig string)
- func InitTemplateConfig(override string)
- 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) GetCloudConfiguration(configName string) (string, map[string]string)
- func (s *Configuration) GetContexts() map[string]*GrafanaConfig
- func (s *Configuration) GetDefaultGrafanaConfig() *GrafanaConfig
- func (s *Configuration) GetGDGConfig() *GDGAppConfiguration
- func (s *Configuration) GetTemplateConfig() *TemplatingConfig
- func (s *Configuration) GetViperConfig(name string) *viper.Viper
- 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
- type ConnectionFilters
- type ConnectionSettings
- type CredentialRule
- type FilterOverrides
- type GDGAppConfiguration
- type GrafanaConfig
- func (s *GrafanaConfig) GetCredentials(dataSourceName models.AddDataSourceCommand, location string) (*GrafanaConnection, error)
- func (s *GrafanaConfig) GetDataSourceSettings() *ConnectionSettings
- func (s *GrafanaConfig) GetFilterOverrides() *FilterOverrides
- func (s *GrafanaConfig) GetMonitoredFolders() []string
- func (s *GrafanaConfig) GetOrgMonitoredFolders(orgId int64) []string
- func (s *GrafanaConfig) GetOrganizationId() int64
- func (s *GrafanaConfig) GetPath(r ResourceType) string
- func (s *GrafanaConfig) IsAdminEnabled() bool
- func (s *GrafanaConfig) IsBasicAuth() bool
- func (s *GrafanaConfig) IsEnterprise() bool
- func (s *GrafanaConfig) SetAdmin(admin bool)
- func (s *GrafanaConfig) Validate()
- type GrafanaConnection
- type MatchingRule
- type MonitoredOrgFolders
- type RegexMatchesList
- type ResourceType
- type TemplateDashboardEntity
- type TemplateDashboards
- type TemplateEntities
- type TemplatingConfig
Constants ¶
const ( AlertNotificationResource = "alertnotifications" ConnectionPermissionResource = "connections-permissions" ConnectionResource = "connections" LegacyConnections = "datasources" DashboardResource = "dashboards" FolderPermissionResource = "folders-permissions" FolderResource = "folders" LibraryElementResource = "libraryelements" OrganizationResource = "organizations" OrganizationMetaResource = "org" TeamResource = "teams" UserResource = "users" TemplatesResource = "templates" SecureSecretsResource = "secure" )
const ( ViperGdgConfig = "gdg" ViperTemplateConfig = "template" )
Variables ¶
This section is empty.
Functions ¶
func InitConfig ¶
func InitConfig(override, defaultConfig string)
func InitTemplateConfig ¶ added in v0.5.2
func InitTemplateConfig(override string)
Types ¶
type AppGlobals ¶ added in v0.4.5
type AppGlobals struct {
Debug bool `mapstructure:"debug" yaml:"debug"`
IgnoreSSLErrors bool `mapstructure:"ignore_ssl_errors" yaml:"ignore_ssl_errors"`
}
AppGlobals is the global configuration for the application
type Configuration ¶
type Configuration struct {
// 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 changes active context
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) 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) GetGDGConfig ¶ added in v0.5.2
func (s *Configuration) GetGDGConfig() *GDGAppConfiguration
GetGDGConfig return instance of gdg app configuration
func (*Configuration) GetTemplateConfig ¶ added in v0.5.2
func (s *Configuration) GetTemplateConfig() *TemplatingConfig
GetTemplateConfig return instance of gdg app configuration
func (*Configuration) GetViperConfig ¶ added in v0.5.2
func (s *Configuration) GetViperConfig(name string) *viper.Viper
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
type ConnectionFilters ¶ added in v0.5.0
type ConnectionFilters struct {
NameExclusions string `yaml:"name_exclusions"`
ConnectionTypes []string `yaml:"valid_types"`
}
ConnectionFilters model wraps connection filters for grafana
type ConnectionSettings ¶ added in v0.5.0
type ConnectionSettings struct {
FilterRules []MatchingRule `mapstructure:"exclude_filters" yaml:"exclude_filters,omitempty"`
MatchingRules []RegexMatchesList `mapstructure:"credential_rules" yaml:"credential_rules,omitempty"`
}
ConnectionSettings contains Filters and Matching Rules for Grafana
func (*ConnectionSettings) FiltersEnabled ¶ added in v0.5.0
func (ds *ConnectionSettings) FiltersEnabled() bool
FiltersEnabled returns true if the filters are enabled for the resource type
func (*ConnectionSettings) GetCredentials ¶ added in v0.5.0
func (ds *ConnectionSettings) GetCredentials(connectionEntity models.AddDataSourceCommand, path string) (*GrafanaConnection, error)
GetCredentials returns the credentials for the connection
func (*ConnectionSettings) IsExcluded ¶ added in v0.5.0
func (ds *ConnectionSettings) IsExcluded(item interface{}) bool
IsExcluded returns true if the item should be excluded from the connection List
type CredentialRule ¶
type CredentialRule struct {
RegexMatchesList
Auth *GrafanaConnection `mapstructure:"auth" yaml:"auth,omitempty"`
}
CredentialRule model wraps regex and auth for grafana
type FilterOverrides ¶
type FilterOverrides struct {
IgnoreDashboardFilters bool `yaml:"ignore_dashboard_filters"`
}
FilterOverrides model wraps filter overrides for grafana
type GDGAppConfiguration ¶ added in v0.5.2
type GDGAppConfiguration 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"`
}
GDGAppConfiguration is the configuration for the application
func (*GDGAppConfiguration) GetContext ¶ added in v0.5.2
func (app *GDGAppConfiguration) GetContext() string
func (*GDGAppConfiguration) GetContextMap ¶ added in v0.5.2
func (app *GDGAppConfiguration) GetContextMap() map[string]interface{}
Temporary function
func (*GDGAppConfiguration) GetContexts ¶ added in v0.5.2
func (app *GDGAppConfiguration) GetContexts() map[string]*GrafanaConfig
type GrafanaConfig ¶
type GrafanaConfig struct {
Storage string `mapstructure:"storage" yaml:"storage"`
EnterpriseSupport bool `mapstructure:"enterprise_support" yaml:"enterprise_support"`
URL string `mapstructure:"url" yaml:"url"`
APIToken string `mapstructure:"token" yaml:"token"`
UserName string `mapstructure:"user_name" yaml:"user_name"`
Password string `mapstructure:"password" yaml:"password"`
OrganizationId int64 `mapstructure:"organization_id" yaml:"organization_id"`
MonitoredFoldersOverride []MonitoredOrgFolders `mapstructure:"watched_folders_override" yaml:"watched_folders_override"`
MonitoredFolders []string `mapstructure:"watched" yaml:"watched"`
ConnectionSettings *ConnectionSettings `mapstructure:"connections" yaml:"connections"`
//Datasources are deprecated, please use Connections
LegacyConnectionSettings map[string]interface{} `mapstructure:"datasources" yaml:"datasources"`
FilterOverrides *FilterOverrides `mapstructure:"filter_override" yaml:"filter_override"`
OutputPath string `mapstructure:"output_path" yaml:"output_path"`
// contains filtered or unexported fields
}
GrafanaConfig model wraps auth and watched list for grafana
func (*GrafanaConfig) GetCredentials ¶
func (s *GrafanaConfig) GetCredentials(dataSourceName models.AddDataSourceCommand, location string) (*GrafanaConnection, error)
GetCredentials return credentials for a given datasource or falls back on default value
func (*GrafanaConfig) GetDataSourceSettings ¶
func (s *GrafanaConfig) GetDataSourceSettings() *ConnectionSettings
GetDataSourceSettings returns the datasource settings for the connection
func (*GrafanaConfig) GetFilterOverrides ¶
func (s *GrafanaConfig) GetFilterOverrides() *FilterOverrides
GetFilterOverrides returns the filter overrides for the connection
func (*GrafanaConfig) GetMonitoredFolders ¶
func (s *GrafanaConfig) GetMonitoredFolders() []string
GetMonitoredFolders return a list of the monitored folders alternatively returns the "General" folder.
func (*GrafanaConfig) GetOrgMonitoredFolders ¶ added in v0.5.1
func (s *GrafanaConfig) GetOrgMonitoredFolders(orgId int64) []string
GetOrgMonitoredFolders return the OrganizationMonitoredFolders that override a given Org
func (*GrafanaConfig) GetOrganizationId ¶ added in v0.5.0
func (s *GrafanaConfig) GetOrganizationId() int64
GetOrganizationId returns the id of the organization (defaults to 1 if unset)
func (*GrafanaConfig) GetPath ¶
func (s *GrafanaConfig) GetPath(r ResourceType) string
GetPath returns the path of the resource type
func (*GrafanaConfig) IsAdminEnabled ¶ added in v0.5.0
func (s *GrafanaConfig) IsAdminEnabled() bool
IsAdminEnabled returns true if the admin is set, represents a GrafanaAdmin
func (*GrafanaConfig) IsBasicAuth ¶ added in v0.5.0
func (s *GrafanaConfig) IsBasicAuth() bool
IsBasicAuth returns true if user has basic auth enabled
func (*GrafanaConfig) IsEnterprise ¶ added in v0.5.0
func (s *GrafanaConfig) IsEnterprise() bool
IsEnterprise Returns true when enterprise is enabled
func (*GrafanaConfig) SetAdmin ¶ added in v0.5.0
func (s *GrafanaConfig) SetAdmin(admin bool)
SetAdmin sets true if user has admin permissions
func (*GrafanaConfig) Validate ¶ added in v0.5.0
func (s *GrafanaConfig) Validate()
Validate will return terminate if any deprecated configuration is found.
type GrafanaConnection ¶ added in v0.5.0
GrafanaConnection Default connection credentials
func (GrafanaConnection) Password ¶ added in v0.5.0
func (g GrafanaConnection) Password() string
func (GrafanaConnection) User ¶ added in v0.5.0
func (g GrafanaConnection) User() string
type MatchingRule ¶
type MatchingRule struct {
Field string `yaml:"field,omitempty"`
Regex string `yaml:"regex,omitempty"`
Inclusive bool `yaml:"inclusive,omitempty"`
}
MatchingRule defines a single matching rule for Grafana Connections
type MonitoredOrgFolders ¶ added in v0.5.1
type RegexMatchesList ¶
type RegexMatchesList struct {
Rules []MatchingRule `mapstructure:"rules" yaml:"rules,omitempty"`
SecureData string `mapstructure:"secure_data" yaml:"secure_data,omitempty"`
LegacyAuth *GrafanaConnection `mapstructure:"auth" yaml:"auth,omitempty" json:"auth,omitempty"`
}
RegexMatchesList model wraps regex matches list for grafana
func (RegexMatchesList) GetAuth ¶ added in v0.5.2
func (r RegexMatchesList) GetAuth(path string) (*GrafanaConnection, error)
type ResourceType ¶
type ResourceType string
func (*ResourceType) GetPath ¶
func (s *ResourceType) GetPath(basePath string) string
GetPath returns the path of the resource type, if Namespaced, will delimit the path by org Id
func (*ResourceType) String ¶
func (s *ResourceType) String() string
String returns the string representation of the resource type
type TemplateDashboardEntity ¶ added in v0.5.2
type TemplateDashboards ¶ added in v0.5.2
type TemplateDashboards struct {
TemplateName string `mapstructure:"template_name"`
DashboardEntities []TemplateDashboardEntity `mapstructure:"output"`
}
type TemplateEntities ¶ added in v0.5.2
type TemplateEntities struct {
Dashboards []TemplateDashboards `mapstructure:"dashboards"`
}
type TemplatingConfig ¶ added in v0.5.2
type TemplatingConfig struct {
Entities TemplateEntities `mapstructure:"entities"`
}
func (*TemplatingConfig) GetTemplate ¶ added in v0.5.2
func (s *TemplatingConfig) GetTemplate(name string) (*TemplateDashboards, bool)