Plugins: Refactor plugin repository API (#69063)
* support grafana wildcard version * undo go.mod changes * tidy * flesh out tests * refactor * add tests * tidy naming * undo some changes * split interfaces * separation * update new signature * simplify * update var namings * unexport types * introduce opts pattern * reorder test * fix compat checks * middle ground * unexport client * move back * fix tests * inline logger * make client usable * use fake logger * tidy errors * remove unused types * fix test * review fixes * rework compatibility * adjust installer * fix tests * opts => cfg * remove unused var * fix var name
This commit is contained in:
@@ -200,9 +200,9 @@ func (f *FakePluginRegistry) Remove(_ context.Context, id string) error {
|
||||
}
|
||||
|
||||
type FakePluginRepo struct {
|
||||
GetPluginArchiveFunc func(_ context.Context, pluginID, version string, _ repo.CompatOpts) (*repo.PluginArchive, error)
|
||||
GetPluginArchiveByURLFunc func(_ context.Context, archiveURL string, _ repo.CompatOpts) (*repo.PluginArchive, error)
|
||||
GetPluginDownloadOptionsFunc func(_ context.Context, pluginID, version string, _ repo.CompatOpts) (*repo.PluginDownloadOptions, error)
|
||||
GetPluginArchiveFunc func(_ context.Context, pluginID, version string, _ repo.CompatOpts) (*repo.PluginArchive, error)
|
||||
GetPluginArchiveByURLFunc func(_ context.Context, archiveURL string, _ repo.CompatOpts) (*repo.PluginArchive, error)
|
||||
GetPluginArchiveInfoFunc func(_ context.Context, pluginID, version string, _ repo.CompatOpts) (*repo.PluginArchiveInfo, error)
|
||||
}
|
||||
|
||||
// GetPluginArchive fetches the requested plugin archive.
|
||||
@@ -223,12 +223,12 @@ func (r *FakePluginRepo) GetPluginArchiveByURL(ctx context.Context, archiveURL s
|
||||
return &repo.PluginArchive{}, nil
|
||||
}
|
||||
|
||||
// GetPluginDownloadOptions fetches information for downloading the requested plugin.
|
||||
func (r *FakePluginRepo) GetPluginDownloadOptions(ctx context.Context, pluginID, version string, opts repo.CompatOpts) (*repo.PluginDownloadOptions, error) {
|
||||
if r.GetPluginDownloadOptionsFunc != nil {
|
||||
return r.GetPluginDownloadOptionsFunc(ctx, pluginID, version, opts)
|
||||
// GetPluginArchiveInfo fetches information for downloading the requested plugin.
|
||||
func (r *FakePluginRepo) GetPluginArchiveInfo(ctx context.Context, pluginID, version string, opts repo.CompatOpts) (*repo.PluginArchiveInfo, error) {
|
||||
if r.GetPluginArchiveInfoFunc != nil {
|
||||
return r.GetPluginArchiveInfoFunc(ctx, pluginID, version, opts)
|
||||
}
|
||||
return &repo.PluginDownloadOptions{}, nil
|
||||
return &repo.PluginArchiveInfo{}, nil
|
||||
}
|
||||
|
||||
type FakePluginStorage struct {
|
||||
|
||||
Reference in New Issue
Block a user