2023-03-20 08:35:49 -05:00
|
|
|
package sources
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/grafana/grafana/pkg/plugins"
|
|
|
|
)
|
|
|
|
|
|
|
|
type LocalSource struct {
|
|
|
|
paths []string
|
|
|
|
class plugins.Class
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewLocalSource(class plugins.Class, paths []string) *LocalSource {
|
|
|
|
return &LocalSource{
|
|
|
|
class: class,
|
|
|
|
paths: paths,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *LocalSource) PluginClass(_ context.Context) plugins.Class {
|
|
|
|
return s.class
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *LocalSource) PluginURIs(_ context.Context) []string {
|
|
|
|
return s.paths
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *LocalSource) DefaultSignature(_ context.Context) (plugins.Signature, bool) {
|
|
|
|
switch s.class {
|
2023-06-08 05:21:19 -05:00
|
|
|
case plugins.ClassCore:
|
2023-03-20 08:35:49 -05:00
|
|
|
return plugins.Signature{
|
2023-06-08 05:21:19 -05:00
|
|
|
Status: plugins.SignatureStatusInternal,
|
2023-03-20 08:35:49 -05:00
|
|
|
}, true
|
|
|
|
default:
|
|
|
|
return plugins.Signature{}, false
|
|
|
|
}
|
|
|
|
}
|