Documentation ¶
Overview ¶
Package agent provides a client for fetching information about agent versions from Github.
Index ¶
Constants ¶
const ( // MinSyncAgentVersionsInterval is the minimum value for the SyncAgentVersionsInterval setting, currently 1 hour. 0 // can also be specified to disable background periodic syncing. MinSyncAgentVersionsInterval = 1 * time.Hour )
The latest version cache keeps the latest version in memory to avoid hitting the store to get the latest version.
const (
// VersionLatest can be used in requests instead of an actual version
VersionLatest = "latest"
)
Variables ¶
var ( // ErrVersionNotFound is returned when the agent versions service returns a 404 for a version ErrVersionNotFound = errors.New("agent version not found") )
Functions ¶
This section is empty.
Types ¶
type VersionClient ¶ added in v1.9.0
type VersionClient interface { // Version returns the agent version for the given version string Version(version string) (*model.AgentVersion, error) // Versions returns all available agent versions Versions() ([]*model.AgentVersion, error) // LatestVersion returns the latest agent version, as determined by Github LatestVersion() (*model.AgentVersion, error) }
VersionClient is an interface for retrieving available agent versions
func NewVersionClient ¶ added in v1.9.0
func NewVersionClient() VersionClient
NewVersionClient creates a new VersionClient
type Versions ¶
type Versions interface { LatestVersionString(ctx context.Context) string LatestVersion(ctx context.Context) (*model.AgentVersion, error) Version(ctx context.Context, version string) (*model.AgentVersion, error) SyncVersion(version string) (*model.AgentVersion, error) SyncVersions() ([]*model.AgentVersion, error) }
Versions manages versions of agents that are used during install and upgrade. The versions are stored in the Store as agent-version resources, but Versions provides quick access to the latest version.
func NewVersions ¶
func NewVersions(ctx context.Context, client VersionClient, store store.Store, settings VersionsSettings) Versions
NewVersions creates an implementation of Versions using the specified client, cache, and settings. To disable caching, pass nil for the Cache.
type VersionsSettings ¶
type VersionsSettings struct { Logger *zap.Logger // SyncAgentVersionsInterval is the interval at which SyncVersions() will be called to ensure the agent-versions are // in sync with GitHub and new releases are available. SyncAgentVersionsInterval time.Duration // Offline is true if the server is in offline mode and should not contact GitHub automatically. Sync methods called // by 'bindplanectl sync' commands will still attempt to contact GitHub. Offline bool }
VersionsSettings TODO(doc)