Documentation ¶
Index ¶
- type ArchMeta
- type Client
- type CompatOpts
- type ErrArcNotFound
- type ErrChecksumMismatch
- type ErrResponse4xx
- type ErrVersionNotFound
- type ErrVersionUnsupported
- type Manager
- func (m *Manager) GetPluginArchive(ctx context.Context, pluginID, version string, compatOpts CompatOpts) (*PluginArchive, error)
- func (m *Manager) GetPluginArchiveByURL(ctx context.Context, pluginZipURL string, compatOpts CompatOpts) (*PluginArchive, error)
- func (m *Manager) GetPluginArchiveInfo(_ context.Context, pluginID, version string, compatOpts CompatOpts) (*PluginArchiveInfo, error)
- type ManagerCfg
- type PluginArchive
- type PluginArchiveInfo
- type PluginRepo
- type Service
- type SystemCompatOpts
- type Version
- type VersionData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Download ¶
func (c *Client) Download(_ context.Context, pluginZipURL, checksum string, compatOpts CompatOpts) (*PluginArchive, error)
type CompatOpts ¶
type CompatOpts struct {
// contains filtered or unexported fields
}
func NewCompatOpts ¶
func NewCompatOpts(grafanaVersion, os, arch string) CompatOpts
func NewSystemCompatOpts ¶
func NewSystemCompatOpts(os, arch string) CompatOpts
func (CompatOpts) GrafanaVersion ¶
func (co CompatOpts) GrafanaVersion() (string, bool)
func (CompatOpts) String ¶
func (co CompatOpts) String() string
func (CompatOpts) System ¶
func (co CompatOpts) System() (SystemCompatOpts, bool)
type ErrArcNotFound ¶
type ErrArcNotFound struct {
// contains filtered or unexported fields
}
func (ErrArcNotFound) Error ¶
func (e ErrArcNotFound) Error() string
type ErrChecksumMismatch ¶
type ErrChecksumMismatch struct {
// contains filtered or unexported fields
}
func (ErrChecksumMismatch) Error ¶
func (e ErrChecksumMismatch) Error() string
type ErrResponse4xx ¶
type ErrResponse4xx struct {
// contains filtered or unexported fields
}
func (ErrResponse4xx) Error ¶
func (e ErrResponse4xx) Error() string
func (ErrResponse4xx) Message ¶
func (e ErrResponse4xx) Message() string
func (ErrResponse4xx) StatusCode ¶
func (e ErrResponse4xx) StatusCode() int
type ErrVersionNotFound ¶
type ErrVersionNotFound struct {
// contains filtered or unexported fields
}
func (ErrVersionNotFound) Error ¶
func (e ErrVersionNotFound) Error() string
type ErrVersionUnsupported ¶
type ErrVersionUnsupported struct {
// contains filtered or unexported fields
}
func (ErrVersionUnsupported) Error ¶
func (e ErrVersionUnsupported) Error() string
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(cfg ManagerCfg) *Manager
func (*Manager) GetPluginArchive ¶
func (m *Manager) GetPluginArchive(ctx context.Context, pluginID, version string, compatOpts CompatOpts) (*PluginArchive, error)
GetPluginArchive fetches the requested plugin archive
func (*Manager) GetPluginArchiveByURL ¶
func (m *Manager) GetPluginArchiveByURL(ctx context.Context, pluginZipURL string, compatOpts CompatOpts) (*PluginArchive, error)
GetPluginArchiveByURL fetches the requested plugin archive from the provided `pluginZipURL`
func (*Manager) GetPluginArchiveInfo ¶
func (m *Manager) GetPluginArchiveInfo(_ context.Context, pluginID, version string, compatOpts CompatOpts) (*PluginArchiveInfo, error)
GetPluginArchiveInfo returns the options for downloading the requested plugin (with optional `version`)
type ManagerCfg ¶
type ManagerCfg struct { SkipTLSVerify bool BaseURL string Logger log.PrettyLogger }
type PluginArchive ¶
type PluginArchive struct {
File *zip.ReadCloser
}
type PluginArchiveInfo ¶
type PluginRepo ¶
type PluginRepo struct {
Versions []Version `json:"versions"`
}
PluginRepo is (a subset of) the JSON response from /api/plugins/repo/$pluginID
type Service ¶
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) // GetPluginArchiveInfo fetches information needed for downloading the requested plugin. GetPluginArchiveInfo(ctx context.Context, pluginID, version string, opts CompatOpts) (*PluginArchiveInfo, error) }
Service is responsible for retrieving plugin archive information from a repository.
type SystemCompatOpts ¶
type SystemCompatOpts struct {
// contains filtered or unexported fields
}
func (SystemCompatOpts) Arch ¶
func (co SystemCompatOpts) Arch() (string, bool)
func (SystemCompatOpts) OS ¶
func (co SystemCompatOpts) OS() (string, bool)
func (SystemCompatOpts) OSAndArch ¶
func (co SystemCompatOpts) OSAndArch() string
type VersionData ¶
func SelectSystemCompatibleVersion ¶
func SelectSystemCompatibleVersion(log log.PrettyLogger, versions []Version, pluginID, version string, compatOpts SystemCompatOpts) (VersionData, error)
SelectSystemCompatibleVersion selects the most appropriate plugin version based on os + architecture returns the specified version if supported. returns the latest version if no specific version is specified. returns error if the supplied version does not exist. returns error if supplied version exists but is not supported. NOTE: It expects plugin.Versions to be sorted so the newest version is first.