Preinstall: Allow to set a download URL (#96535)
This commit is contained in:
+11
-9
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user