model.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package models
  2. import (
  3. "os"
  4. )
  5. type InstalledPlugin struct {
  6. Id string `json:"id"`
  7. Name string `json:"name"`
  8. Type string `json:"type"`
  9. Info PluginInfo `json:"info"`
  10. Dependencies Dependencies `json:"dependencies"`
  11. }
  12. type Dependencies struct {
  13. GrafanaVersion string `json:"grafanaVersion"`
  14. Plugins []Plugin `json:"plugins"`
  15. }
  16. type PluginInfo struct {
  17. Version string `json:"version"`
  18. Updated string `json:"updated"`
  19. }
  20. type Plugin struct {
  21. Id string `json:"id"`
  22. Category string `json:"category"`
  23. Versions []Version `json:"versions"`
  24. }
  25. type Version struct {
  26. Commit string `json:"commit"`
  27. Url string `json:"url"`
  28. Version string `json:"version"`
  29. // os-arch to md5 checksum to check when downloading the file
  30. Arch map[string]ArchMeta `json:"arch"`
  31. }
  32. type ArchMeta struct {
  33. Md5 string `json:"md5"`
  34. }
  35. type PluginRepo struct {
  36. Plugins []Plugin `json:"plugins"`
  37. Version string `json:"version"`
  38. }
  39. type IoUtil interface {
  40. Stat(path string) (os.FileInfo, error)
  41. RemoveAll(path string) error
  42. ReadDir(path string) ([]os.FileInfo, error)
  43. ReadFile(filename string) ([]byte, error)
  44. }