grafanadashboard

package
v3.10.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2021 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeleteDashboardByUIDUrl    = "%v/api/dashboards/uid/%v"
	CreateOrUpdateDashboardUrl = "%v/api/dashboards/db"
	CreateOrUpdateFolderUrl    = "%v/api/folders"
	DeleteFolderByUIDUrl       = "%v/api/folders/%v"
	GetFolderByIDUrl           = "%v/api/folders/id/%v"
	//TODO is this right? VV
	SearchURL = "%v/api/search?type=dash-db"
)
View Source
const (
	ControllerName = "controller_grafanadashboard"
)
View Source
const (
	NonNamespacedFolderName = "Non-Namespaced"
)

Variables

This section is empty.

Functions

func Add

func Add(mgr manager.Manager, namespace string) error

Add creates a new GrafanaDashboard Controller and adds it to the Manager. The Manager will set fields on the Controller and Start it when the Manager is Started.

Types

type DashboardPipeline

type DashboardPipeline interface {
	ProcessDashboard(knownHash string, folderId *int64, folderName string) ([]byte, error)
	NewHash() string
}

func NewDashboardPipeline

func NewDashboardPipeline(client client.Client, dashboard *v1alpha1.GrafanaDashboard, ctx context.Context) DashboardPipeline

type DashboardPipelineImpl

type DashboardPipelineImpl struct {
	Client    client.Client
	Dashboard *v1alpha1.GrafanaDashboard
	JSON      string
	Board     map[string]interface{}
	Logger    logr.Logger
	Hash      string
	Context   context.Context
}

func (*DashboardPipelineImpl) NewHash

func (r *DashboardPipelineImpl) NewHash() string

func (*DashboardPipelineImpl) ProcessDashboard

func (r *DashboardPipelineImpl) ProcessDashboard(knownHash string, folderId *int64, folderName string) ([]byte, error)

type GrafanaClient

type GrafanaClient interface {
	CreateOrUpdateDashboard(dashboard []byte, folderId int64, folderName string) (GrafanaResponse, error)
	DeleteDashboardByUID(UID string) (GrafanaResponse, error)
	CreateOrUpdateFolder(folderName string) (GrafanaFolderResponse, error)
	DeleteFolder(folderID *int64) error
	SafeToDelete(dashboards []*v1alpha1.GrafanaDashboardRef, folderID *int64) bool
}

func NewGrafanaClient

func NewGrafanaClient(url, user, password string, transport *http.Transport, timeoutSeconds time.Duration) GrafanaClient

type GrafanaClientImpl

type GrafanaClientImpl struct {
	// contains filtered or unexported fields
}

func (*GrafanaClientImpl) CreateOrUpdateDashboard

func (r *GrafanaClientImpl) CreateOrUpdateDashboard(dashboard []byte, folderID int64, folderName string) (GrafanaResponse, error)

Submit dashboard json to grafana

func (*GrafanaClientImpl) CreateOrUpdateFolder added in v3.6.0

func (r *GrafanaClientImpl) CreateOrUpdateFolder(folderInputName string) (GrafanaFolderResponse, error)

func (*GrafanaClientImpl) DeleteDashboardByUID

func (r *GrafanaClientImpl) DeleteDashboardByUID(UID string) (GrafanaResponse, error)

Delete a dashboard given by a UID

func (*GrafanaClientImpl) DeleteFolder added in v3.6.0

func (r *GrafanaClientImpl) DeleteFolder(deleteID *int64) error

func (*GrafanaClientImpl) SafeToDelete added in v3.6.0

func (r *GrafanaClientImpl) SafeToDelete(dashlist []*v1alpha1.GrafanaDashboardRef, id *int64) bool

type GrafanaFolderRequest added in v3.5.0

type GrafanaFolderRequest struct {
	Title string `json:"title"`
}

type GrafanaFolderResponse added in v3.5.0

type GrafanaFolderResponse struct {
	ID    *int64 `json:"id"`
	Title string `json:"title"`
	UID   string `json:"uid"`
}

type GrafanaRequest

type GrafanaRequest struct {
	Dashboard  json.RawMessage `json:"dashboard"`
	FolderId   int64           `json:"folderId"`
	FolderName string          `json:"folderName"`
	Overwrite  bool            `json:"overwrite"`
}

type GrafanaResponse

type GrafanaResponse struct {
	ID         *uint   `json:"id"`
	OrgID      *uint   `json:"orgId"`
	Message    *string `json:"message"`
	Slug       *string `json:"slug"`
	Version    *int    `json:"version"`
	Status     *string `json:"resp"`
	UID        *string `json:"uid"`
	URL        *string `json:"url"`
	FolderId   *int64  `json:"folderId"`
	FolderName string  `json:"folderName"`
}

type ReconcileGrafanaDashboard

type ReconcileGrafanaDashboard struct {
	// contains filtered or unexported fields
}

ReconcileGrafanaDashboard reconciles a GrafanaDashboard object

func (*ReconcileGrafanaDashboard) Reconcile

type SourceType added in v3.6.0

type SourceType int
const (
	SourceTypeJson    SourceType = 1
	SourceTypeJsonnet SourceType = 2
	SourceTypeUnknown SourceType = 3
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL