dashboard_snapshot.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. package models
  2. import (
  3. "time"
  4. "github.com/grafana/grafana/pkg/components/simplejson"
  5. )
  6. // DashboardSnapshot model
  7. type DashboardSnapshot struct {
  8. Id int64
  9. Name string
  10. Key string
  11. DeleteKey string
  12. OrgId int64
  13. UserId int64
  14. External bool
  15. ExternalUrl string
  16. Expires time.Time
  17. Created time.Time
  18. Updated time.Time
  19. Dashboard *simplejson.Json
  20. }
  21. // DashboardSnapshotDTO without dashboard map
  22. type DashboardSnapshotDTO struct {
  23. Id int64 `json:"id"`
  24. Name string `json:"name"`
  25. Key string `json:"key"`
  26. DeleteKey string `json:"deleteKey"`
  27. OrgId int64 `json:"orgId"`
  28. UserId int64 `json:"userId"`
  29. External bool `json:"external"`
  30. ExternalUrl string `json:"externalUrl"`
  31. Expires time.Time `json:"expires"`
  32. Created time.Time `json:"created"`
  33. Updated time.Time `json:"updated"`
  34. }
  35. // -----------------
  36. // COMMANDS
  37. type CreateDashboardSnapshotCommand struct {
  38. Dashboard *simplejson.Json `json:"dashboard" binding:"Required"`
  39. Name string `json:"name"`
  40. Expires int64 `json:"expires"`
  41. // these are passed when storing an external snapshot ref
  42. External bool `json:"external"`
  43. Key string `json:"key"`
  44. DeleteKey string `json:"deleteKey"`
  45. OrgId int64 `json:"-"`
  46. UserId int64 `json:"-"`
  47. Result *DashboardSnapshot
  48. }
  49. type DeleteDashboardSnapshotCommand struct {
  50. DeleteKey string `json:"-"`
  51. }
  52. type DeleteExpiredSnapshotsCommand struct {
  53. }
  54. type GetDashboardSnapshotQuery struct {
  55. Key string
  56. Result *DashboardSnapshot
  57. }
  58. type DashboardSnapshots []*DashboardSnapshot
  59. type GetDashboardSnapshotsQuery struct {
  60. Name string
  61. Limit int
  62. OrgId int64
  63. Result DashboardSnapshots
  64. }