types

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CacheFilePath = path.Join(os.TempDir(), "hashicorp.releases.json")
	CacheMaxAge   = 60 // minutes
)

Functions

func ExpireCache

func ExpireCache() error

func GetIndexBody

func GetIndexBody(indexURL string, cache bool) ([]byte, error)

Types

type Build

type Build struct {
	Product  string `json:"name"`
	Version  string `json:"version"`
	OS       string `json:"os"`
	Arch     string `json:"arch"`
	Filename string `json:"filename"`
	URL      string `json:"url"`
	// contains filtered or unexported fields
}

func (*Build) DownloadAndCheck

func (b *Build) DownloadAndCheck() ([]byte, error)

func (*Build) DownloadAndExtract

func (b *Build) DownloadAndExtract(dir string, product string) (string, error)

func (*Build) DownloadAndSave

func (b *Build) DownloadAndSave(filePath string) (string, error)

func (*Build) Install

func (b *Build) Install() error
func (b *Build) Link() error

TODO: copy file instead of symlink.

func (*Build) String

func (b *Build) String() string

func (*Build) Uninstall

func (b *Build) Uninstall() error

type Index

type Index struct {
	Products map[string]*Product
}

func NewIndex

func NewIndex(indexURL string) (Index, error)

func (*Index) GetProduct

func (i *Index) GetProduct(name string) (*Product, error)

func (*Index) GetVersion

func (i *Index) GetVersion(product string, version string) (*Version, error)

func (*Index) ListProducts

func (i *Index) ListProducts() []string

type Product

type Product struct {
	Name     string              `json:"name"`
	Versions map[string]*Version `json:"versions"`
	Sorted   version.Collection
	// contains filtered or unexported fields
}

func NewProduct

func NewProduct(indexURL string) (*Product, error)

func (*Product) GetVersion

func (p *Product) GetVersion(version string) (*Version, error)

func (*Product) LatestVersion

func (p *Product) LatestVersion() *Version

func (*Product) ListVersions

func (p *Product) ListVersions() []string

func (*Product) String

func (p *Product) String() string

type Version

type Version struct {
	Product    string   `json:"name"`
	Version    string   `json:"version"`
	SHASums    string   `json:"shasums"`
	SHASumsSig string   `json:"shasums_signature"`
	Builds     []*Build `json:"builds"`
	// contains filtered or unexported fields
}

func (*Version) GetBuild

func (v *Version) GetBuild(os string, arch string) *Build

func (*Version) GetBuildForLocal

func (v *Version) GetBuildForLocal() *Build

func (*Version) IsActive

func (v *Version) IsActive() bool

func (*Version) IsBeta

func (v *Version) IsBeta() bool

func (*Version) IsEnterprise

func (v *Version) IsEnterprise() bool

func (*Version) String

func (v *Version) String() string

Jump to

Keyboard shortcuts

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