service

package
v0.0.0-testrgm3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2023 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCacheTTL = 5 * time.Second
)

Variables

This section is empty.

Functions

func NewIDScopeResolver

NewIDScopeResolver provides an ScopeAttributeResolver able to translate a scope prefixed with "datasources:id:" into an uid based scope.

func NewNameScopeResolver

NewNameScopeResolver provides an ScopeAttributeResolver able to translate a scope prefixed with "datasources:name:" into an uid based scope.

Types

type CacheServiceImpl

type CacheServiceImpl struct {
	CacheService *localcache.CacheService
	SQLStore     db.DB
	// contains filtered or unexported fields
}

func ProvideCacheService

func ProvideCacheService(cacheService *localcache.CacheService, sqlStore db.DB) *CacheServiceImpl

func (*CacheServiceImpl) GetDatasource

func (dc *CacheServiceImpl) GetDatasource(
	ctx context.Context,
	datasourceID int64,
	user *user.SignedInUser,
	skipCache bool,
) (*datasources.DataSource, error)

func (*CacheServiceImpl) GetDatasourceByUID

func (dc *CacheServiceImpl) GetDatasourceByUID(
	ctx context.Context,
	datasourceUID string,
	user *user.SignedInUser,
	skipCache bool,
) (*datasources.DataSource, error)

type DataSourceRetriever

type DataSourceRetriever interface {
	// GetDataSource gets a datasource.
	GetDataSource(ctx context.Context, query *datasources.GetDataSourceQuery) (*datasources.DataSource, error)
}

DataSourceRetriever interface for retrieving a datasource.

type Service

type Service struct {
	SQLStore       Store
	SecretsStore   kvstore.SecretsKVStore
	SecretsService secrets.Service
	// contains filtered or unexported fields
}

func ProvideService

func ProvideService(
	db db.DB, secretsService secrets.Service, secretsStore kvstore.SecretsKVStore, cfg *setting.Cfg,
	features featuremgmt.FeatureToggles, ac accesscontrol.AccessControl, datasourcePermissionsService accesscontrol.DatasourcePermissionsService,
	quotaService quota.Service,
) (*Service, error)

func (*Service) AddDataSource

func (*Service) CustomHeaders

func (s *Service) CustomHeaders(ctx context.Context, ds *datasources.DataSource) (map[string]string, error)

CustomerHeaders returns the custom headers specified in the datasource. The context is used for the decryption operation that might use the store, so consider setting an acceptable timeout for your use case.

func (*Service) DecryptedBasicAuthPassword

func (s *Service) DecryptedBasicAuthPassword(ctx context.Context, ds *datasources.DataSource) (string, error)

func (*Service) DecryptedPassword

func (s *Service) DecryptedPassword(ctx context.Context, ds *datasources.DataSource) (string, error)

func (*Service) DecryptedValue

func (s *Service) DecryptedValue(ctx context.Context, ds *datasources.DataSource, key string) (string, bool, error)

func (*Service) DecryptedValues

func (s *Service) DecryptedValues(ctx context.Context, ds *datasources.DataSource) (map[string]string, error)

func (*Service) DeleteDataSource

func (s *Service) DeleteDataSource(ctx context.Context, cmd *datasources.DeleteDataSourceCommand) error

func (*Service) GetAllDataSources

func (s *Service) GetAllDataSources(ctx context.Context, query *datasources.GetAllDataSourcesQuery) (res []*datasources.DataSource, err error)

func (*Service) GetDataSource

func (*Service) GetDataSources

func (s *Service) GetDataSources(ctx context.Context, query *datasources.GetDataSourcesQuery) ([]*datasources.DataSource, error)

func (*Service) GetDataSourcesByType

func (s *Service) GetDataSourcesByType(ctx context.Context, query *datasources.GetDataSourcesByTypeQuery) ([]*datasources.DataSource, error)

func (*Service) GetDefaultDataSource

func (s *Service) GetDefaultDataSource(ctx context.Context, query *datasources.GetDefaultDataSourceQuery) (*datasources.DataSource, error)

func (*Service) GetHTTPClient

func (s *Service) GetHTTPClient(ctx context.Context, ds *datasources.DataSource, provider httpclient.Provider) (*http.Client, error)

func (*Service) GetHTTPTransport

func (s *Service) GetHTTPTransport(ctx context.Context, ds *datasources.DataSource, provider httpclient.Provider,
	customMiddlewares ...sdkhttpclient.Middleware) (http.RoundTripper, error)

func (*Service) GetTLSConfig

func (s *Service) GetTLSConfig(ctx context.Context, ds *datasources.DataSource, httpClientProvider httpclient.Provider) (*tls.Config, error)

func (*Service) UpdateDataSource

func (*Service) Usage

func (s *Service) Usage(ctx context.Context, scopeParams *quota.ScopeParameters) (*quota.Map, error)

type SqlStore

type SqlStore struct {
	// contains filtered or unexported fields
}

func CreateStore

func CreateStore(db db.DB, logger log.Logger) *SqlStore

func (*SqlStore) AddDataSource

func (*SqlStore) Count

func (ss *SqlStore) Count(ctx context.Context, scopeParams *quota.ScopeParameters) (*quota.Map, error)

func (*SqlStore) DeleteDataSource

func (ss *SqlStore) DeleteDataSource(ctx context.Context, cmd *datasources.DeleteDataSourceCommand) error

DeleteDataSource removes a datasource by org_id as well as either uid (preferred), id, or name and is added to the bus. It also removes permissions related to the datasource.

func (*SqlStore) GetAllDataSources

func (ss *SqlStore) GetAllDataSources(ctx context.Context, query *datasources.GetAllDataSourcesQuery) (res []*datasources.DataSource, err error)

func (*SqlStore) GetDataSource

GetDataSource adds a datasource to the query model by querying by org_id as well as either uid (preferred), id, or name and is added to the bus.

func (*SqlStore) GetDataSources

func (ss *SqlStore) GetDataSources(ctx context.Context, query *datasources.GetDataSourcesQuery) ([]*datasources.DataSource, error)

func (*SqlStore) GetDataSourcesByType

func (ss *SqlStore) GetDataSourcesByType(ctx context.Context, query *datasources.GetDataSourcesByTypeQuery) ([]*datasources.DataSource, error)

GetDataSourcesByType returns all datasources for a given type or an error if the specified type is an empty string

func (*SqlStore) GetDefaultDataSource

func (ss *SqlStore) GetDefaultDataSource(ctx context.Context, query *datasources.GetDefaultDataSourceQuery) (*datasources.DataSource, error)

GetDefaultDataSource is used to get the default datasource of organization

func (*SqlStore) UpdateDataSource

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL