2025-08-07 01:09:10 +08:00
//
// This file is generated by grafana-app-sdk
// DO NOT EDIT
//
package apis
import (
"encoding/json"
"fmt"
"strings"
"github.com/grafana/grafana-app-sdk/app"
"github.com/grafana/grafana-app-sdk/resource"
2025-09-16 18:35:20 +08:00
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/kube-openapi/pkg/spec3"
2025-08-07 01:09:10 +08:00
v0alpha1 "github.com/grafana/grafana/apps/plugins/pkg/apis/plugins/v0alpha1"
)
var (
2025-09-16 18:35:20 +08:00
rawSchemaPluginMetav0alpha1 = [ ] byte ( ` { "Dependencies" : { "additionalProperties" : false , "properties" : { "extensions" : { "additionalProperties" : false , "properties" : { "exposedComponents" : { "description" : "+listType=set" , "items" : { "type" : "string" } , "type" : "array" } } , "type" : "object" } , "grafanaDependency" : { "description" : "Required field" , "type" : "string" } , "grafanaVersion" : { "description" : "Optional fields" , "type" : "string" } , "plugins" : { "description" : "+listType=set\n+listMapKey=id" , "items" : { "additionalProperties" : false , "properties" : { "id" : { "type" : "string" } , "name" : { "type" : "string" } , "type" : { "enum" : [ "app" , "datasource" , "panel" ] , "type" : "string" } } , "required" : [ "id" , "type" , "name" ] , "type" : "object" } , "type" : "array" } } , "required" : [ "grafanaDependency" ] , "type" : "object" } , "EnterpriseFeatures" : { "additionalProperties" : false , "properties" : { "healthDiagnosticsErrors" : { "default" : false , "description" : "Allow additional properties" , "type" : "boolean" } } , "type" : "object" } , "Extensions" : { "additionalProperties" : false , "properties" : { "addedComponents" : { "description" : "+listType=atomic" , "items" : { "additionalProperties" : false , "properties" : { "description" : { "type" : "string" } , "targets" : { "description" : "+listType=set" , "items" : { "type" : "string" } , "type" : "array" } , "title" : { "type" : "string" } } , "required" : [ "targets" , "title" ] , "type" : "object" } , "type" : "array" } , "addedLinks" : { "description" : "+listType=atomic" , "items" : { "additionalProperties" : false , "properties" : { "description" : { "type" : "string" } , "targets" : { "description" : "+listType=set" , "items" : { "type" : "string" } , "type" : "array" } , "title" : { "type" : "string" } } , "required" : [ "targets" , "title" ] , "type" : "object" } , "type" : "array" } , "exposedComponents" : { "description" : "+listType=set\n+listMapKey=id" , "items" : { "additionalProperties" : false , "properties" : { "description" : { "type" : "string" } , "id" : { "type" : "string" } , "title" : { "type" : "string" } } , "required" : [ "id" ] , "type" : "object" } , "type" : "array" } , "extensionPoints" : { "description" : "+listType=set\n+listMapKey=id" , "items" : { "additionalProperties" : false , "properties" : { "description" : { "type" : "string" } , "id" : { "type" : "string" } , "title" : { "type" : "string" } } , "required" : [ "id" ] , "type" : "object" } , "type" : "array" } } , "type" : "object" } , "IAM" : { "additionalProperties" : false , "properties" : { "permissions" : { "description" : "+listType=atomic" , "items" : { "additionalProperties" : false , "properties" : { "action" : { "type" : "string" } , "scope" : { "type" : "string" } } , "type" : "object" } , "type" : "array" } } , "type" : "object" } , "Include" : { "additionalProperties" : false , "properties" : { "action" : { "type" : "string" } , "addToNav" : { "type" : "boolean" } , "component" : { "type" : "string" } , "defaultNav" : { "type" : "boolean" } , "icon" : { "type" : "string" } , "name" : { "type" : "string" } , "path" : { "type" : "string" } , "role" : { "enum" : [ "Admin" , "Editor" , "Viewer" ] , "type" : "string" } , "type" : { "enum" : [ "dashboard" , "page" , "panel" , "datasource" ] , "type" : "string" } , "uid" : { "type" : "string" } } , "type" : "object" } , "Info" : { "additionalProperties" : false , "properties" : { "author" : { "additionalProperties" : false , "description" : "Optional fields" , "properties" : { "email" : { "type" : "string" } , "name" : { "type" : "string" } , "url" : { "type" : "string" } } , "type" : "object" } , "description" : { "type" : "string" } , "keywords" : { "description" : "Required fields\n+listType=set" , "items" : { "type" : "string" } , "type" : "array" } , "links" : { "description" : "+listType=atomic" , "items" : { "additionalProperties" : false , "properties" : { "name" : { "type" : "string" } , "url" : { "type" : "string" } } , "type" : "object" } , "type" : "array" } , "logos" : { "additionalProperties" : false , "properties" : { "large" : { "type" : "string" } , "small" : { "type" : "string" } } , "required" : [ "small" , "large" ] , "type" : "object" } , "screenshots" : { "description" : "+listType=atomic" , "items" : { "additionalProperties" : false , "properties" : { "name" : { "type" : "string" } , "path" : { "type" : "string" } } , "type" : "object" } , "type" : "array" } , "updated" : { "format" : "date-time" , "type" : "string" } , "version" : { "type" : "string" } } , "required" : [ "keywords" , "logos" , "updated" , "version" ] , "type" : "object" } , "JSONData" : { "additionalProperties" : false , "description" : "JSON configuration schema for Grafana plugins\nConverted from: https://github.com/grafana/grafana/blob/main/docs/sources/developers/plugins/plugin.schema.json" , "properties" : { "alerting" : { "description" : " Optional fiel
2025-08-07 01:09:10 +08:00
versionSchemaPluginMetav0alpha1 app . VersionSchema
_ = json . Unmarshal ( rawSchemaPluginMetav0alpha1 , & versionSchemaPluginMetav0alpha1 )
2025-09-16 18:35:20 +08:00
rawSchemaPluginInstallv0alpha1 = [ ] byte ( ` { "OperatorState": { "additionalProperties":false,"properties": { "descriptiveState": { "description":"descriptiveState is an optional more descriptive state field which has no requirements on format","type":"string"},"details": { "additionalProperties": { "additionalProperties": { },"type":"object"},"description":"details contains any extra information that is operator-specific","type":"object"},"lastEvaluation": { "description":"lastEvaluation is the ResourceVersion last evaluated","type":"string"},"state": { "description":"state describes the state of the lastEvaluation.\nIt is limited to three possible states for machine evaluation.","enum":["success","in_progress","failed"],"type":"string"}},"required":["lastEvaluation","state"],"type":"object"},"PluginInstall": { "properties": { "spec": { "$ref":"#/components/schemas/spec"},"status": { "$ref":"#/components/schemas/status"}},"required":["spec"]},"spec": { "additionalProperties":false,"properties": { "id": { "type":"string"},"version": { "type":"string"}},"required":["id","version"],"type":"object"},"status": { "additionalProperties":false,"properties": { "additionalFields": { "additionalProperties": { "additionalProperties": { },"type":"object"},"description":"additionalFields is reserved for future use","type":"object"},"operatorStates": { "additionalProperties": { "$ref":"#/components/schemas/OperatorState"},"description":"operatorStates is a map of operator ID to operator state evaluations.\nAny operator which consumes this kind SHOULD add its state evaluation information to this field.","type":"object"}},"type":"object"}} ` )
2025-08-07 01:09:10 +08:00
versionSchemaPluginInstallv0alpha1 app . VersionSchema
_ = json . Unmarshal ( rawSchemaPluginInstallv0alpha1 , & versionSchemaPluginInstallv0alpha1 )
)
var appManifestData = app . ManifestData {
2025-10-04 17:33:10 +08:00
AppName : "plugins" ,
Group : "plugins.grafana.app" ,
PreferredVersion : "v0alpha1" ,
2025-08-07 01:09:10 +08:00
Versions : [ ] app . ManifestVersion {
{
Name : "v0alpha1" ,
Served : false ,
Kinds : [ ] app . ManifestVersionKind {
{
Kind : "PluginMeta" ,
Plural : "PluginMetas" ,
Scope : "Namespaced" ,
Conversion : false ,
Schema : & versionSchemaPluginMetav0alpha1 ,
} ,
{
Kind : "PluginInstall" ,
Plural : "PluginInstalls" ,
Scope : "Namespaced" ,
Conversion : false ,
Schema : & versionSchemaPluginInstallv0alpha1 ,
} ,
} ,
2025-09-16 18:35:20 +08:00
Routes : app . ManifestVersionRoutes {
Namespaced : map [ string ] spec3 . PathProps { } ,
Cluster : map [ string ] spec3 . PathProps { } ,
} ,
2025-08-07 01:09:10 +08:00
} ,
} ,
}
func LocalManifest ( ) app . Manifest {
return app . NewEmbeddedManifest ( appManifestData )
}
func RemoteManifest ( ) app . Manifest {
return app . NewAPIServerManifest ( "plugins" )
}
var kindVersionToGoType = map [ string ] resource . Kind {
"PluginMeta/v0alpha1" : v0alpha1 . PluginMetaKind ( ) ,
"PluginInstall/v0alpha1" : v0alpha1 . PluginInstallKind ( ) ,
}
// 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.
2025-09-16 18:35:20 +08:00
// Resource routes (those without a kind) should prefix their route with "<namespace>/" if the route is namespaced (otherwise the route is assumed to be cluster-scope)
2025-08-07 01:09:10 +08:00
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
}
2025-09-16 18:35:20 +08:00
var customRouteToGoParamsType = map [ string ] runtime . Object { }
func ManifestCustomRouteQueryAssociator ( kind , version , path , verb string ) ( goType runtime . Object , exists bool ) {
if len ( path ) > 0 && path [ 0 ] == '/' {
path = path [ 1 : ]
}
goType , exists = customRouteToGoParamsType [ fmt . Sprintf ( "%s|%s|%s|%s" , version , kind , path , strings . ToUpper ( verb ) ) ]
return goType , exists
}
var customRouteToGoRequestBodyType = map [ string ] any { }
func ManifestCustomRouteRequestBodyAssociator ( kind , version , path , verb string ) ( goType any , exists bool ) {
if len ( path ) > 0 && path [ 0 ] == '/' {
path = path [ 1 : ]
}
goType , exists = customRouteToGoRequestBodyType [ fmt . Sprintf ( "%s|%s|%s|%s" , version , kind , path , strings . ToUpper ( verb ) ) ]
return goType , exists
}
type GoTypeAssociator struct { }
func NewGoTypeAssociator ( ) * GoTypeAssociator {
return & GoTypeAssociator { }
}
func ( g * GoTypeAssociator ) KindToGoType ( kind , version string ) ( goType resource . Kind , exists bool ) {
return ManifestGoTypeAssociator ( kind , version )
}
func ( g * GoTypeAssociator ) CustomRouteReturnGoType ( kind , version , path , verb string ) ( goType any , exists bool ) {
return ManifestCustomRouteResponsesAssociator ( kind , version , path , verb )
}
func ( g * GoTypeAssociator ) CustomRouteQueryGoType ( kind , version , path , verb string ) ( goType runtime . Object , exists bool ) {
return ManifestCustomRouteQueryAssociator ( kind , version , path , verb )
}
func ( g * GoTypeAssociator ) CustomRouteRequestBodyGoType ( kind , version , path , verb string ) ( goType any , exists bool ) {
return ManifestCustomRouteRequestBodyAssociator ( kind , version , path , verb )
}