The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/pkg/kindsys/kindmetas.go

74 lines
1.8 KiB

package kindsys
import "github.com/grafana/thema"
// CommonMeta contains the metadata common to all categories of kinds.
type CommonMeta struct {
Name string `json:"name"`
PluralName string `json:"pluralName"`
MachineName string `json:"machineName"`
PluralMachineName string `json:"pluralMachineName"`
LineageIsGroup bool `json:"lineageIsGroup"`
Maturity Maturity `json:"maturity"`
}
// TODO generate from type.cue
type RawMeta struct {
CommonMeta
Extensions []string `json:"extensions"`
}
func (m RawMeta) _private() {}
func (m RawMeta) Common() CommonMeta {
return m.CommonMeta
}
// TODO
type CoreStructuredMeta struct {
CommonMeta
CurrentVersion thema.SyntacticVersion `json:"currentVersion"`
}
func (m CoreStructuredMeta) _private() {}
func (m CoreStructuredMeta) Common() CommonMeta {
return m.CommonMeta
}
// TODO
type CustomStructuredMeta struct {
CommonMeta
CurrentVersion thema.SyntacticVersion `json:"currentVersion"`
}
func (m CustomStructuredMeta) _private() {}
func (m CustomStructuredMeta) Common() CommonMeta {
return m.CommonMeta
}
// TODO
type ComposableMeta struct {
CommonMeta
CurrentVersion thema.SyntacticVersion `json:"currentVersion"`
}
func (m ComposableMeta) _private() {}
func (m ComposableMeta) Common() CommonMeta {
return m.CommonMeta
}
// SomeKindMeta is an interface type to abstract over the different kind
// metadata struct types: [RawMeta], [CoreStructuredMeta],
// [CustomStructuredMeta].
//
// It is the traditional interface counterpart to the generic type constraint
// KindMetas.
type SomeKindMeta interface {
_private()
Common() CommonMeta
}
// KindMetas is a type parameter that comprises the base possible set of
// kind metadata configurations.
type KindMetas interface {
RawMeta | CoreStructuredMeta | CustomStructuredMeta | ComposableMeta
}