dashboard_snapshot.go 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. DeletedRows int64
  54. }
  55. type GetDashboardSnapshotQuery struct {
  56. Key string
  57. DeleteKey string
  58. Result *DashboardSnapshot
  59. }
  60. type DashboardSnapshots []*DashboardSnapshot
  61. type DashboardSnapshotsList []*DashboardSnapshotDTO
  62. type GetDashboardSnapshotsQuery struct {
  63. Name string
  64. Limit int
  65. OrgId int64
  66. SignedInUser *SignedInUser
  67. Result DashboardSnapshotsList
  68. }