mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Schema: Create PublicDashboard core kind (#62155)
This commit is contained in:
committed by
GitHub
parent
e8b8a9e276
commit
354f6d9e23
@@ -15,6 +15,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/kinds/dashboard"
|
||||
"github.com/grafana/grafana/pkg/kinds/playlist"
|
||||
"github.com/grafana/grafana/pkg/kinds/preferences"
|
||||
"github.com/grafana/grafana/pkg/kinds/publicdashboard"
|
||||
"github.com/grafana/grafana/pkg/kinds/serviceaccount"
|
||||
"github.com/grafana/grafana/pkg/kinds/team"
|
||||
"github.com/grafana/grafana/pkg/kindsys"
|
||||
@@ -32,12 +33,13 @@ import (
|
||||
// Prefer All*() methods when performing operations generically across all kinds.
|
||||
// For example, a validation HTTP middleware for any kind-schematized object type.
|
||||
type Base struct {
|
||||
all []kindsys.Core
|
||||
dashboard *dashboard.Kind
|
||||
playlist *playlist.Kind
|
||||
preferences *preferences.Kind
|
||||
serviceaccount *serviceaccount.Kind
|
||||
team *team.Kind
|
||||
all []kindsys.Core
|
||||
dashboard *dashboard.Kind
|
||||
playlist *playlist.Kind
|
||||
preferences *preferences.Kind
|
||||
publicdashboard *publicdashboard.Kind
|
||||
serviceaccount *serviceaccount.Kind
|
||||
team *team.Kind
|
||||
}
|
||||
|
||||
// type guards
|
||||
@@ -45,6 +47,7 @@ var (
|
||||
_ kindsys.Core = &dashboard.Kind{}
|
||||
_ kindsys.Core = &playlist.Kind{}
|
||||
_ kindsys.Core = &preferences.Kind{}
|
||||
_ kindsys.Core = &publicdashboard.Kind{}
|
||||
_ kindsys.Core = &serviceaccount.Kind{}
|
||||
_ kindsys.Core = &team.Kind{}
|
||||
)
|
||||
@@ -64,6 +67,11 @@ func (b *Base) Preferences() *preferences.Kind {
|
||||
return b.preferences
|
||||
}
|
||||
|
||||
// PublicDashboard returns the [kindsys.Interface] implementation for the publicdashboard kind.
|
||||
func (b *Base) PublicDashboard() *publicdashboard.Kind {
|
||||
return b.publicdashboard
|
||||
}
|
||||
|
||||
// ServiceAccount returns the [kindsys.Interface] implementation for the serviceaccount kind.
|
||||
func (b *Base) ServiceAccount() *serviceaccount.Kind {
|
||||
return b.serviceaccount
|
||||
@@ -96,6 +104,12 @@ func doNewBase(rt *thema.Runtime) *Base {
|
||||
}
|
||||
reg.all = append(reg.all, reg.preferences)
|
||||
|
||||
reg.publicdashboard, err = publicdashboard.NewKind(rt)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("error while initializing the publicdashboard Kind: %s", err))
|
||||
}
|
||||
reg.all = append(reg.all, reg.publicdashboard)
|
||||
|
||||
reg.serviceaccount, err = serviceaccount.NewKind(rt)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("error while initializing the serviceaccount Kind: %s", err))
|
||||
|
||||
Reference in New Issue
Block a user