2016-01-09 16:34:20 -06:00
|
|
|
package plugins
|
|
|
|
|
|
|
|
import "encoding/json"
|
|
|
|
|
|
|
|
type DataSourcePlugin struct {
|
|
|
|
FrontendPluginBase
|
2016-03-08 11:17:47 -06:00
|
|
|
Annotations bool `json:"annotations"`
|
|
|
|
Metrics bool `json:"metrics"`
|
2016-09-27 11:36:00 -05:00
|
|
|
Alerting bool `json:"alerting"`
|
2016-03-08 11:17:47 -06:00
|
|
|
BuiltIn bool `json:"builtIn"`
|
|
|
|
Mixed bool `json:"mixed"`
|
|
|
|
App string `json:"app"`
|
2016-01-09 16:34:20 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *DataSourcePlugin) Load(decoder *json.Decoder, pluginDir string) error {
|
|
|
|
if err := decoder.Decode(&p); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2016-02-10 04:03:12 -06:00
|
|
|
if err := p.registerPlugin(pluginDir); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2016-01-09 16:34:20 -06:00
|
|
|
|
2016-02-10 04:03:12 -06:00
|
|
|
DataSources[p.Id] = p
|
2016-01-09 16:34:20 -06:00
|
|
|
return nil
|
|
|
|
}
|