The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/pkg/cmd/grafana-cli/commands/commandstest/fake_api_client.go

36 lines
1.0 KiB

package commandstest
import (
"os"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/models"
)
type FakeGrafanaComClient struct {
GetPluginFunc func(pluginId, repoUrl string) (models.Plugin, error)
DownloadFileFunc func(pluginName string, tmpFile *os.File, url string, checksum string) (err error)
ListAllPluginsFunc func(repoUrl string) (models.PluginRepo, error)
}
func (client *FakeGrafanaComClient) GetPlugin(pluginID, repoUrl string) (models.Plugin, error) {
if client.GetPluginFunc != nil {
return client.GetPluginFunc(pluginID, repoUrl)
}
return models.Plugin{}, nil
}
func (client *FakeGrafanaComClient) DownloadFile(pluginName string, tmpFile *os.File, url string, checksum string) (err error) {
if client.DownloadFileFunc != nil {
return client.DownloadFileFunc(pluginName, tmpFile, url, checksum)
}
return nil
}
func (client *FakeGrafanaComClient) ListAllPlugins(repoURL string) (models.PluginRepo, error) {
if client.ListAllPluginsFunc != nil {
return client.ListAllPluginsFunc(repoURL)
}
return models.PluginRepo{}, nil
}