Documentation ¶
Index ¶
- Constants
- func NewIDScopeResolver(db DataSourceRetriever) (string, accesscontrol.ScopeAttributeResolver)
- func NewNameScopeResolver(db DataSourceRetriever) (string, accesscontrol.ScopeAttributeResolver)
- type CacheServiceImpl
- type DataSourceRetriever
- type Service
- func (s *Service) AddDataSource(ctx context.Context, cmd *datasources.AddDataSourceCommand) (*datasources.DataSource, error)
- func (s *Service) CustomHeaders(ctx context.Context, ds *datasources.DataSource) (map[string]string, error)
- func (s *Service) DecryptedBasicAuthPassword(ctx context.Context, ds *datasources.DataSource) (string, error)
- func (s *Service) DecryptedPassword(ctx context.Context, ds *datasources.DataSource) (string, error)
- func (s *Service) DecryptedValue(ctx context.Context, ds *datasources.DataSource, key string) (string, bool, error)
- func (s *Service) DecryptedValues(ctx context.Context, ds *datasources.DataSource) (map[string]string, error)
- func (s *Service) DeleteDataSource(ctx context.Context, cmd *datasources.DeleteDataSourceCommand) error
- func (s *Service) GetAllDataSources(ctx context.Context, query *datasources.GetAllDataSourcesQuery) (res []*datasources.DataSource, err error)
- func (s *Service) GetDataSource(ctx context.Context, query *datasources.GetDataSourceQuery) (*datasources.DataSource, error)
- func (s *Service) GetDataSources(ctx context.Context, query *datasources.GetDataSourcesQuery) ([]*datasources.DataSource, error)
- func (s *Service) GetDataSourcesByType(ctx context.Context, query *datasources.GetDataSourcesByTypeQuery) ([]*datasources.DataSource, error)
- func (s *Service) GetDefaultDataSource(ctx context.Context, query *datasources.GetDefaultDataSourceQuery) (*datasources.DataSource, error)
- func (s *Service) GetHTTPClient(ctx context.Context, ds *datasources.DataSource, provider httpclient.Provider) (*http.Client, error)
- func (s *Service) GetHTTPTransport(ctx context.Context, ds *datasources.DataSource, provider httpclient.Provider, ...) (http.RoundTripper, error)
- func (s *Service) GetTLSConfig(ctx context.Context, ds *datasources.DataSource, ...) (*tls.Config, error)
- func (s *Service) UpdateDataSource(ctx context.Context, cmd *datasources.UpdateDataSourceCommand) (*datasources.DataSource, error)
- func (s *Service) Usage(ctx context.Context, scopeParams *quota.ScopeParameters) (*quota.Map, error)
- type SqlStore
- func (ss *SqlStore) AddDataSource(ctx context.Context, cmd *datasources.AddDataSourceCommand) (*datasources.DataSource, error)
- func (ss *SqlStore) Count(ctx context.Context, scopeParams *quota.ScopeParameters) (*quota.Map, error)
- func (ss *SqlStore) DeleteDataSource(ctx context.Context, cmd *datasources.DeleteDataSourceCommand) error
- func (ss *SqlStore) GetAllDataSources(ctx context.Context, query *datasources.GetAllDataSourcesQuery) (res []*datasources.DataSource, err error)
- func (ss *SqlStore) GetDataSource(ctx context.Context, query *datasources.GetDataSourceQuery) (*datasources.DataSource, error)
- func (ss *SqlStore) GetDataSources(ctx context.Context, query *datasources.GetDataSourcesQuery) ([]*datasources.DataSource, error)
- func (ss *SqlStore) GetDataSourcesByType(ctx context.Context, query *datasources.GetDataSourcesByTypeQuery) ([]*datasources.DataSource, error)
- func (ss *SqlStore) GetDefaultDataSource(ctx context.Context, query *datasources.GetDefaultDataSourceQuery) (*datasources.DataSource, error)
- func (ss *SqlStore) UpdateDataSource(ctx context.Context, cmd *datasources.UpdateDataSourceCommand) (*datasources.DataSource, error)
- type Store
Constants ¶
const (
DefaultCacheTTL = 5 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
func NewIDScopeResolver ¶
func NewIDScopeResolver(db DataSourceRetriever) (string, accesscontrol.ScopeAttributeResolver)
NewIDScopeResolver provides an ScopeAttributeResolver able to translate a scope prefixed with "datasources:id:" into an uid based scope.
func NewNameScopeResolver ¶
func NewNameScopeResolver(db DataSourceRetriever) (string, accesscontrol.ScopeAttributeResolver)
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 (s *Service) AddDataSource(ctx context.Context, cmd *datasources.AddDataSourceCommand) (*datasources.DataSource, error)
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 (s *Service) GetDataSource(ctx context.Context, query *datasources.GetDataSourceQuery) (*datasources.DataSource, error)
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 (s *Service) UpdateDataSource(ctx context.Context, cmd *datasources.UpdateDataSourceCommand) (*datasources.DataSource, error)
type SqlStore ¶
type SqlStore struct {
// contains filtered or unexported fields
}
func (*SqlStore) AddDataSource ¶
func (ss *SqlStore) AddDataSource(ctx context.Context, cmd *datasources.AddDataSourceCommand) (*datasources.DataSource, 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 ¶
func (ss *SqlStore) GetDataSource(ctx context.Context, query *datasources.GetDataSourceQuery) (*datasources.DataSource, error)
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 ¶
func (ss *SqlStore) UpdateDataSource(ctx context.Context, cmd *datasources.UpdateDataSourceCommand) (*datasources.DataSource, error)
type Store ¶
type Store interface { GetDataSource(context.Context, *datasources.GetDataSourceQuery) (*datasources.DataSource, error) GetDataSources(context.Context, *datasources.GetDataSourcesQuery) ([]*datasources.DataSource, error) GetDataSourcesByType(context.Context, *datasources.GetDataSourcesByTypeQuery) ([]*datasources.DataSource, error) GetDefaultDataSource(context.Context, *datasources.GetDefaultDataSourceQuery) (*datasources.DataSource, error) DeleteDataSource(context.Context, *datasources.DeleteDataSourceCommand) error AddDataSource(context.Context, *datasources.AddDataSourceCommand) (*datasources.DataSource, error) UpdateDataSource(context.Context, *datasources.UpdateDataSourceCommand) (*datasources.DataSource, error) GetAllDataSources(ctx context.Context, query *datasources.GetAllDataSourcesQuery) (res []*datasources.DataSource, err error) Count(context.Context, *quota.ScopeParameters) (*quota.Map, error) }
Store is the interface for the datasource Service's storage.