asset

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: MIT Imports: 24 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
	ParentType   Type
	ChecksumType string
	MatchedAsset IAsset

	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(name string) Type

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) GetChecksumType

func (a *Asset) GetChecksumType() string

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) GetGPGKeyID

func (a *Asset) GetGPGKeyID() (uint64, error)

func (*Asset) GetMatchedAsset

func (a *Asset) GetMatchedAsset() IAsset

func (*Asset) GetName

func (a *Asset) GetName() string

func (*Asset) GetParentType

func (a *Asset) GetParentType() Type

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

func (*Asset) SetMatchedAsset

func (a *Asset) SetMatchedAsset(asset IAsset)

type File

type File struct {
	Name        string
	Alias       string
	Installable bool
}

type IAsset

type IAsset interface {
	GetName() string
	GetDisplayName() string
	GetType() Type
	GetParentType() 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
	GetChecksumType() string
	GetMatchedAsset() IAsset
	SetMatchedAsset(IAsset)
	GetGPGKeyID() (uint64, error)
}

type Type

type Type int

Type is the type of asset

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

	ChecksumTypeNone  = "none"
	ChecksumTypeFile  = "single"
	ChecksumTypeMulti = "multi"
)

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