artifact

package
v0.0.0-...-955c50f Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Overview

Package artifact contains utilities for working downloading files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	// contains filtered or unexported fields
}

func NewSelfUpdateArtifact

func NewSelfUpdateArtifact(log log.T, appConfig appconfig.SsmagentConfig) *Artifact

func (*Artifact) Download

func (artifact *Artifact) Download(input DownloadInput) (output DownloadOutput, err error)

Download is a generic utility which attempts to download smartly.

func (*Artifact) Uncompress

func (artifact *Artifact) Uncompress(src, dest string) error

func (*Artifact) VerifyHash

func (artifact *Artifact) VerifyHash(input DownloadInput, output DownloadOutput) (bool, error)

VerifyHash verifies the hash of the url file as per specified hash algorithm type and its value

type DownloadInput

type DownloadInput struct {
	SourceURL            string
	DestinationDirectory string
	SourceChecksums      map[string]string
}

DownloadInput specifies the input to file download operation

type DownloadOutput

type DownloadOutput struct {
	LocalFilePath string
	IsUpdated     bool
	IsHashMatched bool
}

DownloadOutput holds the result of file download operation.

type IArtifact

type IArtifact interface {
	Download(input DownloadInput) (output DownloadOutput, err error)
	VerifyHash(input DownloadInput, output DownloadOutput) (bool, error)
	Uncompress(src, dest string) error
}

Jump to

Keyboard shortcuts

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