99 lines
3.1 KiB
Go
99 lines
3.1 KiB
Go
|
package grafana
|
||
|
|
||
|
import (
|
||
|
"git.ar21.de/yolokube/grafana-backuper/pkg/grafana/schema"
|
||
|
)
|
||
|
|
||
|
func DashboardCreateResponseFromSchema(source schema.DashboardCreateResponse) *DashboardCreateResponse {
|
||
|
return &DashboardCreateResponse{
|
||
|
DashboardID: source.DashboardID,
|
||
|
DashboardUID: source.DashboardUID,
|
||
|
URL: source.URL,
|
||
|
Status: source.Status,
|
||
|
Version: source.Version,
|
||
|
Slug: source.Slug,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func DashboardMetaFromSchema(source schema.DashboardMeta) *DashboardMeta {
|
||
|
return &DashboardMeta{
|
||
|
IsStarred: source.IsStarred,
|
||
|
Type: source.Type,
|
||
|
CanSave: source.CanSave,
|
||
|
CanEdit: source.CanEdit,
|
||
|
CanAdmin: source.CanAdmin,
|
||
|
CanStar: source.CanStar,
|
||
|
CanDelete: source.CanDelete,
|
||
|
Slug: source.Slug,
|
||
|
URL: source.URL,
|
||
|
Expires: source.Expires,
|
||
|
Created: source.Created,
|
||
|
Updated: source.Updated,
|
||
|
UpdatedBy: source.UpdatedBy,
|
||
|
CreatedBy: source.CreatedBy,
|
||
|
Version: source.Version,
|
||
|
HasACL: source.HasACL,
|
||
|
IsFolder: source.IsFolder,
|
||
|
FolderID: source.FolderID,
|
||
|
FolderUID: source.FolderUID,
|
||
|
FolderTitle: source.FolderTitle,
|
||
|
FolderURL: source.FolderURL,
|
||
|
Provisioned: source.Provisioned,
|
||
|
ProvisionedExternalID: source.ProvisionedExternalID,
|
||
|
AnnotationsPermissions: AnnotationsPermissions{
|
||
|
Dashboard: AnnotationPermissions{
|
||
|
CanAdd: source.AnnotationsPermissions.Dashboard.CanAdd,
|
||
|
CanEdit: source.AnnotationsPermissions.Dashboard.CanEdit,
|
||
|
CanDelete: source.AnnotationsPermissions.Dashboard.CanDelete,
|
||
|
},
|
||
|
Organization: AnnotationPermissions{
|
||
|
CanAdd: source.AnnotationsPermissions.Organization.CanAdd,
|
||
|
CanEdit: source.AnnotationsPermissions.Organization.CanEdit,
|
||
|
CanDelete: source.AnnotationsPermissions.Organization.CanDelete,
|
||
|
},
|
||
|
},
|
||
|
Dashboard: source.Dashboard,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func DashboardVersionFromSchema(source schema.DashboardVersion) *DashboardVersion {
|
||
|
return &DashboardVersion{
|
||
|
ID: source.ID,
|
||
|
DashboardID: source.DashboardID,
|
||
|
DashboardUID: source.UID,
|
||
|
ParentVersion: source.ParentVersion,
|
||
|
RestoredFrom: source.RestoredFrom,
|
||
|
Version: source.Version,
|
||
|
Created: source.Created,
|
||
|
CreatedBy: source.CreatedBy,
|
||
|
Message: source.Message,
|
||
|
Data: source.Data,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func ErrorResponseFromSchema(source schema.ErrorResponse) *ErrorResponse {
|
||
|
return &ErrorResponse{
|
||
|
Message: source.Message,
|
||
|
TraceID: source.TraceID,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func SearchResultFromSchema(source schema.SearchResult) *SearchResult {
|
||
|
return &SearchResult{
|
||
|
ID: source.ID,
|
||
|
UID: source.UID,
|
||
|
Title: source.Title,
|
||
|
URI: source.URI,
|
||
|
URL: source.URL,
|
||
|
Slug: source.Slug,
|
||
|
Type: source.Type,
|
||
|
Tags: source.Tags,
|
||
|
IsStarred: source.IsStarred,
|
||
|
SortMeta: source.SortMeta,
|
||
|
FolderID: source.FolderID,
|
||
|
FolderUID: source.FolderUID,
|
||
|
FolderTitle: source.FolderTitle,
|
||
|
FolderURL: source.FolderURL,
|
||
|
}
|
||
|
}
|