Documentation ¶
Index ¶
- Constants
- func NewIDScopeResolver(db DataSourceRetriever) (string, accesscontrol.ScopeAttributeResolver)
- func NewNameScopeResolver(db DataSourceRetriever) (string, accesscontrol.ScopeAttributeResolver)
- type CacheServiceImpl
- type DataSourceRetriever
- type LegacyDataSourceLookup
- type NoopLegacyDataSourcLookup
- 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) (http.Header, 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) GetHTTPTransport(ctx context.Context, ds *datasources.DataSource, provider httpclient.Provider, ...) (http.RoundTripper, error)
- func (s *Service) GetPrunableProvisionedDataSources(ctx context.Context) (res []*datasources.DataSource, err 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) GetPrunableProvisionedDataSources(ctx context.Context) ([]*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, dsGuardian guardian.DatasourceGuardianProvider) *CacheServiceImpl
func (*CacheServiceImpl) GetDatasource ¶
func (dc *CacheServiceImpl) GetDatasource( ctx context.Context, datasourceID int64, user identity.Requester, skipCache bool, ) (*datasources.DataSource, error)
func (*CacheServiceImpl) GetDatasourceByUID ¶
func (dc *CacheServiceImpl) GetDatasourceByUID( ctx context.Context, datasourceUID string, user identity.Requester, 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 LegacyDataSourceLookup ¶
type LegacyDataSourceLookup interface { // Find the UID from either the name or internal id // NOTE the orgID will be fetched from the context GetDataSourceFromDeprecatedFields(ctx context.Context, name string, id int64) (*data.DataSourceRef, error) }
LegacyDataSourceRetriever supports finding a reference to datasources using the name or internal ID
func ProvideLegacyDataSourceLookup ¶
func ProvideLegacyDataSourceLookup(p *Service) LegacyDataSourceLookup
type NoopLegacyDataSourcLookup ¶
type NoopLegacyDataSourcLookup struct {
Ref *data.DataSourceRef
}
NoopLegacyDataSourceRetriever does not even try to lookup, it returns a raw reference
func (*NoopLegacyDataSourcLookup) GetDataSourceFromDeprecatedFields ¶
func (s *NoopLegacyDataSourcLookup) GetDataSourceFromDeprecatedFields(ctx context.Context, name string, id int64) (*data.DataSourceRef, error)
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, pluginStore pluginstore.Store, pluginClient plugins.Client, basePluginContextProvider plugincontext.BasePluginContextProvider, ) (*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) (http.Header, 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) GetHTTPTransport ¶
func (s *Service) GetHTTPTransport(ctx context.Context, ds *datasources.DataSource, provider httpclient.Provider, customMiddlewares ...sdkhttpclient.Middleware) (http.RoundTripper, error)
func (*Service) GetPrunableProvisionedDataSources ¶
func (s *Service) GetPrunableProvisionedDataSources(ctx context.Context) (res []*datasources.DataSource, err 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) GetPrunableProvisionedDataSources ¶
func (ss *SqlStore) GetPrunableProvisionedDataSources(ctx context.Context) ([]*datasources.DataSource, error)
GetPrunableProvisionedDataSources returns all data sources that can be pruned
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) 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) GetPrunableProvisionedDataSources(ctx context.Context) (res []*datasources.DataSource, err error) Count(context.Context, *quota.ScopeParameters) (*quota.Map, error) }
Store is the interface for the datasource Service's storage.