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/plugins/repo/ifaces.go

39 lines
1.2 KiB

package repo
import (
"context"
"fmt"
"strings"
)
// Service is responsible for retrieving plugin information from a repository.
type Service interface {
// GetPluginArchive fetches the requested plugin archive.
GetPluginArchive(ctx context.Context, pluginID, version string, opts CompatOpts) (*PluginArchive, error)
// GetPluginArchiveByURL fetches the requested plugin from the specified URL.
GetPluginArchiveByURL(ctx context.Context, archiveURL string, opts CompatOpts) (*PluginArchive, error)
// GetPluginDownloadOptions fetches information for downloading the requested plugin.
GetPluginDownloadOptions(ctx context.Context, pluginID, version string, opts CompatOpts) (*PluginDownloadOptions, error)
}
type CompatOpts struct {
GrafanaVersion string
OS string
Arch string
}
func NewCompatOpts(grafanaVersion, os, arch string) CompatOpts {
return CompatOpts{
GrafanaVersion: grafanaVersion,
OS: os,
Arch: arch,
}
}
func (co CompatOpts) OSAndArch() string {
return fmt.Sprintf("%s-%s", strings.ToLower(co.OS), co.Arch)
}
func (co CompatOpts) String() string {
return fmt.Sprintf("Grafana v%s %s", co.GrafanaVersion, co.OSAndArch())
}