Documentation
¶
Index ¶
- Constants
- func InitGdgConfig(override 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) DefaultConfig() 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() *viper.Viper
- func (s *Configuration) IgnoreSSL() bool
- func (s *Configuration) IsApiDebug() 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 DashboardSettings
- type GDGAppConfiguration
- type GrafanaConfig
- func (s *GrafanaConfig) GetCredentials(dataSourceName models.AddDataSourceCommand, location string) (*GrafanaConnection, error)
- func (s *GrafanaConfig) GetDashboardSettings() *DashboardSettings
- func (s *GrafanaConfig) GetDataSourceSettings() *ConnectionSettings
- func (s *GrafanaConfig) GetMonitoredFolders() []string
- func (s *GrafanaConfig) GetOrgMonitoredFolders(orgName string) []string
- func (s *GrafanaConfig) GetOrganizationName() string
- func (s *GrafanaConfig) GetPath(r ResourceType) string
- func (s *GrafanaConfig) GetUserSettings() *UserSettings
- func (s *GrafanaConfig) IsBasicAuth() bool
- func (s *GrafanaConfig) IsGrafanaAdmin() bool
- func (s *GrafanaConfig) SetGrafanaAdmin(admin bool)
- func (s *GrafanaConfig) Validate()
- type GrafanaConnection
- type MatchingRule
- type MonitoredOrgFolders
- type Provider
- type RegexMatchesList
- type ResourceType
- type TemplateDashboardEntity
- type TemplateDashboards
- type TemplateEntities
- type TemplatingConfig
- type UserSettings
Constants ¶
const ( ViperGdgConfig = "gdg" ViperTemplateConfig = "template" DefaultOrganizationName = "Main Org." DefaultOrganizationId = 1 )
Variables ¶
This section is empty.
Functions ¶
func InitGdgConfig ¶ added in v0.6.0
func InitGdgConfig(override 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"` ApiDebug bool `mapstructure:"api_debug" yaml:"api_debug"` IgnoreSSLErrors bool `mapstructure:"ignore_ssl_errors" yaml:"ignore_ssl_errors"` RetryCount int `mapstructure:"retry_count" yaml:"retry_count"` RetryDelay string `mapstructure:"retry_delay" yaml:"retry_delay"` ClearOutput bool `mapstructure:"clear_output" yaml:"clear_output"` // contains filtered or unexported fields }
AppGlobals is the global configuration for the application
func (*AppGlobals) GetRetryTimeout ¶ added in v0.6.0
func (app *AppGlobals) GetRetryTimeout() time.Duration
GetRetryTimeout returns 100ms, by default otherwise the parsed value
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) DefaultConfig ¶ added in v0.7.2
func (s *Configuration) DefaultConfig() string
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() *viper.Viper
func (*Configuration) IgnoreSSL ¶
func (s *Configuration) IgnoreSSL() bool
IgnoreSSL returns true if SSL errors should be ignored
func (*Configuration) IsApiDebug ¶ added in v0.7.1
func (s *Configuration) IsApiDebug() bool
IsApiDebug returns true if debug mode is enabled for APIs
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" mapstructure:"name_exclusions"` ConnectionTypes []string `yaml:"valid_types" mapstructure:"valid_types"` }
ConnectionFilters model wraps connection filters for grafana
type ConnectionSettings ¶ added in v0.5.0
type ConnectionSettings struct { FilterRules []MatchingRule `mapstructure:"filters" yaml:"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 DashboardSettings ¶ added in v0.7.1
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) GetAppGlobals ¶ added in v0.6.0
func (app *GDGAppConfiguration) GetAppGlobals() *AppGlobals
func (*GDGAppConfiguration) GetContext ¶ added in v0.5.2
func (app *GDGAppConfiguration) GetContext() string
func (*GDGAppConfiguration) GetContexts ¶ added in v0.5.2
func (app *GDGAppConfiguration) GetContexts() map[string]*GrafanaConfig
type GrafanaConfig ¶
type GrafanaConfig struct { APIToken string `mapstructure:"token" yaml:"token"` ConnectionSettings *ConnectionSettings `mapstructure:"connections" yaml:"connections"` DashboardSettings *DashboardSettings `mapstructure:"dashboard_settings" yaml:"dashboard_settings"` MonitoredFolders []string `mapstructure:"watched" yaml:"watched"` MonitoredFoldersOverride []MonitoredOrgFolders `mapstructure:"watched_folders_override" yaml:"watched_folders_override"` OrganizationName string `mapstructure:"organization_name" yaml:"organization_name"` OutputPath string `mapstructure:"output_path" yaml:"output_path"` Password string `mapstructure:"password" yaml:"password"` Storage string `mapstructure:"storage" yaml:"storage"` URL string `mapstructure:"url" yaml:"url"` UserName string `mapstructure:"user_name" yaml:"user_name"` UserSettings *UserSettings `mapstructure:"user" yaml:"user"` // 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) GetDashboardSettings ¶ added in v0.7.1
func (s *GrafanaConfig) GetDashboardSettings() *DashboardSettings
func (*GrafanaConfig) GetDataSourceSettings ¶
func (s *GrafanaConfig) GetDataSourceSettings() *ConnectionSettings
GetDataSourceSettings returns the datasource settings 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(orgName string) []string
GetOrgMonitoredFolders return the OrganizationMonitoredFolders that override a given Org
func (*GrafanaConfig) GetOrganizationName ¶ added in v0.6.0
func (s *GrafanaConfig) GetOrganizationName() string
GetOrganizationName 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) GetUserSettings ¶ added in v0.6.0
func (s *GrafanaConfig) GetUserSettings() *UserSettings
GetUserSettings returns configured UserSettings
func (*GrafanaConfig) IsBasicAuth ¶ added in v0.5.0
func (s *GrafanaConfig) IsBasicAuth() bool
IsBasicAuth returns true if user has basic auth enabled
func (*GrafanaConfig) IsGrafanaAdmin ¶ added in v0.6.0
func (s *GrafanaConfig) IsGrafanaAdmin() bool
IsGrafanaAdmin returns true if the admin is set, represents a GrafanaAdmin
func (*GrafanaConfig) SetGrafanaAdmin ¶ added in v0.6.0
func (s *GrafanaConfig) SetGrafanaAdmin(admin bool)
SetGrafanaAdmin 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" mapstructure:"field,omitempty"` Regex string `yaml:"regex,omitempty" mapstructure:"regex,omitempty"` Inclusive bool `yaml:"inclusive,omitempty" mapstructure:"inclusive,omitempty"` }
MatchingRule defines a single matching rule for Grafana Connections
type MonitoredOrgFolders ¶ added in v0.5.1
type Provider ¶ added in v0.7.2
type Provider func() *Configuration
type RegexMatchesList ¶
type RegexMatchesList struct { Rules []MatchingRule `mapstructure:"rules" yaml:"rules,omitempty"` SecureData string `mapstructure:"secure_data" yaml:"secure_data,omitempty"` }
RegexMatchesList model wraps regex matches list for grafana
func (RegexMatchesList) GetConnectionAuth ¶ added in v0.6.0
func (r RegexMatchesList) GetConnectionAuth(path string) (*GrafanaConnection, error)
type ResourceType ¶
type ResourceType string
const ( ConnectionPermissionResource ResourceType = "connections-permissions" ConnectionResource ResourceType = "connections" DashboardPermissionsResource ResourceType = "dashboards-permissions" DashboardResource ResourceType = "dashboards" FolderPermissionResource ResourceType = "folders-permissions" FolderResource ResourceType = "folders" LibraryElementResource ResourceType = "libraryelements" OrganizationResource ResourceType = "organizations" OrganizationMetaResource ResourceType = "org" TeamResource ResourceType = "teams" UserResource ResourceType = "users" TemplatesResource ResourceType = "templates" SecureSecretsResource ResourceType = "secure" AlertingResource ResourceType = "alerting" )
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)
type UserSettings ¶ added in v0.6.0
type UserSettings struct { RandomPassword bool `mapstructure:"random_password" yaml:"random_password"` MinLength int `mapstructure:"min_length" yaml:"min_length"` MaxLength int `mapstructure:"max_length" yaml:"max_length"` }
func (*UserSettings) GetPassword ¶ added in v0.6.0
func (u *UserSettings) GetPassword(username string) string