mirror of
https://github.com/grafana/grafana.git
synced 2025-07-28 07:42:07 +08:00
70 lines
2.0 KiB
Go
70 lines
2.0 KiB
Go
//
|
|
// This file is generated by grafana-app-sdk
|
|
// DO NOT EDIT
|
|
//
|
|
|
|
package apis
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"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 ()
|
|
|
|
var appManifestData = app.ManifestData{
|
|
AppName: "folder",
|
|
Group: "folder.grafana.app",
|
|
Versions: []app.ManifestVersion{
|
|
{
|
|
Name: "v1beta1",
|
|
Served: true,
|
|
Kinds: []app.ManifestVersionKind{
|
|
{
|
|
Kind: "Folder",
|
|
Plural: "Folders",
|
|
Scope: "Namespaced",
|
|
Conversion: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
func LocalManifest() app.Manifest {
|
|
return app.NewEmbeddedManifest(appManifestData)
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
var customRouteToGoResponseType = map[string]any{}
|
|
|
|
// ManifestCustomRouteResponsesAssociator returns the associated response go type for a given kind, version, custom route path, and method, if one exists.
|
|
// kind may be empty for custom routes which are not kind subroutes. Leading slashes are removed from subroute paths.
|
|
// If there is no association for the provided kind, version, custom route path, and method, exists will return false.
|
|
func ManifestCustomRouteResponsesAssociator(kind, version, path, verb string) (goType any, exists bool) {
|
|
if len(path) > 0 && path[0] == '/' {
|
|
path = path[1:]
|
|
}
|
|
goType, exists = customRouteToGoResponseType[fmt.Sprintf("%s|%s|%s|%s", version, kind, path, strings.ToUpper(verb))]
|
|
return goType, exists
|
|
}
|