CLI: Allow installing custom binary plugins (#17551)

Make sure all data is sent to API to be able to select correct archive version.
This commit is contained in:
Andrej Ocenas
2019-07-29 10:44:58 +02:00
committed by GitHub
parent 64828e017c
commit 8c49d27705
19 changed files with 684 additions and 244 deletions
+13
View File
@@ -2,6 +2,8 @@ package utils
import (
"github.com/codegangsta/cli"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/models"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
)
type CommandLine interface {
@@ -20,6 +22,13 @@ type CommandLine interface {
PluginDirectory() string
RepoDirectory() string
PluginURL() string
ApiClient() ApiClient
}
type ApiClient interface {
GetPlugin(pluginId, repoUrl string) (models.Plugin, error)
DownloadFile(pluginName, filePath, url string, checksum string) (content []byte, err error)
ListAllPlugins(repoUrl string) (models.PluginRepo, error)
}
type ContextCommandLine struct {
@@ -57,3 +66,7 @@ func (c *ContextCommandLine) PluginURL() string {
func (c *ContextCommandLine) OptionsString() string {
return c.GlobalString("configOverrides")
}
func (c *ContextCommandLine) ApiClient() ApiClient {
return &services.GrafanaComClient{}
}