mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Datasources: Add wireset for datasource.DataSourceAPIBuilder (#80914)
tidy up
This commit is contained in:
@@ -8,16 +8,13 @@ import (
|
||||
|
||||
common "github.com/grafana/grafana/pkg/apis/common/v0alpha1"
|
||||
"github.com/grafana/grafana/pkg/plugins"
|
||||
"github.com/grafana/grafana/pkg/services/accesscontrol/acimpl"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
testdatasource "github.com/grafana/grafana/pkg/tsdb/grafana-testdata-datasource"
|
||||
)
|
||||
|
||||
// NewStandaloneDatasource is a helper function to create a new datasource API server for a group.
|
||||
// This currently has no dependencies and only works for testdata. In future iterations
|
||||
// this will include here (or elsewhere) versions that can load config from HG api or
|
||||
// the remote SQL directly.
|
||||
func NewStandaloneDatasource(group string) (*DataSourceAPIBuilder, error) {
|
||||
// NewTestDataAPIServer is a helper function to create a new datasource API server for a group.
|
||||
// This currently builds its dependencies manually and only works for testdata.
|
||||
func NewTestDataAPIServer(group string) (*DataSourceAPIBuilder, error) {
|
||||
pluginID := "grafana-testdata-datasource"
|
||||
|
||||
if group != "testdata.datasource.grafana.app" {
|
||||
@@ -31,7 +28,7 @@ func NewStandaloneDatasource(group string) (*DataSourceAPIBuilder, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_, pluginStore, dsService, dsCache, err := apiBuilderServices(cfg, pluginID)
|
||||
accessControl, pluginStore, dsService, dsCache, err := apiBuilderServices(cfg, pluginID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -49,7 +46,7 @@ func NewStandaloneDatasource(group string) (*DataSourceAPIBuilder, error) {
|
||||
td.JSONData,
|
||||
NewQuerierProvider(testsDataQuerierFactory),
|
||||
&TestDataPluginContextProvider{},
|
||||
acimpl.ProvideAccessControl(cfg),
|
||||
accessControl,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user