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 DashboardFromSchema(source schema.Dashboard) *Dashboard { return &Dashboard{ IsStarred: source.Meta.IsStarred, Type: source.Meta.Type, CanSave: source.Meta.CanSave, CanEdit: source.Meta.CanEdit, CanAdmin: source.Meta.CanAdmin, CanStar: source.Meta.CanStar, CanDelete: source.Meta.CanDelete, Slug: source.Meta.Slug, URL: source.Meta.URL, Expires: source.Meta.Expires, Created: source.Meta.Created, Updated: source.Meta.Updated, UpdatedBy: source.Meta.UpdatedBy, CreatedBy: source.Meta.CreatedBy, Version: source.Meta.Version, HasACL: source.Meta.HasACL, IsFolder: source.Meta.IsFolder, FolderID: source.Meta.FolderID, FolderUID: source.Meta.FolderUID, FolderTitle: source.Meta.FolderTitle, FolderURL: source.Meta.FolderURL, Provisioned: source.Meta.Provisioned, ProvisionedExternalID: source.Meta.ProvisionedExternalID, AnnotationsPermissions: AnnotationsPermissions{ Dashboard: AnnotationPermissions{ CanAdd: source.Meta.AnnotationsPermissions.Dashboard.CanAdd, CanEdit: source.Meta.AnnotationsPermissions.Dashboard.CanEdit, CanDelete: source.Meta.AnnotationsPermissions.Dashboard.CanDelete, }, Organization: AnnotationPermissions{ CanAdd: source.Meta.AnnotationsPermissions.Organization.CanAdd, CanEdit: source.Meta.AnnotationsPermissions.Organization.CanEdit, CanDelete: source.Meta.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, } } func SchemaFromDashboardMeta(dm *Dashboard) schema.Dashboard { return schema.Dashboard{ Meta: schema.DashboardMeta{ IsStarred: dm.IsStarred, Type: dm.Type, CanSave: dm.CanSave, CanEdit: dm.CanEdit, CanAdmin: dm.CanAdmin, CanStar: dm.CanStar, CanDelete: dm.CanDelete, Slug: dm.Slug, URL: dm.URL, Expires: dm.Expires, Created: dm.Created, Updated: dm.Updated, UpdatedBy: dm.UpdatedBy, CreatedBy: dm.CreatedBy, Version: dm.Version, HasACL: dm.HasACL, IsFolder: dm.IsFolder, FolderID: dm.FolderID, FolderUID: dm.FolderUID, FolderTitle: dm.FolderTitle, FolderURL: dm.FolderURL, Provisioned: dm.Provisioned, ProvisionedExternalID: dm.ProvisionedExternalID, AnnotationsPermissions: schema.AnnotationsPermissions{ Dashboard: schema.AnnotationPermissions{ CanAdd: dm.AnnotationsPermissions.Dashboard.CanAdd, CanEdit: dm.AnnotationsPermissions.Dashboard.CanEdit, CanDelete: dm.AnnotationsPermissions.Dashboard.CanDelete, }, Organization: schema.AnnotationPermissions{ CanAdd: dm.AnnotationsPermissions.Organization.CanAdd, CanEdit: dm.AnnotationsPermissions.Organization.CanEdit, CanDelete: dm.AnnotationsPermissions.Organization.CanDelete, }, }, }, Dashboard: dm.Dashboard, } }