lwupdater

package
v1.50.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

README

Lacework Updater

A Go library to check for available updates of Lacework projects.

Usage

Download the library into your $GOPATH:

$ go get github.com/lacework/go-sdk/lwupdater

Import the library into your tool:

import "github.com/lacework/go-sdk/lwupdater"

Examples

This example checks for the latest release of this repository (https://github.com/lacework/go-sdk):

package main

import (
	"fmt"

	"github.com/lacework/go-sdk/lwupdater"
)

func main() {
	var (
		project  = "go-sdk"
		sdk, err = lwupdater.Check(project, "v0.1.0")
	)

	if err != nil {
		fmt.Println("Unable to check for updates: %s", err)
	} else {
		// Output: The latest release of the go-sdk project is v0.1.7
		fmt.Printf("The latest release of the %s project is %s\n",
			project, sdk.LatestVersion,
		)
	}
}

Look at the _examples/ folder for more examples.

Documentation

Overview

A library to check for available updates of Lacework projects.

Index

Constants

View Source
const (
	// GithubOrganization is the default Github organization where
	// Lacework stores their open source projects
	GithubOrganization = "lacework"

	// DisableEnv controls the overall check for updates behavior, when
	// this environment variable is set, we do not check for updates
	DisableEnv = "LW_UPDATES_DISABLE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Version added in v0.2.11

type Version struct {
	Project             string               `json:"project"`
	CurrentVersion      string               `json:"current_version"`
	LatestVersion       string               `json:"latest_version"`
	LastCheckTime       time.Time            `json:"last_check_time"`
	Outdated            bool                 `json:"outdated"`
	ComponentsLastCheck map[string]time.Time `json:"components_last_check,omitempty"`
}

Version is used to check project versions and store it into a cache file normally at the directory `~/.config/lacework`, to execute regular version checks

func Check

func Check(project, current string) (*Version, error)

Check verifies if the a project is outdated based of the current version

func LoadCache added in v0.2.11

func LoadCache(path string) (*Version, error)

LoadCache loads a version cache file from the provided path

func (*Version) CheckComponentBefore added in v1.35.0

func (cache *Version) CheckComponentBefore(component string, checkTime time.Time) bool

StoreCache stores version information into the provided path

func (*Version) StoreCache added in v0.2.11

func (cache *Version) StoreCache(path string) error

StoreCache stores version information into the provided path

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL