Chore: Update apps codegen to v0.38.2 (#106111)

This commit is contained in:
Ryan McKinley
2025-05-28 12:35:44 +03:00
committed by GitHub
parent 82b58a2396
commit 10f2b76156
47 changed files with 379 additions and 148 deletions
@@ -3,16 +3,16 @@ package v1beta1
import "k8s.io/apimachinery/pkg/runtime/schema"
const (
// Group is the API group used by all kinds in this package
Group = "folder.grafana.app"
// Version is the API version used by all kinds in this package
Version = "v1beta1"
// APIGroup is the API group used by all kinds in this package
APIGroup = "folder.grafana.app"
// APIVersion is the API version used by all kinds in this package
APIVersion = "v1beta1"
)
var (
// GroupVersion is a schema.GroupVersion consisting of the Group and Version constants for this package
GroupVersion = schema.GroupVersion{
Group: Group,
Version: Version,
Group: APIGroup,
Version: APIVersion,
}
)
@@ -24,5 +24,8 @@ type FolderMetadata struct {
// NewFolderMetadata creates a new FolderMetadata object.
func NewFolderMetadata() *FolderMetadata {
return &FolderMetadata{}
return &FolderMetadata{
Finalizers: []string{},
Labels: map[string]string{},
}
}
@@ -11,8 +11,8 @@ import (
)
const (
GROUP = Group
VERSION = Version
GROUP = APIGroup
VERSION = APIVersion
RESOURCE = "folders"
APIVERSION = GROUP + "/" + VERSION
RESOURCEGROUP = RESOURCE + "." + GROUP
+15 -7
View File
@@ -6,9 +6,12 @@
package apis
import (
"encoding/json"
"fmt"
"github.com/grafana/grafana-app-sdk/app"
"github.com/grafana/grafana-app-sdk/resource"
v1beta1 "github.com/grafana/grafana/apps/folder/pkg/apis/folder/v1beta1"
)
var ()
@@ -30,12 +33,6 @@ var appManifestData = app.ManifestData{
},
}
func jsonToMap(j string) map[string]any {
m := make(map[string]any)
json.Unmarshal([]byte(j), &j)
return m
}
func LocalManifest() app.Manifest {
return app.NewEmbeddedManifest(appManifestData)
}
@@ -43,3 +40,14 @@ func LocalManifest() app.Manifest {
func RemoteManifest() app.Manifest {
return app.NewAPIServerManifest("folder")
}
var kindVersionToGoType = map[string]resource.Kind{
"Folder/v1beta1": v1beta1.FolderKind(),
}
// ManifestGoTypeAssociator returns the associated resource.Kind instance for a given Kind and Version, if one exists.
// If there is no association for the provided Kind and Version, exists will return false.
func ManifestGoTypeAssociator(kind, version string) (goType resource.Kind, exists bool) {
goType, exists = kindVersionToGoType[fmt.Sprintf("%s/%s", kind, version)]
return goType, exists
}