add grafana package & temporary debug checks
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
1247fc3fcb
commit
2d08f75545
9 changed files with 373 additions and 0 deletions
42
main.go
Normal file
42
main.go
Normal file
|
@ -0,0 +1,42 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"git.ar21.de/yolokube/grafana-backuper/pkg/grafana"
|
||||
)
|
||||
|
||||
const (
|
||||
grafanaURL = "https://grafana.services.yolokube.de"
|
||||
grafanaAPIKey = ""
|
||||
gitRepoURL = ""
|
||||
gitRepoDirectory = ""
|
||||
)
|
||||
|
||||
func main() {
|
||||
ctx := context.Background()
|
||||
client, err := grafana.NewClient(grafanaURL, grafanaAPIKey, grafana.DefaultHTTPClient)
|
||||
if err != nil {
|
||||
log.Fatalf("Error creating the grafana client: %v", err)
|
||||
}
|
||||
|
||||
dashboards, err := client.SearchDashboards(ctx, "", false)
|
||||
if err != nil {
|
||||
log.Fatalf("Error fetching dashboards: %v", err)
|
||||
}
|
||||
|
||||
for _, dashboard := range dashboards {
|
||||
versions, err := client.GetDashboardVersionsByDashboardID(ctx, dashboard.ID)
|
||||
if err != nil {
|
||||
log.Fatalf("Error fetching versions for dashboard %s: %v", dashboard.Title, err)
|
||||
}
|
||||
|
||||
fmt.Println(dashboard.Title)
|
||||
fmt.Println(versions)
|
||||
for _, version := range versions {
|
||||
fmt.Printf("%s: %s\n", version.CreatedBy, version.Message)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue