Documentation ¶
Index ¶
- Variables
- type DashboardProvisioner
- type DashboardProvisionerFactory
- type FileReader
- type Provisioner
- func (provider *Provisioner) CleanUpOrphanedDashboards(ctx context.Context)
- func (provider *Provisioner) GetAllowUIUpdatesFromConfig(name string) bool
- func (provider *Provisioner) GetProvisionerResolvedPath(name string) string
- func (provider *Provisioner) PollChanges(ctx context.Context)
- func (provider *Provisioner) Provision(ctx context.Context) error
- type ProvisionerMock
- func (dpm *ProvisionerMock) CleanUpOrphanedDashboards(ctx context.Context)
- func (dpm *ProvisionerMock) GetAllowUIUpdatesFromConfig(name string) bool
- func (dpm *ProvisionerMock) GetProvisionerResolvedPath(name string) string
- func (dpm *ProvisionerMock) PollChanges(ctx context.Context)
- func (dpm *ProvisionerMock) Provision(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrFolderNameMissing is returned when folder name is missing. ErrFolderNameMissing = errors.New("folder name missing") )
Functions ¶
This section is empty.
Types ¶
type DashboardProvisioner ¶
type DashboardProvisioner interface { Provision(ctx context.Context) error PollChanges(ctx context.Context) GetProvisionerResolvedPath(name string) string GetAllowUIUpdatesFromConfig(name string) bool CleanUpOrphanedDashboards(ctx context.Context) }
DashboardProvisioner is responsible for syncing dashboard from disk to Grafana's database.
func New ¶
func New(ctx context.Context, configDirectory string, store dashboards.Store) (DashboardProvisioner, error)
New returns a new DashboardProvisioner
type DashboardProvisionerFactory ¶
type DashboardProvisionerFactory func(context.Context, string, dashboards.Store) (DashboardProvisioner, error)
DashboardProvisionerFactory creates DashboardProvisioners based on input
type FileReader ¶
type FileReader struct { Cfg *config Path string FoldersFromFilesStructure bool // contains filtered or unexported fields }
FileReader is responsible for reading dashboards from disk and insert/update dashboards to the Grafana database using `dashboards.DashboardProvisioningService`.
func NewDashboardFileReader ¶
NewDashboardFileReader returns a new filereader based on `config`
type Provisioner ¶
type Provisioner struct {
// contains filtered or unexported fields
}
Provisioner is responsible for syncing dashboard from disk to Grafana's database.
func (*Provisioner) CleanUpOrphanedDashboards ¶
func (provider *Provisioner) CleanUpOrphanedDashboards(ctx context.Context)
CleanUpOrphanedDashboards deletes provisioned dashboards missing a linked reader.
func (*Provisioner) GetAllowUIUpdatesFromConfig ¶
func (provider *Provisioner) GetAllowUIUpdatesFromConfig(name string) bool
GetAllowUIUpdatesFromConfig return if a dashboard provisioner allows updates from the UI
func (*Provisioner) GetProvisionerResolvedPath ¶
func (provider *Provisioner) GetProvisionerResolvedPath(name string) string
GetProvisionerResolvedPath returns resolved path for the specified provisioner name. Can be used to generate relative path to provisioning file from it's external_id.
func (*Provisioner) PollChanges ¶
func (provider *Provisioner) PollChanges(ctx context.Context)
PollChanges starts polling for changes in dashboard definition files. It creates a goroutine for each provider defined in the config.
type ProvisionerMock ¶
type ProvisionerMock struct { Calls *calls ProvisionFunc func(ctx context.Context) error PollChangesFunc func(ctx context.Context) GetProvisionerResolvedPathFunc func(name string) string GetAllowUIUpdatesFromConfigFunc func(name string) bool }
ProvisionerMock is a mock implementation of `Provisioner`
func NewDashboardProvisionerMock ¶
func NewDashboardProvisionerMock() *ProvisionerMock
NewDashboardProvisionerMock returns a new dashboardprovisionermock
func (*ProvisionerMock) CleanUpOrphanedDashboards ¶
func (dpm *ProvisionerMock) CleanUpOrphanedDashboards(ctx context.Context)
CleanUpOrphanedDashboards not implemented for mocks
func (*ProvisionerMock) GetAllowUIUpdatesFromConfig ¶
func (dpm *ProvisionerMock) GetAllowUIUpdatesFromConfig(name string) bool
GetAllowUIUpdatesFromConfig is a mock implementation of `Provisioner.GetAllowUIUpdatesFromConfig`
func (*ProvisionerMock) GetProvisionerResolvedPath ¶
func (dpm *ProvisionerMock) GetProvisionerResolvedPath(name string) string
GetProvisionerResolvedPath is a mock implementation of `Provisioner.GetProvisionerResolvedPath`
func (*ProvisionerMock) PollChanges ¶
func (dpm *ProvisionerMock) PollChanges(ctx context.Context)
PollChanges is a mock implementation of `Provisioner.PollChanges`