Datasources: Add wireset for datasource.DataSourceAPIBuilder (#80914)

tidy up
This commit is contained in:
Will Browne
2024-01-22 15:21:27 +01:00
committed by GitHub
parent f3c64a7337
commit 2a0f1900d5
4 changed files with 18 additions and 10 deletions
+5 -8
View File
@@ -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,
)
}