mirror of
https://github.com/grafana/grafana.git
synced 2025-07-28 21:52:23 +08:00
140 lines
3.7 KiB
Go
140 lines
3.7 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"
|
|
|
|
v0alpha1 "github.com/grafana/grafana/apps/iam/pkg/apis/iam/v0alpha1"
|
|
)
|
|
|
|
var appManifestData = app.ManifestData{
|
|
AppName: "iam",
|
|
Group: "iam.grafana.app",
|
|
Versions: []app.ManifestVersion{
|
|
{
|
|
Name: "v0alpha1",
|
|
Served: true,
|
|
Kinds: []app.ManifestVersionKind{
|
|
{
|
|
Kind: "GlobalRole",
|
|
Plural: "GlobalRoles",
|
|
Scope: "Namespaced",
|
|
Conversion: false,
|
|
},
|
|
|
|
{
|
|
Kind: "GlobalRoleBinding",
|
|
Plural: "GlobalRoleBindings",
|
|
Scope: "Namespaced",
|
|
Conversion: false,
|
|
},
|
|
|
|
{
|
|
Kind: "CoreRole",
|
|
Plural: "CoreRoles",
|
|
Scope: "Namespaced",
|
|
Conversion: false,
|
|
},
|
|
|
|
{
|
|
Kind: "Role",
|
|
Plural: "Roles",
|
|
Scope: "Namespaced",
|
|
Conversion: false,
|
|
},
|
|
|
|
{
|
|
Kind: "RoleBinding",
|
|
Plural: "RoleBindings",
|
|
Scope: "Namespaced",
|
|
Conversion: false,
|
|
},
|
|
|
|
{
|
|
Kind: "ResourcePermission",
|
|
Plural: "ResourcePermissions",
|
|
Scope: "Namespaced",
|
|
Conversion: false,
|
|
},
|
|
|
|
{
|
|
Kind: "User",
|
|
Plural: "Users",
|
|
Scope: "Namespaced",
|
|
Conversion: false,
|
|
},
|
|
|
|
{
|
|
Kind: "Team",
|
|
Plural: "Teams",
|
|
Scope: "Namespaced",
|
|
Conversion: false,
|
|
},
|
|
|
|
{
|
|
Kind: "TeamBinding",
|
|
Plural: "TeamBindings",
|
|
Scope: "Namespaced",
|
|
Conversion: false,
|
|
},
|
|
|
|
{
|
|
Kind: "ServiceAccount",
|
|
Plural: "ServiceAccounts",
|
|
Scope: "Namespaced",
|
|
Conversion: false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
func LocalManifest() app.Manifest {
|
|
return app.NewEmbeddedManifest(appManifestData)
|
|
}
|
|
|
|
func RemoteManifest() app.Manifest {
|
|
return app.NewAPIServerManifest("iam")
|
|
}
|
|
|
|
var kindVersionToGoType = map[string]resource.Kind{
|
|
"GlobalRole/v0alpha1": v0alpha1.GlobalRoleKind(),
|
|
"GlobalRoleBinding/v0alpha1": v0alpha1.GlobalRoleBindingKind(),
|
|
"CoreRole/v0alpha1": v0alpha1.CoreRoleKind(),
|
|
"Role/v0alpha1": v0alpha1.RoleKind(),
|
|
"RoleBinding/v0alpha1": v0alpha1.RoleBindingKind(),
|
|
"ResourcePermission/v0alpha1": v0alpha1.ResourcePermissionKind(),
|
|
"User/v0alpha1": v0alpha1.UserKind(),
|
|
"Team/v0alpha1": v0alpha1.TeamKind(),
|
|
"TeamBinding/v0alpha1": v0alpha1.TeamBindingKind(),
|
|
"ServiceAccount/v0alpha1": v0alpha1.ServiceAccountKind(),
|
|
}
|
|
|
|
// 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
|
|
}
|