backend/datasources: move datasources models into the datasources service package (#51267)
* backend/datasources: move datasources models into the datasources service pkg
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
sdkhttpclient "github.com/grafana/grafana-plugin-sdk-go/backend/httpclient"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/httpclient"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
)
|
||||
@@ -12,51 +13,51 @@ import (
|
||||
// DataSourceService interface for interacting with datasources.
|
||||
type DataSourceService interface {
|
||||
// GetDataSource gets a datasource.
|
||||
GetDataSource(ctx context.Context, query *models.GetDataSourceQuery) error
|
||||
GetDataSource(ctx context.Context, query *GetDataSourceQuery) error
|
||||
|
||||
// GetDataSources gets datasources.
|
||||
GetDataSources(ctx context.Context, query *models.GetDataSourcesQuery) error
|
||||
GetDataSources(ctx context.Context, query *GetDataSourcesQuery) error
|
||||
|
||||
// GetDataSourcesByType gets datasources by type.
|
||||
GetDataSourcesByType(ctx context.Context, query *models.GetDataSourcesByTypeQuery) error
|
||||
GetDataSourcesByType(ctx context.Context, query *GetDataSourcesByTypeQuery) error
|
||||
|
||||
// AddDataSource adds a new datasource.
|
||||
AddDataSource(ctx context.Context, cmd *models.AddDataSourceCommand) error
|
||||
AddDataSource(ctx context.Context, cmd *AddDataSourceCommand) error
|
||||
|
||||
// DeleteDataSource deletes an existing datasource.
|
||||
DeleteDataSource(ctx context.Context, cmd *models.DeleteDataSourceCommand) error
|
||||
DeleteDataSource(ctx context.Context, cmd *DeleteDataSourceCommand) error
|
||||
|
||||
// UpdateDataSource updates an existing datasource.
|
||||
UpdateDataSource(ctx context.Context, cmd *models.UpdateDataSourceCommand) error
|
||||
UpdateDataSource(ctx context.Context, cmd *UpdateDataSourceCommand) error
|
||||
|
||||
// GetDefaultDataSource gets the default datasource.
|
||||
GetDefaultDataSource(ctx context.Context, query *models.GetDefaultDataSourceQuery) error
|
||||
GetDefaultDataSource(ctx context.Context, query *GetDefaultDataSourceQuery) error
|
||||
|
||||
// GetHTTPTransport gets a datasource specific HTTP transport.
|
||||
GetHTTPTransport(ctx context.Context, ds *models.DataSource, provider httpclient.Provider, customMiddlewares ...sdkhttpclient.Middleware) (http.RoundTripper, error)
|
||||
GetHTTPTransport(ctx context.Context, ds *DataSource, provider httpclient.Provider, customMiddlewares ...sdkhttpclient.Middleware) (http.RoundTripper, error)
|
||||
|
||||
// DecryptedValues decrypts the encrypted secureJSONData of the provided datasource and
|
||||
// returns the decrypted values.
|
||||
DecryptedValues(ctx context.Context, ds *models.DataSource) (map[string]string, error)
|
||||
DecryptedValues(ctx context.Context, ds *DataSource) (map[string]string, error)
|
||||
|
||||
// DecryptedValue decrypts the encrypted datasource secureJSONData identified by key
|
||||
// and returns the decrypted value.
|
||||
DecryptedValue(ctx context.Context, ds *models.DataSource, key string) (string, bool, error)
|
||||
DecryptedValue(ctx context.Context, ds *DataSource, key string) (string, bool, error)
|
||||
|
||||
// DecryptedBasicAuthPassword decrypts the encrypted datasource basic authentication
|
||||
// password and returns the decrypted value.
|
||||
DecryptedBasicAuthPassword(ctx context.Context, ds *models.DataSource) (string, error)
|
||||
DecryptedBasicAuthPassword(ctx context.Context, ds *DataSource) (string, error)
|
||||
|
||||
// DecryptedPassword decrypts the encrypted datasource password and returns the
|
||||
// decrypted value.
|
||||
DecryptedPassword(ctx context.Context, ds *models.DataSource) (string, error)
|
||||
DecryptedPassword(ctx context.Context, ds *DataSource) (string, error)
|
||||
}
|
||||
|
||||
// CacheService interface for retrieving a cached datasource.
|
||||
type CacheService interface {
|
||||
// GetDatasource gets a datasource identified by datasource numeric identifier.
|
||||
GetDatasource(ctx context.Context, datasourceID int64, user *models.SignedInUser, skipCache bool) (*models.DataSource, error)
|
||||
GetDatasource(ctx context.Context, datasourceID int64, user *models.SignedInUser, skipCache bool) (*DataSource, error)
|
||||
|
||||
// GetDatasourceByUID gets a datasource identified by datasource unique identifier (UID).
|
||||
GetDatasourceByUID(ctx context.Context, datasourceUID string, user *models.SignedInUser, skipCache bool) (*models.DataSource, error)
|
||||
GetDatasourceByUID(ctx context.Context, datasourceUID string, user *models.SignedInUser, skipCache bool) (*DataSource, error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user