artifactresolver

package
v2.20.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopySingleFileTGZContent

func CopySingleFileTGZContent(dst io.Writer, tgzContentReader io.Reader) error

CopySingleFileTGZContent verifies that the TGZ content provided by the reader consists of a tar archive that contains a single regular file and writes the content of that file to the provided writer. Returns an error if the tar archive does not contain a single file (if it contains greater or fewer files or contains non-file entries).

func ResolveArtifact

func ResolveArtifact(locatorWithResolver LocatorWithResolverParam, defaultResolvers []Resolver, osArch osarch.OSArch, dst string, checksummer PathChecksummer, stdout io.Writer) error

ResolveArtifact retrieves the artifact specified by the provided locator and OSArch, writes it to the provided destination path and verifies its integrity if a checksum is provided. If the provided locator specifies a resolver, it will be used to retrieve the artifact; otherwise, the default resolvers will be used in order. If the locator specifies a checksum for the provided OSArch, then it will be used to verify the downloaded artifact using the provided hasher to compute the hash for the path. Returns an error if the artifact could not be resolved using the resolvers or if a checksum was provided and did not match. Note that, if the function resolves an artifact to the destination, the artifact will not be removed even if the function returns an error (for example, due to checksums not matching).

func ResolveArtifactTGZ

func ResolveArtifactTGZ(locatorWithResolver LocatorWithResolverParam, defaultResolvers []Resolver, osArch osarch.OSArch, dst string, stdout io.Writer) error

ResolveArtifactTGZ executes ResolveArtifact for an artifact that is known to be a TGZ that contains a single file. The checksum for the artifact is computed by computing the checksum of the file that is in the TGZ archive (rather than the TGZ archive itself).

func SHA256ChecksumFile

func SHA256ChecksumFile(fPath string) (string, error)

Types

type Locator

type Locator struct {
	Group   string
	Product string
	Version string
}

func (Locator) GroupAndProductString

func (l Locator) GroupAndProductString() string

func (Locator) String

func (l Locator) String() string

type LocatorParam

type LocatorParam struct {
	Locator
	Checksums map[osarch.OSArch]string
}

type LocatorWithResolverParam

type LocatorWithResolverParam struct {
	LocatorWithChecksums LocatorParam
	Resolver             Resolver
}

type PathChecksummer

type PathChecksummer func(in string) (string, error)

type Resolver

type Resolver interface {
	Resolve(locator LocatorParam, osArch osarch.OSArch, dst string, stdout io.Writer) error
}

func NewTemplateResolver

func NewTemplateResolver(tmpl string) (Resolver, error)

Jump to

Keyboard shortcuts

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