Compare commits
1 commit
4b1986c645
...
c34bd49749
Author | SHA1 | Date | |
---|---|---|---|
c34bd49749 |
2 changed files with 7 additions and 25 deletions
|
@ -5,7 +5,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.ar21.de/yolokube/grafana-backuper/pkg/grafana/schema"
|
"git.ar21.de/yolokube/grafana-backuper/pkg/grafana/schema"
|
||||||
|
@ -168,25 +167,15 @@ func (c *DashboardVersionClient) list(
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var versions schema.DashboardVersionListResponseV10
|
var body schema.DashboardVersionListResponse
|
||||||
body := schema.DashboardVersionListResponse{}
|
|
||||||
resp, err := c.client.do(req, &body)
|
resp, err := c.client.do(req, &body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !strings.Contains(err.Error(), "cannot unmarshal object") {
|
return nil, resp, err
|
||||||
return nil, resp, err
|
|
||||||
}
|
|
||||||
bodyV10 := schema.DashboardVersionListResponseV10{}
|
|
||||||
resp, err = c.client.do(req, &bodyV10)
|
|
||||||
if err != nil {
|
|
||||||
return nil, resp, err
|
|
||||||
}
|
|
||||||
versions = bodyV10
|
|
||||||
} else {
|
|
||||||
versions = body.Versions
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dashboardVersions := make([]*DashboardVersion, 0, len(versions))
|
dashboardVersions := make([]*DashboardVersion, 0, len(body))
|
||||||
for _, dashboardVersion := range versions {
|
for _, dashboardVersion := range body {
|
||||||
dashboardVersions = append(dashboardVersions, DashboardVersionFromSchema(dashboardVersion))
|
dashboardVersions = append(dashboardVersions, DashboardVersionFromSchema(dashboardVersion))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package schema
|
package schema
|
||||||
|
|
||||||
import (
|
import "time"
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
type DashboardVersion struct {
|
type DashboardVersion struct {
|
||||||
ID uint `json:"id"`
|
ID uint `json:"id"`
|
||||||
|
@ -17,9 +15,4 @@ type DashboardVersion struct {
|
||||||
Data any `json:"data"`
|
Data any `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DashboardVersionListResponseV10 []DashboardVersion
|
type DashboardVersionListResponse []DashboardVersion
|
||||||
|
|
||||||
type DashboardVersionListResponse struct {
|
|
||||||
ContinueToken string `json:"continueToken"`
|
|
||||||
Versions DashboardVersionListResponseV10 `json:"versions"`
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue