Documentation
¶
Index ¶
- Constants
- Variables
- func CreateDestinationPath(v string)
- func GetSlug(title string) string
- type ApiService
- type BaseFilter
- type CloudStorage
- type ContextStorage
- type DashNGoImpl
- func (s *DashNGoImpl) AdminLogin() *sdk.Client
- func (s *DashNGoImpl) DeleteAllAlertNotifications() []string
- func (s *DashNGoImpl) DeleteAllDashboards(filter Filter) []string
- func (s *DashNGoImpl) DeleteAllDataSources(filter Filter) []string
- func (s *DashNGoImpl) DeleteAllFolder(filter Filter) []string
- func (s *DashNGoImpl) DeleteAllUsers() []string
- func (s *DashNGoImpl) ExportAlertNotifications() []string
- func (s *DashNGoImpl) ExportDashboards(filters Filter)
- func (s *DashNGoImpl) ExportDataSources(filter Filter) []string
- func (s *DashNGoImpl) ExportFolder(filter Filter) []string
- func (s *DashNGoImpl) ExportUsers() []sdk.User
- func (s *DashNGoImpl) GetServerInfo() map[string]interface{}
- func (s *DashNGoImpl) ImportAlertNotifications() []string
- func (s *DashNGoImpl) ImportDashboards(filter Filter) []string
- func (s *DashNGoImpl) ImportDataSources(filter Filter) []string
- func (s *DashNGoImpl) ImportFolder(filter Filter) []string
- func (s *DashNGoImpl) ImportUsers() []string
- func (s *DashNGoImpl) ListAlertNotifications() []sdk.AlertNotification
- func (s *DashNGoImpl) ListDashboards(filters Filter) []sdk.FoundBoard
- func (s *DashNGoImpl) ListDataSources(filter Filter) []sdk.Datasource
- func (s *DashNGoImpl) ListFolder(filter Filter) []sdk.Folder
- func (s *DashNGoImpl) ListOrganizations() []sdk.Org
- func (s *DashNGoImpl) ListUsers() []sdk.User
- func (s *DashNGoImpl) Login() *sdk.Client
- func (s *DashNGoImpl) PromoteUser(userLogin string) (*sdk.StatusMessage, error)
- func (s *DashNGoImpl) SetStorage(v Storage)
- type DashboardFilter
- type DatasourceFilter
- type Filter
- type LocalStorage
- type Storage
Constants ¶
const ( TagsFilter = "TagsFilter" DashFilter = "DashFilter" FolderFilter = "FolderFilter" Name = "Name" )
Currently supported filters
const ( CloudType = "cloud_type" BucketName = "bucket_name" Prefix = "prefix" )
const StorageContext = ContextStorage("storage")
Variables ¶
var DefaultFolderName = "General"
Functions ¶
func CreateDestinationPath ¶
func CreateDestinationPath(v string)
CreateDestinationPath Handle osMkdir Errors
Types ¶
type ApiService ¶
type ApiService interface {
//Organizations
ListOrganizations() []sdk.Org
//Dashboard
ListDashboards(filter Filter) []sdk.FoundBoard
ImportDashboards(filter Filter) []string
ExportDashboards(filter Filter)
DeleteAllDashboards(filter Filter) []string
//DataSources
ListDataSources(filter Filter) []sdk.Datasource
ImportDataSources(filter Filter) []string
ExportDataSources(filter Filter) []string
DeleteAllDataSources(filter Filter) []string
//AlertNotifications
ListAlertNotifications() []sdk.AlertNotification
ImportAlertNotifications() []string
ExportAlertNotifications() []string
DeleteAllAlertNotifications() []string
//Login
Login() *sdk.Client
AdminLogin() *sdk.Client
//User
ListUsers() []sdk.User
ImportUsers() []string
ExportUsers() []sdk.User
PromoteUser(userLogin string) (*sdk.StatusMessage, error)
DeleteAllUsers() []string
//MetaData
GetServerInfo() map[string]interface{}
//Folder
ListFolder(filter Filter) []sdk.Folder
ImportFolder(filter Filter) []string
ExportFolder(filter Filter) []string
DeleteAllFolder(filter Filter) []string
}
func NewApiService ¶
func NewApiService(override ...string) ApiService
type BaseFilter ¶
func (BaseFilter) AddFilter ¶
func (s BaseFilter) AddFilter(key, value string)
AddFilter adds a filter and the corresponding value
func (BaseFilter) GetFilter ¶
func (s BaseFilter) GetFilter(key string) string
GetFilter returns the value of the filter
func (BaseFilter) GetTypes ¶
func (s BaseFilter) GetTypes() []string
GetTypes returns all the current keys for the configured Filter
func (*BaseFilter) Init ¶
func (s *BaseFilter) Init()
type CloudStorage ¶
type CloudStorage struct {
Location stow.Location
BucketName string
BucketRef stow.Container
Prefix string
StorageName string
}
func (CloudStorage) FindAllFiles ¶
func (s CloudStorage) FindAllFiles(folder string, fullPath bool) ([]string, error)
func (CloudStorage) Name ¶
func (s CloudStorage) Name() string
type ContextStorage ¶
type ContextStorage string
type DashNGoImpl ¶
type DashNGoImpl struct {
// contains filtered or unexported fields
}
func NewDashNGoImpl ¶
func NewDashNGoImpl() *DashNGoImpl
func (*DashNGoImpl) AdminLogin ¶
func (s *DashNGoImpl) AdminLogin() *sdk.Client
func (*DashNGoImpl) DeleteAllAlertNotifications ¶
func (s *DashNGoImpl) DeleteAllAlertNotifications() []string
Removes all current alert notification channels
func (*DashNGoImpl) DeleteAllDashboards ¶
func (s *DashNGoImpl) DeleteAllDashboards(filter Filter) []string
DeleteAllDashboards clears all current dashboards being monitored. Any folder not white listed will not be affected
func (*DashNGoImpl) DeleteAllDataSources ¶
func (s *DashNGoImpl) DeleteAllDataSources(filter Filter) []string
Removes all current datasources
func (*DashNGoImpl) DeleteAllFolder ¶
func (s *DashNGoImpl) DeleteAllFolder(filter Filter) []string
func (*DashNGoImpl) ExportAlertNotifications ¶
func (s *DashNGoImpl) ExportAlertNotifications() []string
ExportAlertNotifications: exports all alert notification channels to grafana. NOTE: credentials will be missing and need to be set manually after export TODO implement configuring sensitive fields for different kinds of alert notification channels
func (*DashNGoImpl) ExportDashboards ¶
func (s *DashNGoImpl) ExportDashboards(filters Filter)
ExportDashboards finds all the dashboards in the configured location and exports them to grafana. if the folder doesn't exist, it'll be created.
func (*DashNGoImpl) ExportDataSources ¶
func (s *DashNGoImpl) ExportDataSources(filter Filter) []string
ExportDataSources: exports all datasources to grafana using the credentials configured in config file.
func (*DashNGoImpl) ExportFolder ¶
func (s *DashNGoImpl) ExportFolder(filter Filter) []string
func (*DashNGoImpl) ExportUsers ¶
func (s *DashNGoImpl) ExportUsers() []sdk.User
func (*DashNGoImpl) GetServerInfo ¶
func (s *DashNGoImpl) GetServerInfo() map[string]interface{}
GetServerInfo returns basic Grafana Server info
func (*DashNGoImpl) ImportAlertNotifications ¶
func (s *DashNGoImpl) ImportAlertNotifications() []string
ImportAlertNotifications: will read in all the configured alert notification channels.
func (*DashNGoImpl) ImportDashboards ¶
func (s *DashNGoImpl) ImportDashboards(filter Filter) []string
ImportDashboards saves all dashboards matching query to configured location
func (*DashNGoImpl) ImportDataSources ¶
func (s *DashNGoImpl) ImportDataSources(filter Filter) []string
ImportDataSources: will read in all the configured datasources. NOTE: credentials cannot be retrieved and need to be set via configuration
func (*DashNGoImpl) ImportFolder ¶
func (s *DashNGoImpl) ImportFolder(filter Filter) []string
func (*DashNGoImpl) ImportUsers ¶
func (s *DashNGoImpl) ImportUsers() []string
func (*DashNGoImpl) ListAlertNotifications ¶
func (s *DashNGoImpl) ListAlertNotifications() []sdk.AlertNotification
func (*DashNGoImpl) ListDashboards ¶
func (s *DashNGoImpl) ListDashboards(filters Filter) []sdk.FoundBoard
ListDashboards List all dashboards optionally filtered by folder name. If folderFilters is blank, defaults to the configured Monitored folders
func (*DashNGoImpl) ListDataSources ¶
func (s *DashNGoImpl) ListDataSources(filter Filter) []sdk.Datasource
ListDataSources: list all the currently configured datasources
func (*DashNGoImpl) ListFolder ¶
func (s *DashNGoImpl) ListFolder(filter Filter) []sdk.Folder
func (*DashNGoImpl) ListOrganizations ¶
func (s *DashNGoImpl) ListOrganizations() []sdk.Org
ListOrganizations: List all dashboards
func (*DashNGoImpl) ListUsers ¶
func (s *DashNGoImpl) ListUsers() []sdk.User
ListUsers list all grafana users
func (*DashNGoImpl) Login ¶
func (s *DashNGoImpl) Login() *sdk.Client
Login: Logs into grafana returning a client instance using Token or Basic Auth
func (*DashNGoImpl) PromoteUser ¶
func (s *DashNGoImpl) PromoteUser(userLogin string) (*sdk.StatusMessage, error)
PromoteUser promote the user to have Admin Access
type DashboardFilter ¶
type DashboardFilter struct {
BaseFilter
// contains filtered or unexported fields
}
func NewDashboardFilter ¶
func NewDashboardFilter() *DashboardFilter
NewDashboardFilter creates a new dashboard filter
func (*DashboardFilter) GetFolders ¶
func (s *DashboardFilter) GetFolders() []string
GetFolders splits the comma delimited folder list and returns a slice
func (*DashboardFilter) GetTags ¶
func (s *DashboardFilter) GetTags() []string
GetTags returns a list of all tags to filter on
type DatasourceFilter ¶
type DatasourceFilter struct {
BaseFilter
}
func (DatasourceFilter) GetFolders ¶
func (s DatasourceFilter) GetFolders() []string
GetFolders return empty list since Folders NA for datasources
func (DatasourceFilter) GetTags ¶
func (s DatasourceFilter) GetTags() []string
GetTags return empty list since Tags NA for datasources
type Filter ¶
type Filter interface {
GetTypes() []string //Return list of active Filter Types
GetFilter(key string) string //Get the Filter value
AddFilter(key, value string) //Add a filter query
Validate(items map[string]string) bool //Validate if Entry is valid
GetFolders() []string //List of supported folders if Any
GetTags() []string //List of tags
}
type LocalStorage ¶
type LocalStorage struct {
}
LocalStorage default storage engine
func (*LocalStorage) FindAllFiles ¶
func (s *LocalStorage) FindAllFiles(folder string, fullPath bool) ([]string, error)
func (LocalStorage) Name ¶
func (LocalStorage) Name() string
type Storage ¶
type Storage interface {
WriteFile(filename string, data []byte, mode fs.FileMode) error // WriteFile returns error or writes byte array to destination
ReadFile(filename string) ([]byte, error) // ReadFile returns byte array or error with data from file
FindAllFiles(folder string, fullPath bool) ([]string, error) // FindAllFiles recursively list all files for a given path
Name() string // Name of storage engine
}
TODO: pull all the cloud based interaction into a Plugin System