1package models 2 3import ( 4 "time" 5 6 "github.com/grafana/grafana/pkg/components/simplejson" 7) 8 9// DashboardSnapshot model 10type DashboardSnapshot struct { 11 Id int64 12 Name string 13 Key string 14 DeleteKey string 15 OrgId int64 16 UserId int64 17 External bool 18 ExternalUrl string 19 ExternalDeleteUrl string 20 21 Expires time.Time 22 Created time.Time 23 Updated time.Time 24 25 Dashboard *simplejson.Json 26 DashboardEncrypted []byte 27} 28 29// DashboardSnapshotDTO without dashboard map 30type DashboardSnapshotDTO struct { 31 Id int64 `json:"id"` 32 Name string `json:"name"` 33 Key string `json:"key"` 34 OrgId int64 `json:"orgId"` 35 UserId int64 `json:"userId"` 36 External bool `json:"external"` 37 ExternalUrl string `json:"externalUrl"` 38 39 Expires time.Time `json:"expires"` 40 Created time.Time `json:"created"` 41 Updated time.Time `json:"updated"` 42} 43 44// ----------------- 45// COMMANDS 46 47type CreateDashboardSnapshotCommand struct { 48 Dashboard *simplejson.Json `json:"dashboard" binding:"Required"` 49 Name string `json:"name"` 50 Expires int64 `json:"expires"` 51 52 // these are passed when storing an external snapshot ref 53 External bool `json:"external"` 54 ExternalUrl string `json:"-"` 55 ExternalDeleteUrl string `json:"-"` 56 57 Key string `json:"key"` 58 DeleteKey string `json:"deleteKey"` 59 60 OrgId int64 `json:"-"` 61 UserId int64 `json:"-"` 62 63 DashboardEncrypted []byte `json:"-"` 64 65 Result *DashboardSnapshot 66} 67 68type DeleteDashboardSnapshotCommand struct { 69 DeleteKey string `json:"-"` 70} 71 72type DeleteExpiredSnapshotsCommand struct { 73 DeletedRows int64 74} 75 76type GetDashboardSnapshotQuery struct { 77 Key string 78 DeleteKey string 79 80 Result *DashboardSnapshot 81} 82 83type DashboardSnapshotsList []*DashboardSnapshotDTO 84 85type GetDashboardSnapshotsQuery struct { 86 Name string 87 Limit int 88 OrgId int64 89 SignedInUser *SignedInUser 90 91 Result DashboardSnapshotsList 92} 93