datasource_plugin.go 634 B

1234567891011121314151617181920212223242526
  1. package plugins
  2. import "encoding/json"
  3. type DataSourcePlugin struct {
  4. FrontendPluginBase
  5. Annotations bool `json:"annotations"`
  6. Metrics bool `json:"metrics"`
  7. Alerting bool `json:"alerting"`
  8. BuiltIn bool `json:"builtIn"`
  9. Mixed bool `json:"mixed"`
  10. Routes []*AppPluginRoute `json:"routes"`
  11. }
  12. func (p *DataSourcePlugin) Load(decoder *json.Decoder, pluginDir string) error {
  13. if err := decoder.Decode(&p); err != nil {
  14. return err
  15. }
  16. if err := p.registerPlugin(pluginDir); err != nil {
  17. return err
  18. }
  19. DataSources[p.Id] = p
  20. return nil
  21. }