Preinstall: Allow to set a download URL (#96535)

This commit is contained in:
Andres Martinez Gotor
2024-11-29 16:02:33 +01:00
committed by GitHub
parent b544b8afff
commit e0935246a3
11 changed files with 222 additions and 76 deletions
+11 -9
View File
@@ -12,7 +12,7 @@ import (
type Installer interface {
// Add adds a new plugin.
Add(ctx context.Context, pluginID, version string, opts CompatOpts) error
Add(ctx context.Context, pluginID, version string, opts AddOpts) error
// Remove removes an existing plugin.
Remove(ctx context.Context, pluginID, version string) error
}
@@ -33,31 +33,33 @@ type File struct {
ModTime time.Time
}
type CompatOpts struct {
type AddOpts struct {
grafanaVersion string
os string
arch string
url string
}
func (co CompatOpts) GrafanaVersion() string {
func (co AddOpts) GrafanaVersion() string {
return co.grafanaVersion
}
func (co CompatOpts) OS() string {
func (co AddOpts) OS() string {
return co.os
}
func (co CompatOpts) Arch() string {
func (co AddOpts) Arch() string {
return co.arch
}
func NewCompatOpts(grafanaVersion, os, arch string) CompatOpts {
return CompatOpts{grafanaVersion: grafanaVersion, arch: arch, os: os}
func (co AddOpts) URL() string {
return co.url
}
func NewSystemCompatOpts(os, arch string) CompatOpts {
return CompatOpts{arch: arch, os: os}
func NewAddOpts(grafanaVersion, os, arch, url string) AddOpts {
return AddOpts{grafanaVersion: grafanaVersion, arch: arch, os: os, url: url}
}
type UpdateInfo struct {