Plugins: Add /meta and /metas APIs to plugins app (#113775)
* add /meta and /metas APIs * wrapped storage route * format file * fix switch statement lint issue * fix plugininstaller test --------- Co-authored-by: Todd Treece <todd.treece@grafana.com>
This commit is contained in:
@@ -1,236 +1,15 @@
|
||||
package plugins
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
pluginV0Alpha1: {
|
||||
kind: "Plugin"
|
||||
kind: "Plugin"
|
||||
plural: "plugins"
|
||||
scope: "Namespaced"
|
||||
scope: "Namespaced"
|
||||
schema: {
|
||||
spec: {
|
||||
id: string
|
||||
version: string
|
||||
url?: string
|
||||
class: "core" | "external"
|
||||
}
|
||||
}
|
||||
routes: {
|
||||
"/meta": {
|
||||
"GET": {
|
||||
request: {}
|
||||
response: #JSONData,
|
||||
responseMetadata: {
|
||||
typeMeta: false
|
||||
objectMeta: false
|
||||
}
|
||||
}
|
||||
id: string
|
||||
version: string
|
||||
url?: string
|
||||
class: "core" | "external"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// JSON configuration schema for Grafana plugins
|
||||
// Converted from: https://github.com/grafana/grafana/blob/main/docs/sources/developers/plugins/plugin.schema.json
|
||||
#JSONData: {
|
||||
// Unique name of the plugin
|
||||
id: string
|
||||
|
||||
// Plugin type
|
||||
type: "app" | "datasource" | "panel" | "renderer"
|
||||
|
||||
// Human-readable name of the plugin
|
||||
name: string
|
||||
|
||||
// Metadata for the plugin
|
||||
info: #Info
|
||||
|
||||
// Dependency information
|
||||
dependencies: #Dependencies
|
||||
|
||||
// Optional fields
|
||||
alerting?: bool
|
||||
annotations?: bool
|
||||
autoEnabled?: bool
|
||||
backend?: bool
|
||||
buildMode?: string
|
||||
builtIn?: bool
|
||||
category?: "tsdb" | "logging" | "cloud" | "tracing" | "profiling" | "sql" | "enterprise" | "iot" | "other"
|
||||
enterpriseFeatures?: #EnterpriseFeatures
|
||||
executable?: string
|
||||
hideFromList?: bool
|
||||
// +listType=atomic
|
||||
includes?: [...#Include]
|
||||
logs?: bool
|
||||
metrics?: bool
|
||||
multiValueFilterOperators?: bool
|
||||
pascalName?: string
|
||||
preload?: bool
|
||||
queryOptions?: #QueryOptions
|
||||
// +listType=atomic
|
||||
routes?: [...#Route]
|
||||
skipDataQuery?: bool
|
||||
state?: "alpha" | "beta"
|
||||
streaming?: bool
|
||||
tracing?: bool
|
||||
iam?: #IAM
|
||||
// +listType=atomic
|
||||
roles?: [...#Role]
|
||||
extensions?: #Extensions
|
||||
}
|
||||
|
||||
#Info: {
|
||||
// Required fields
|
||||
// +listType=set
|
||||
keywords: [...string]
|
||||
logos: {
|
||||
small: string
|
||||
large: string
|
||||
}
|
||||
updated: string & time.Time
|
||||
version: string
|
||||
// Optional fields
|
||||
author?: {
|
||||
name?: string
|
||||
email?: string
|
||||
url?: string
|
||||
}
|
||||
description?: string
|
||||
// +listType=atomic
|
||||
links?: [...{
|
||||
name?: string
|
||||
url?: string
|
||||
}]
|
||||
// +listType=atomic
|
||||
screenshots?: [...{
|
||||
name?: string
|
||||
path?: string
|
||||
}]
|
||||
}
|
||||
|
||||
#Dependencies: {
|
||||
// Required field
|
||||
grafanaDependency: string
|
||||
|
||||
// Optional fields
|
||||
grafanaVersion?: string
|
||||
// +listType=set
|
||||
// +listMapKey=id
|
||||
plugins?: [...{
|
||||
id: string
|
||||
type: "app" | "datasource" | "panel"
|
||||
name: string
|
||||
}]
|
||||
extensions?: {
|
||||
// +listType=set
|
||||
exposedComponents?: [...string]
|
||||
}
|
||||
}
|
||||
|
||||
#EnterpriseFeatures: {
|
||||
healthDiagnosticsErrors?: bool | *false
|
||||
// Allow additional properties
|
||||
[string]: _
|
||||
}
|
||||
|
||||
#Include: {
|
||||
uid?: string
|
||||
type?: "dashboard" | "page" | "panel" | "datasource"
|
||||
name?: string
|
||||
component?: string
|
||||
role?: "Admin" | "Editor" | "Viewer"
|
||||
action?: string
|
||||
path?: string
|
||||
addToNav?: bool
|
||||
defaultNav?: bool
|
||||
icon?: string
|
||||
}
|
||||
|
||||
#QueryOptions: {
|
||||
maxDataPoints?: bool
|
||||
minInterval?: bool
|
||||
cacheTimeout?: bool
|
||||
}
|
||||
|
||||
#Route: {
|
||||
path?: string
|
||||
method?: string
|
||||
url?: string
|
||||
reqSignedIn?: bool
|
||||
reqRole?: string
|
||||
reqAction?: string
|
||||
// +listType=atomic
|
||||
headers?: [...string]
|
||||
body?: [string]: _
|
||||
tokenAuth?: {
|
||||
url?: string
|
||||
// +listType=set
|
||||
scopes?: [...string]
|
||||
params?: [string]: _
|
||||
}
|
||||
jwtTokenAuth?: {
|
||||
url?: string
|
||||
// +listType=set
|
||||
scopes?: [...string]
|
||||
params?: [string]: _
|
||||
}
|
||||
// +listType=atomic
|
||||
urlParams?: [...{
|
||||
name?: string
|
||||
content?: string
|
||||
}]
|
||||
}
|
||||
|
||||
#IAM: {
|
||||
// +listType=atomic
|
||||
permissions?: [...{
|
||||
action?: string
|
||||
scope?: string
|
||||
}]
|
||||
}
|
||||
|
||||
#Role: {
|
||||
role?: {
|
||||
name?: string
|
||||
description?: string
|
||||
// +listType=atomic
|
||||
permissions?: [...{
|
||||
action?: string
|
||||
scope?: string
|
||||
}]
|
||||
}
|
||||
// +listType=set
|
||||
grants?: [...string]
|
||||
}
|
||||
|
||||
#Extensions: {
|
||||
// +listType=atomic
|
||||
addedComponents?: [...{
|
||||
// +listType=set
|
||||
targets: [...string]
|
||||
title: string
|
||||
description?: string
|
||||
}]
|
||||
// +listType=atomic
|
||||
addedLinks?: [...{
|
||||
// +listType=set
|
||||
targets: [...string]
|
||||
title: string
|
||||
description?: string
|
||||
}]
|
||||
// +listType=set
|
||||
// +listMapKey=id
|
||||
exposedComponents?: [...{
|
||||
id: string
|
||||
title?: string
|
||||
description?: string
|
||||
}]
|
||||
// +listType=set
|
||||
// +listMapKey=id
|
||||
extensionPoints?: [...{
|
||||
id: string
|
||||
title?: string
|
||||
description?: string
|
||||
}]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user