K8s/Snapshots: Add dashboardsnapshot api group (#77667)
This commit is contained in:
@@ -3,6 +3,7 @@ package dashboardsnapshots
|
||||
import (
|
||||
"time"
|
||||
|
||||
dashboardsnapshot "github.com/grafana/grafana/pkg/apis/dashboardsnapshot/v0alpha1"
|
||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||
"github.com/grafana/grafana/pkg/services/auth/identity"
|
||||
)
|
||||
@@ -47,28 +48,17 @@ type DashboardSnapshotDTO struct {
|
||||
|
||||
// swagger:model
|
||||
type CreateDashboardSnapshotCommand struct {
|
||||
// The complete dashboard model.
|
||||
// required:true
|
||||
Dashboard *simplejson.Json `json:"dashboard" binding:"Required"`
|
||||
// Snapshot name
|
||||
// required:false
|
||||
Name string `json:"name"`
|
||||
// When the snapshot should expire in seconds in seconds. Default is never to expire.
|
||||
// required:false
|
||||
// default:0
|
||||
Expires int64 `json:"expires"`
|
||||
// The "public" fields are defined in this struct while the private/SQL/response params are
|
||||
// defied in the rest of this command
|
||||
dashboardsnapshot.DashboardCreateCommand
|
||||
|
||||
// these are passed when storing an external snapshot ref
|
||||
// Save the snapshot on an external server rather than locally.
|
||||
// required:false
|
||||
// default: false
|
||||
External bool `json:"external"`
|
||||
ExternalURL string `json:"-"`
|
||||
ExternalDeleteURL string `json:"-"`
|
||||
|
||||
// Define the unique key. Required if `external` is `true`.
|
||||
// required:false
|
||||
Key string `json:"key"`
|
||||
|
||||
// Unique key used to delete the snapshot. It is different from the `key` so that only the creator can delete the snapshot. Required if `external` is `true`.
|
||||
// required:false
|
||||
DeleteKey string `json:"deleteKey"`
|
||||
@@ -100,3 +90,10 @@ type GetDashboardSnapshotsQuery struct {
|
||||
OrgID int64
|
||||
SignedInUser identity.Requester
|
||||
}
|
||||
|
||||
type CreateExternalSnapshotResponse struct {
|
||||
Key string `json:"key"`
|
||||
DeleteKey string `json:"deleteKey"`
|
||||
Url string `json:"url"`
|
||||
DeleteUrl string `json:"deleteUrl"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user