drop

package
v0.0.1-pre4 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventObjectAsset        = "asset"
	EventObjectPolicy       = "policy"
	EventObjectVerification = "verification"

	EventVerbDone    = "done"
	EventVerbGet     = "get"
	EventVerbRunning = "running"
	EventVerbSaved   = "saved"
	EventVerbSkipped = "skipped"
)

Variables

View Source
var (
	ErrNoPolicyAvailable  = errors.New("no verification policies available for artifact")
	ErrVerificationFailed = errors.New("asset failed verification, refusing to install")
	ErrNoPlatformVariant  = errors.New("no installable variant found for the specified platform")
)

Functions

This section is empty.

Types

type Dropper

type Dropper struct {
	Options Options
	// contains filtered or unexported fields
}

func New

func New(funcs ...FuncOption) (*Dropper, error)

func (*Dropper) Get

func (dropper *Dropper) Get(spec github.AssetDataProvider, funcs ...FuncGetOption) error

Get downloads and verifies an artifact from a GitHub release.

func (*Dropper) Install

func (dropper *Dropper) Install(spec github.AssetDataProvider, funcs ...FuncGetOption) error

Install downloads, verifies and installs an artifact from a release

type Event

type Event struct {
	Object string
	Verb   string
	Data   map[string]string
}

func (*Event) GetDataField

func (e *Event) GetDataField(field string) string

type FuncGetOption

type FuncGetOption func(*GetOptions) error

func WithDownloadPath

func WithDownloadPath(path string) FuncGetOption

func WithDownloadType

func WithDownloadType(t string) FuncGetOption

func WithPlatform

func WithPlatform(slug string) FuncGetOption

GetOptions

func WithTransferTimeOut

func WithTransferTimeOut(seconds int) FuncGetOption

func WithVerifyDownloads

func WithVerifyDownloads(verify bool) FuncGetOption

type FuncOption

type FuncOption func(*Dropper) error

func WithListener

func WithListener(listener ProgressListener) FuncOption

func WithPolicyRepository

func WithPolicyRepository(repoURL string) FuncOption

Constructor funcs

type GetOptions

type GetOptions struct {
	// Embedded dropper options to pass to implementation
	Options

	// Directory where the asset will be downloaded
	DownloadPath string

	// Platform to download
	OS   string
	Arch string

	// Filename to store the downloaded asset
	FileName string

	// TransferTimeOut is the number of seconds after which the http request
	// will time out.
	TransferTimeOut int

	// SkipVerification instructs the dropper engine to skip the artifact
	// security verification. This allows the tool to be used as a curl-like
	// thing for repos.
	SkipVerification bool

	// DownloadType is "a","b" or "p" and determines which download we do
	DownloadType string
	// contains filtered or unexported fields
}

type NoopListener

type NoopListener struct{}

NoopListener is a listener tht just swallows events without doing anything

func (*NoopListener) HandleEvent

func (*NoopListener) HandleEvent(event *Event)

type Options

type Options struct {
	PolicyRepository string
	Listener         ProgressListener
}

type ProgressListener

type ProgressListener interface {
	HandleEvent(event *Event)
}

ProgressListener is an object that reacts to the events from the downloader.

Jump to

Keyboard shortcuts

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