plugins

package
v0.0.0-...-33942d2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2025 License: AGPL-3.0 Imports: 24 Imported by: 3

Documentation

Index

Constants

View Source
const (
	TypeDashboard = "dashboard"

	ActionAppAccess = "plugins.app:access"
)

Variables

View Source
var (

	// ErrPluginNotRegistered error returned when a plugin is not registered.
	ErrPluginNotRegistered = errPluginNotRegisteredBase.Errorf("plugin not registered")

	// ErrPluginUnavailable error returned when a plugin is unavailable.
	ErrPluginUnavailable = errPluginUnavailableBase.Errorf("plugin unavailable")

	// ErrMethodNotImplemented error returned when a plugin method is not implemented.
	ErrMethodNotImplemented = errMethodNotImplementedBase.Errorf("method not implemented")

	// ErrPluginHealthCheck error returned when a plugin fails its health check.
	// Exposed as a base error to wrap it with plugin error.
	ErrPluginHealthCheck = errutil.Internal("plugin.healthCheck",
		errutil.WithPublicMessage("Plugin health check failed"),
		errutil.WithDownstream())

	// ErrPluginRequestFailureErrorBase error returned when a plugin request fails.
	// Exposed as a base error to wrap it with plugin request errors.
	ErrPluginRequestFailureErrorBase = errutil.Internal("plugin.requestFailureError",
		errutil.WithPublicMessage("An error occurred within the plugin"),
		errutil.WithDownstream())

	// ErrPluginRequestCanceledErrorBase error returned when a plugin request
	// is cancelled by the client (context is cancelled).
	// Exposed as a base error to wrap it with plugin cancelled errors.
	ErrPluginRequestCanceledErrorBase = errutil.ClientClosedRequest("plugin.requestCanceled",
		errutil.WithPublicMessage("Plugin request canceled"))

	// ErrPluginGrpcResourceExhaustedBase error returned when a plugin response is larger than the grpc limit.
	// Exposed as a base error to wrap it with plugin resource exhausted errors.
	ErrPluginGrpcResourceExhaustedBase = errutil.Internal("plugin.resourceExhausted",
		errutil.WithPublicMessage("The response is too large. Please try to reduce the time range or narrow down your query to return fewer data points."),
		errutil.WithDownstream())

	ErrPluginGrpcConnectionUnavailableBaseFn = func(ctx context.Context) errutil.Base {
		pubMsg := "Data source became unavailable during request. Please try again."
		if requester, err := identity.GetRequester(ctx); err == nil && requester != nil {
			if namespace, err := types.ParseNamespace(requester.GetNamespace()); err == nil && namespace.StackID != 0 {
				pubMsg += " If the problem persists, please contact customer support."
			}
		}
		return errutil.Internal("plugin.connectionUnavailable", errutil.WithPublicMessage(pubMsg))
	}
)
View Source
var (
	ErrInstallCorePlugin   = errors.New("cannot install a Core plugin")
	ErrUninstallCorePlugin = errors.New("cannot uninstall a Core plugin")
	ErrPluginNotInstalled  = errors.New("plugin is not installed")
)
View Source
var (
	ErrFileNotExist              = errors.New("file does not exist")
	ErrPluginFileRead            = errors.New("file could not be read")
	ErrUninstallInvalidPluginDir = errors.New("cannot recognize as plugin folder")
	ErrInvalidPluginJSON         = errors.New("did not find valid type or id properties in plugin.json")
	ErrUnsupportedAlias          = errors.New("can not set alias in plugin.json")
)

Functions

func GetDatasourceGroupNameFromPluginID

func GetDatasourceGroupNameFromPluginID(pluginId string) (string, error)

Get the default API group name for from a plugin ID NOTE: this is a work in progress, and may change without notice

Types

type ActionSet

type ActionSet struct {
	Action  string   `json:"action"`
	Actions []string `json:"actions"`
}

ActionSet is the model for ActionSet in RBAC.

type AddOpts

type AddOpts struct {
	// contains filtered or unexported fields
}

func NewAddOpts

func NewAddOpts(grafanaVersion, os, arch, url string) AddOpts

func (AddOpts) Arch

func (co AddOpts) Arch() string

func (AddOpts) GrafanaVersion

func (co AddOpts) GrafanaVersion() string

func (AddOpts) OS

func (co AddOpts) OS() string

func (AddOpts) URL

func (co AddOpts) URL() string

type AddedComponent

type AddedComponent struct {
	Targets     []string `json:"targets"`
	Title       string   `json:"title"`
	Description string   `json:"description"`
}

type AddedFunction

type AddedFunction struct {
	Targets     []string `json:"targets"`
	Title       string   `json:"title"`
	Description string   `json:"description"`
}
type AddedLink struct {
	Targets     []string `json:"targets"`
	Title       string   `json:"title"`
	Description string   `json:"description"`
}

type AngularMeta

type AngularMeta struct {
	Detected bool `json:"detected"`
}

type AppDTO

type AppDTO struct {
	ID              string            `json:"id"`
	Path            string            `json:"path"`
	Version         string            `json:"version"`
	Preload         bool              `json:"preload"`
	Angular         AngularMeta       `json:"angular"`
	LoadingStrategy LoadingStrategy   `json:"loadingStrategy"`
	Extensions      Extensions        `json:"extensions"`
	Dependencies    Dependencies      `json:"dependencies"`
	ModuleHash      string            `json:"moduleHash,omitempty"`
	Translations    map[string]string `json:"translations,omitempty"`
}

type BackendFactoryProvider

type BackendFactoryProvider interface {
	BackendFactory(ctx context.Context, p *Plugin) backendplugin.PluginFactoryFunc
}

BackendFactoryProvider provides a backend factory for a provided plugin.

type BuildInfo

type BuildInfo struct {
	Time int64 `json:"time,omitempty"`
}

type Class

type Class string
const (
	ClassCore     Class = "core"
	ClassExternal Class = "external"
	ClassCDN      Class = "cdn"
)

func (Class) String

func (c Class) String() string

type Client

type Client interface {
	backend.Handler
}

Client is used to communicate with backend plugin implementations.

type DataSourceDTO

type DataSourceDTO struct {
	ID         int64          `json:"id,omitempty"`
	UID        string         `json:"uid,omitempty"`
	Type       string         `json:"type"`
	Name       string         `json:"name"`
	PluginMeta *PluginMetaDTO `json:"meta"`
	URL        string         `json:"url,omitempty"`
	IsDefault  bool           `json:"isDefault"`
	Access     string         `json:"access,omitempty"`
	Preload    bool           `json:"preload"`
	Module     string         `json:"module,omitempty"`
	JSONData   map[string]any `json:"jsonData"`
	ReadOnly   bool           `json:"readOnly"`
	APIVersion string         `json:"apiVersion,omitempty"`

	BasicAuth       string `json:"basicAuth,omitempty"`
	WithCredentials bool   `json:"withCredentials,omitempty"`

	// This is populated by an Enterprise hook
	CachingConfig QueryCachingConfig `json:"cachingConfig,omitempty"`

	// InfluxDB
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`

	// InfluxDB + Elasticsearch
	Database string `json:"database,omitempty"`

	// Prometheus
	DirectURL string `json:"directUrl,omitempty"`
}

type Dependencies

type Dependencies struct {
	GrafanaDependency string                 `json:"grafanaDependency"`
	GrafanaVersion    string                 `json:"grafanaVersion"`
	Plugins           []Dependency           `json:"plugins"`
	Extensions        ExtensionsDependencies `json:"extensions"`
}

type Dependency

type Dependency struct {
	ID   string `json:"id"`
	Type string `json:"type"`
	Name string `json:"name"`
}

type DuplicateError

type DuplicateError struct {
	PluginID string
}

func (DuplicateError) Error

func (e DuplicateError) Error() string

func (DuplicateError) Is

func (e DuplicateError) Is(err error) bool

type Error

type Error struct {
	ErrorCode       `json:"errorCode"`
	PluginID        string          `json:"pluginId,omitempty"`
	SignatureStatus SignatureStatus `json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (Error) AsErrorCode

func (e Error) AsErrorCode() ErrorCode

func (Error) Error

func (e Error) Error() string

func (Error) PublicMessage

func (e Error) PublicMessage() string

func (*Error) WithMessage

func (e *Error) WithMessage(m string) *Error

type ErrorCode

type ErrorCode string
const (
	ErrorCodeSignatureMissing   ErrorCode = "signatureMissing"
	ErrorCodeSignatureModified  ErrorCode = "signatureModified"
	ErrorCodeSignatureInvalid   ErrorCode = "signatureInvalid"
	ErrorCodeFailedBackendStart ErrorCode = "failedBackendStart"
	ErrorAngular                ErrorCode = "angular"
)

type ErrorResolver

type ErrorResolver interface {
	PluginErrors(ctx context.Context) []*Error
	PluginError(ctx context.Context, pluginID string) *Error
}

type ExposedComponent

type ExposedComponent struct {
	Id          string `json:"id"`
	Title       string `json:"title"`
	Description string `json:"description"`
}

type ExtensionPoint

type ExtensionPoint struct {
	Id          string `json:"id"`
	Title       string `json:"title"`
	Description string `json:"description"`
}

type ExtensionV1

type ExtensionV1 struct {
	ExtensionPointID string `json:"extensionPointId"`
	Title            string `json:"title"`
	Description      string `json:"description"`
	Type             string `json:"type"`
}

We need different versions for the Extensions struct because there is a now deprecated plugin.json schema out there, where the "extensions" prop is in a different format (Extensions V1). In order to support those as well while reading the plugin.json, we need to add a custom unmarshaling logic for extensions.

type Extensions

type Extensions ExtensionsV2

func (*Extensions) UnmarshalJSON

func (e *Extensions) UnmarshalJSON(data []byte) error

type ExtensionsDependencies

type ExtensionsDependencies struct {
	ExposedComponents []string `json:"exposedComponents"`
}

type ExtensionsV2

type ExtensionsV2 struct {
	AddedLinks        []AddedLink        `json:"addedLinks"`
	AddedComponents   []AddedComponent   `json:"addedComponents"`
	ExposedComponents []ExposedComponent `json:"exposedComponents"`
	ExtensionPoints   []ExtensionPoint   `json:"extensionPoints"`
	AddedFunctions    []AddedFunction    `json:"addedFunctions"`
}

type FS

type FS interface {
	fs.FS

	Base() string
	Files() ([]string, error)
	Rel(string) (string, error)
}

func NewFakeFS

func NewFakeFS() FS

NewFakeFS returns a new FS that always returns ErrFileNotExist when trying to Open() and empty Files().

func NewInMemoryFS

func NewInMemoryFS(files map[string][]byte) FS

NewInMemoryFS returns a new FS with the specified files and content. The provided value is a map from file name (keys) to file content (values).

type FSRemover

type FSRemover interface {
	Remove() error
}

type File

type File struct {
	Content []byte
	ModTime time.Time
}

type FileStore

type FileStore interface {
	// File retrieves a plugin file.
	File(ctx context.Context, pluginID, pluginVersion, filename string) (*File, error)
}

type FoundBundle

type FoundBundle struct {
	Primary  FoundPlugin
	Children []*FoundPlugin
}

type FoundPlugin

type FoundPlugin struct {
	JSONData JSONData
	FS       FS
}
type Header struct {
	Name    string `json:"name"`
	Content string `json:"content"`
}

Header describes an HTTP header that is forwarded with the proxied request for a plugin route

type Includes

type Includes struct {
	Name       string       `json:"name"`
	Path       string       `json:"path"`
	Type       string       `json:"type"`
	Component  string       `json:"component"`
	Role       org.RoleType `json:"role"`
	Action     string       `json:"action,omitempty"`
	AddToNav   bool         `json:"addToNav"`
	DefaultNav bool         `json:"defaultNav"`
	Slug       string       `json:"slug"`
	Icon       string       `json:"icon"`
	UID        string       `json:"uid"`

	ID string `json:"-"`
}

func (Includes) DashboardURLPath

func (e Includes) DashboardURLPath() string

func (Includes) RequiresRBACAction

func (e Includes) RequiresRBACAction() bool

type Info

type Info struct {
	Author      InfoLink      `json:"author"`
	Description string        `json:"description"`
	Links       []InfoLink    `json:"links"`
	Logos       Logos         `json:"logos"`
	Build       BuildInfo     `json:"build"`
	Screenshots []Screenshots `json:"screenshots"`
	Version     string        `json:"version"`
	Updated     string        `json:"updated"`
	Keywords    []string      `json:"keywords"`
}
type InfoLink struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

type Installer

type Installer interface {
	// Add adds a new plugin.
	Add(ctx context.Context, pluginID, version string, opts AddOpts) error
	// Remove removes an existing plugin.
	Remove(ctx context.Context, pluginID, version string) error
}

type JSONData

type JSONData struct {
	// Common settings
	ID           string       `json:"id"`
	Type         Type         `json:"type"`
	Name         string       `json:"name"`
	AliasIDs     []string     `json:"aliasIDs,omitempty"`
	Info         Info         `json:"info"`
	Dependencies Dependencies `json:"dependencies"`
	Includes     []*Includes  `json:"includes"`
	State        ReleaseState `json:"state,omitempty"`
	Category     string       `json:"category"`
	HideFromList bool         `json:"hideFromList,omitempty"`
	Preload      bool         `json:"preload"`
	Backend      bool         `json:"backend"`
	Routes       []*Route     `json:"routes"`

	// AccessControl settings
	Roles      []RoleRegistration `json:"roles,omitempty"`
	ActionSets []ActionSet        `json:"actionSets,omitempty"`

	// Panel settings
	SkipDataQuery bool `json:"skipDataQuery"`

	// App settings
	AutoEnabled bool       `json:"autoEnabled"`
	Extensions  Extensions `json:"extensions"`

	// Datasource settings
	Annotations               bool            `json:"annotations"`
	Metrics                   bool            `json:"metrics"`
	Alerting                  bool            `json:"alerting"`
	Explore                   bool            `json:"explore"`
	Table                     bool            `json:"tables"`
	Logs                      bool            `json:"logs"`
	Tracing                   bool            `json:"tracing"`
	QueryOptions              map[string]bool `json:"queryOptions,omitempty"`
	BuiltIn                   bool            `json:"builtIn,omitempty"`
	Mixed                     bool            `json:"mixed,omitempty"`
	Streaming                 bool            `json:"streaming"`
	SDK                       bool            `json:"sdk,omitempty"`
	MultiValueFilterOperators bool            `json:"multiValueFilterOperators,omitempty"`

	// Backend (Datasource + Renderer)
	Executable string `json:"executable,omitempty"`

	// App Service Auth Registration
	IAM *auth.IAM `json:"iam,omitempty"`

	// List of languages supported by the plugin
	Languages []string `json:"languages,omitempty"`
}

JSONData represents the plugin's plugin.json

func ReadPluginJSON

func ReadPluginJSON(reader io.Reader) (JSONData, error)

func (JSONData) DashboardIncludes

func (d JSONData) DashboardIncludes() []*Includes

type JWTTokenAuth

type JWTTokenAuth struct {
	Url    string            `json:"url"`
	Scopes []string          `json:"scopes"`
	Params map[string]string `json:"params"`
}

JWTTokenAuth struct is both for normal Token Auth and JWT Token Auth with an uploaded JWT file.

type KeyRetriever

type KeyRetriever interface {
	GetPublicKey(ctx context.Context, keyID string) (string, error)
}

type KeyStore

type KeyStore interface {
	Get(ctx context.Context, key string) (string, bool, error)
	Set(ctx context.Context, key string, value any) error
	Delete(ctx context.Context, key string) error
	ListKeys(ctx context.Context) ([]string, error)
	GetLastUpdated(ctx context.Context) (time.Time, error)
	SetLastUpdated(ctx context.Context) error
}

type Licensing

type Licensing interface {
	Environment() []string
	Edition() string
	Path() string
	AppURL() string
	ContentDeliveryPrefix() string
}

type LoadingStrategy

type LoadingStrategy string
const (
	LoadingStrategyFetch  LoadingStrategy = "fetch"
	LoadingStrategyScript LoadingStrategy = "script"
)

type LocalFS

type LocalFS struct {
	// contains filtered or unexported fields
}

LocalFS is a plugins.FS that allows accessing files on the local file system.

func NewLocalFS

func NewLocalFS(basePath string) LocalFS

NewLocalFS returns a new LocalFS that can access any file in the specified base path on the filesystem. basePath must use os-specific path separator for Open() to work properly.

func (LocalFS) Base

func (f LocalFS) Base() string

Base returns the base path for the LocalFS. The returned string uses os-specific path separator.

func (LocalFS) Files

func (f LocalFS) Files() ([]string, error)

Files returns a slice of all the relative file paths on the LocalFS. The returned strings can be passed to Open() to open those files. The returned strings use os-specific path separator.

func (LocalFS) Open

func (f LocalFS) Open(name string) (fs.File, error)

Open opens the specified file on the local filesystem. The provided name must be a relative file name that uses os-specific path separators. The function returns the corresponding fs.File for accessing the file on the local filesystem. If a nil error is returned, the caller should take care of calling Close() the returned fs.File. If the file does not exist, ErrFileNotExist is returned.

func (LocalFS) Rel

func (f LocalFS) Rel(p string) (string, error)

func (LocalFS) Remove

func (f LocalFS) Remove() error

Remove removes a plugin from the local filesystem by deleting all files in the folder. It returns ErrUninstallInvalidPluginDir is the plugin does not contain plugin.json nor dist/plugin.json.

type LocalFile

type LocalFile struct {
	// contains filtered or unexported fields
}

LocalFile implements a fs.File for accessing the local filesystem.

func (*LocalFile) Close

func (p *LocalFile) Close() error

Close closes the file. If the file was never open, nil is returned. If the file is already closed, an error is returned.

func (*LocalFile) Read

func (p *LocalFile) Read(b []byte) (int, error)

Read reads up to len(b) bytes from the File and stores them in b. It returns the number of bytes read and any error encountered. At end of file, Read returns 0, io.EOF. If the file is already open, it is opened again, without closing it first. The file is not closed at the end of the read operation. If a non-nil error is returned, it must be manually closed by the caller by calling Close().

func (*LocalFile) Stat

func (p *LocalFile) Stat() (fs.FileInfo, error)

Stat returns a FileInfo describing the named file. It returns ErrFileNotExist if the file does not exist, or ErrPluginFileRead if another error occurs.

type Logos

type Logos struct {
	Small string `json:"small"`
	Large string `json:"large"`
}

type NotFoundError

type NotFoundError struct {
	PluginID string
}

func (NotFoundError) Error

func (e NotFoundError) Error() string

type PanelDTO

type PanelDTO struct {
	ID              string            `json:"id"`
	Name            string            `json:"name"`
	AliasIDs        []string          `json:"aliasIds,omitempty"`
	Info            Info              `json:"info"`
	HideFromList    bool              `json:"hideFromList"`
	Sort            int               `json:"sort"`
	SkipDataQuery   bool              `json:"skipDataQuery"`
	ReleaseState    string            `json:"state"`
	BaseURL         string            `json:"baseUrl"`
	Signature       string            `json:"signature"`
	Module          string            `json:"module"`
	Angular         AngularMeta       `json:"angular"`
	LoadingStrategy LoadingStrategy   `json:"loadingStrategy"`
	ModuleHash      string            `json:"moduleHash,omitempty"`
	Translations    map[string]string `json:"translations,omitempty"`
}

type Permission

type Permission struct {
	Action string `json:"action"`
	Scope  string `json:"scope"`
}

type Plugin

type Plugin struct {
	JSONData

	FS    FS
	Class Class

	// App fields
	IncludedInAppID string
	DefaultNavURL   string
	Pinned          bool

	// Signature fields
	Signature     SignatureStatus
	SignatureType SignatureType
	SignatureOrg  string
	Parent        *Plugin
	Children      []*Plugin
	Error         *Error

	// SystemJS fields
	Module  string
	BaseURL string

	Angular AngularMeta

	ExternalService *auth.ExternalService

	Renderer pluginextensionv2.RendererPlugin

	SkipHostEnvVars bool

	Translations map[string]string
	// contains filtered or unexported fields
}

func (*Plugin) CallResource

func (*Plugin) CheckHealth

func (*Plugin) Client

func (p *Plugin) Client() (PluginClient, bool)

func (*Plugin) CollectMetrics

func (*Plugin) ConvertObjects

ConvertObject implements backend.AdmissionHandler.

func (*Plugin) Decommission

func (p *Plugin) Decommission() error

func (*Plugin) ExecutablePath

func (p *Plugin) ExecutablePath() string

func (*Plugin) Exited

func (p *Plugin) Exited() bool

func (*Plugin) File

func (p *Plugin) File(name string) (fs.File, error)

func (*Plugin) IsApp

func (p *Plugin) IsApp() bool

func (*Plugin) IsCorePlugin

func (p *Plugin) IsCorePlugin() bool

func (*Plugin) IsDecommissioned

func (p *Plugin) IsDecommissioned() bool

func (*Plugin) IsExternalPlugin

func (p *Plugin) IsExternalPlugin() bool

func (*Plugin) IsManaged

func (p *Plugin) IsManaged() bool

func (*Plugin) IsRenderer

func (p *Plugin) IsRenderer() bool

func (*Plugin) Logger

func (p *Plugin) Logger() log.Logger

func (*Plugin) MutateAdmission

func (p *Plugin) MutateAdmission(ctx context.Context, req *backend.AdmissionRequest) (*backend.MutationResponse, error)

MutateAdmission implements backend.AdmissionHandler.

func (*Plugin) PluginID

func (p *Plugin) PluginID() string

func (*Plugin) PublishStream

func (*Plugin) QueryData

func (*Plugin) RegisterClient

func (p *Plugin) RegisterClient(c backendplugin.Plugin)

func (*Plugin) RunStream

func (p *Plugin) RunStream(ctx context.Context, req *backend.RunStreamRequest, sender *backend.StreamSender) error

func (*Plugin) SetLogger

func (p *Plugin) SetLogger(l log.Logger)

func (*Plugin) Start

func (p *Plugin) Start(ctx context.Context) error

func (*Plugin) StaticRoute

func (p *Plugin) StaticRoute() *StaticRoute

func (*Plugin) Stop

func (p *Plugin) Stop(ctx context.Context) error

func (*Plugin) Target

func (p *Plugin) Target() backendplugin.Target

func (*Plugin) ValidateAdmission

func (p *Plugin) ValidateAdmission(ctx context.Context, req *backend.AdmissionRequest) (*backend.ValidationResponse, error)

ValidateAdmission implements backend.AdmissionHandler.

type PluginLoaderAuthorizer

type PluginLoaderAuthorizer interface {
	// CanLoadPlugin confirms if a plugin is authorized to load
	CanLoadPlugin(plugin *Plugin) bool
}

type PluginMetaDTO

type PluginMetaDTO struct {
	JSONData
	Signature                 SignatureStatus   `json:"signature"`
	Module                    string            `json:"module"`
	ModuleHash                string            `json:"moduleHash,omitempty"`
	BaseURL                   string            `json:"baseUrl"`
	Angular                   AngularMeta       `json:"angular"`
	MultiValueFilterOperators bool              `json:"multiValueFilterOperators"`
	LoadingStrategy           LoadingStrategy   `json:"loadingStrategy"`
	Extensions                Extensions        `json:"extensions"`
	Translations              map[string]string `json:"translations,omitempty"`
}

type PluginSource

type PluginSource interface {
	// PluginClass is the associated Class of plugin for this source
	PluginClass(ctx context.Context) Class
	// DefaultSignature is the (optional) default signature information for this source
	DefaultSignature(ctx context.Context, pluginID string) (Signature, bool)
	// Discover finds and returns plugin bundles from this source
	Discover(ctx context.Context) ([]*FoundBundle, error)
}

type QueryCachingConfig

type QueryCachingConfig struct {
	Enabled bool  `json:"enabled"`
	TTLMS   int64 `json:"TTLMs"`
}

type ReleaseState

type ReleaseState string
const (
	ReleaseStateAlpha ReleaseState = "alpha"
)

type Role

type Role struct {
	Name        string       `json:"name"`
	Description string       `json:"description"`
	Permissions []Permission `json:"permissions"`
}

Role is the model for Role in RBAC.

type RoleRegistration

type RoleRegistration struct {
	Role   Role     `json:"role"`
	Grants []string `json:"grants"`
}

RoleRegistration stores a role and its assignments to basic roles (Viewer, Editor, Admin, Grafana Admin)

type Route

type Route struct {
	Path         string          `json:"path"`
	Method       string          `json:"method"`
	ReqRole      org.RoleType    `json:"reqRole"`
	ReqAction    string          `json:"reqAction"`
	URL          string          `json:"url"`
	URLParams    []URLParam      `json:"urlParams"`
	Headers      []Header        `json:"headers"`
	AuthType     string          `json:"authType"`
	TokenAuth    *JWTTokenAuth   `json:"tokenAuth"`
	JwtTokenAuth *JWTTokenAuth   `json:"jwtTokenAuth"`
	Body         json.RawMessage `json:"body"`
}

Route describes a plugin route that is defined in the plugin.json file for a plugin.

type Screenshots

type Screenshots struct {
	Name string `json:"name"`
	Path string `json:"path"`
}

type Signature

type Signature struct {
	Status     SignatureStatus
	Type       SignatureType
	SigningOrg string
}

type SignatureCalculator

type SignatureCalculator interface {
	Calculate(ctx context.Context, src PluginSource, plugin FoundPlugin) (Signature, error)
}

type SignatureStatus

type SignatureStatus string
const (
	SignatureStatusInternal SignatureStatus = "internal" // core plugin, no signature
	SignatureStatusValid    SignatureStatus = "valid"    // signed and accurate MANIFEST
	SignatureStatusInvalid  SignatureStatus = "invalid"  // invalid signature
	SignatureStatusModified SignatureStatus = "modified" // valid signature, but content mismatch
	SignatureStatusUnsigned SignatureStatus = "unsigned" // no MANIFEST file
)

func (SignatureStatus) IsInternal

func (ss SignatureStatus) IsInternal() bool

func (SignatureStatus) IsValid

func (ss SignatureStatus) IsValid() bool

type SignatureType

type SignatureType string
const (
	SignatureTypeGrafana     SignatureType = "grafana"
	SignatureTypeCommercial  SignatureType = "commercial"
	SignatureTypeCommunity   SignatureType = "community"
	SignatureTypePrivate     SignatureType = "private"
	SignatureTypePrivateGlob SignatureType = "private-glob"
)

func (SignatureType) IsValid

func (s SignatureType) IsValid() bool

type StaticFS

type StaticFS struct {
	FS
	// contains filtered or unexported fields
}

StaticFS wraps an FS and allows accessing only the files in the allowList. This is a more secure implementation of a FS suitable for production environments. The keys of the allow list must be in the same format used by the underlying FS' Open() method.

func NewStaticFS

func NewStaticFS(fs FS) (StaticFS, error)

NewStaticFS returns a new StaticFS that can access the files on an underlying FS, but only if they are also specified in a static list, which is constructed when creating the object by calling Files() on the underlying FS.

func (StaticFS) Files

func (f StaticFS) Files() ([]string, error)

Files returns a slice of all static file paths relative to the base path.

func (StaticFS) Open

func (f StaticFS) Open(name string) (fs.File, error)

Open checks that name is an allowed file and, if so, it returns a fs.File to access it, by calling the underlying FS' Open() method. If access is denied, the function returns ErrFileNotExist.

func (StaticFS) Remove

func (f StaticFS) Remove() error

type StaticRoute

type StaticRoute struct {
	PluginID  string
	Directory string
}

type StaticRouteResolver

type StaticRouteResolver interface {
	Routes(ctx context.Context) []*StaticRoute
}

type Type

type Type string
const (
	TypeDataSource Type = "datasource"
	TypePanel      Type = "panel"
	TypeApp        Type = "app"
	TypeRenderer   Type = "renderer"
)

func (Type) IsValid

func (pt Type) IsValid() bool

type URLParam

type URLParam struct {
	Name    string `json:"name"`
	Content string `json:"content"`
}

URLParam describes query string parameters for a url in a plugin route

type UpdateInfo

type UpdateInfo struct {
	PluginZipURL string
}

Directories

Path Synopsis
Package backendplugin contains backend plugin related logic.
Package backendplugin contains backend plugin related logic.
pipeline/termination
Package termination defines the Termination stage of the plugin loader pipeline.
Package termination defines the Termination stage of the plugin loader pipeline.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL