dashboard_snapshot.go 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. ExternalDeleteUrl string
  17. Expires time.Time
  18. Created time.Time
  19. Updated time.Time
  20. Dashboard *simplejson.Json
  21. }
  22. // DashboardSnapshotDTO without dashboard map
  23. type DashboardSnapshotDTO struct {
  24. Id int64 `json:"id"`
  25. Name string `json:"name"`
  26. Key string `json:"key"`
  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. ExternalUrl string `json:"-"`
  44. ExternalDeleteUrl string `json:"-"`
  45. Key string `json:"key"`
  46. DeleteKey string `json:"deleteKey"`
  47. OrgId int64 `json:"-"`
  48. UserId int64 `json:"-"`
  49. Result *DashboardSnapshot
  50. }
  51. type DeleteDashboardSnapshotCommand struct {
  52. DeleteKey string `json:"-"`
  53. }
  54. type DeleteExpiredSnapshotsCommand struct {
  55. DeletedRows int64
  56. }
  57. type GetDashboardSnapshotQuery struct {
  58. Key string
  59. DeleteKey string
  60. Result *DashboardSnapshot
  61. }
  62. type DashboardSnapshots []*DashboardSnapshot
  63. type DashboardSnapshotsList []*DashboardSnapshotDTO
  64. type GetDashboardSnapshotsQuery struct {
  65. Name string
  66. Limit int
  67. OrgId int64
  68. SignedInUser *SignedInUser
  69. Result DashboardSnapshotsList
  70. }