asset

package
v1.0.0-alpha.28 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset struct {
	Name        string
	DisplayName string
	Type        Type

	OS      string
	Arch    string
	Version string

	Extension    string
	DownloadPath string
	Hash         string
	TempDir      string
	Files        []*File
}

func New

func New(name, displayName, osName, osArch, version string) *Asset

New creates a new asset

func (*Asset) Classify

func (a *Asset) Classify()

Classify determines the type of asset based on the file extension

func (*Asset) Cleanup

func (a *Asset) Cleanup() error

func (*Asset) Download

func (a *Asset) Download(_ context.Context) error

func (*Asset) Extract

func (a *Asset) Extract() error

func (*Asset) GetAsset

func (a *Asset) GetAsset() *Asset

func (*Asset) GetDisplayName

func (a *Asset) GetDisplayName() string

func (*Asset) GetFilePath

func (a *Asset) GetFilePath() string

func (*Asset) GetFiles

func (a *Asset) GetFiles() []*File

func (*Asset) GetName

func (a *Asset) GetName() string

func (*Asset) GetTempPath

func (a *Asset) GetTempPath() string

func (*Asset) GetType

func (a *Asset) GetType() Type

func (*Asset) ID

func (a *Asset) ID() string

func (*Asset) Install

func (a *Asset) Install(id, binDir, optDir string) error

Install installs the asset TODO(ek): simplify this function

func (*Asset) Path

func (a *Asset) Path() string

type File

type File struct {
	Name        string
	Alias       string
	Installable bool
}

type IAsset

type IAsset interface {
	GetName() string
	GetDisplayName() string
	GetType() Type
	GetAsset() *Asset
	GetFiles() []*File
	GetTempPath() string
	GetFilePath() string
	Download(context.Context) error
	Extract() error
	Install(string, string, string) error
	Cleanup() error
	ID() string
	Path() string
}

type Type

type Type int

Type is the type of asset

const (
	Unknown Type = iota
	Archive
	Binary
	Installer
	Checksum
	Signature
	Key
	SBOM
	Data
)

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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