simplestreams

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const PathPattern = "/images/{name}/{arch}/v{version}/{file}"

PathPattern represents a mux.Router pattern for file paths

Variables

View Source
var (
	// ErrInvalidTag indicates a tag isn't a valid image + version combo
	ErrInvalidTag = errors.New("invalid tag format")
	// ErrMetadataMissing indicates the metadata.yaml file is missing
	ErrMetadataMissing = errors.New("metadata.yaml missing from lxd.tar.xz")
	// ErrIncompleteRelease indicates a release is missing key assets
	ErrIncompleteRelease = errors.New("release is missing required assets")

	// ErrInvalidPath indicates an image path is not valid
	ErrInvalidPath = errors.New("invalid image file path")
)

Functions

func LoadImageMeta

func LoadImageMeta(url string) (lxdApi.ImageMetadata, string, error)

LoadImageMeta downloads an lxd.tar.xz file and parses the metadata.yaml file within

func LoadSHA256

func LoadSHA256(url string) (string, error)

LoadSHA256 downloads a SHA256 hash from a URL (file in the format used by the `sha256sum` command)

func ProductID

func ProductID(image TagImage, arch string) string

ProductID generates a "product ID" for an image

Types

type SimpleStreams

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

SimpleStreams represents a proxy which speaks simplestreams for a GitHub repo's releases

func NewSimpleStreams

func NewSimpleStreams() *SimpleStreams

NewSimpleStreams creates a new simplestreams proxy

func (*SimpleStreams) GenerateImages

func (s *SimpleStreams) GenerateImages(ctx context.Context, owner, repo string) (ss.Products, error)

GenerateImages generates an images stream from a GitHub repository

func (*SimpleStreams) GenerateStream

func (s *SimpleStreams) GenerateStream(ctx context.Context, owner, repo string) (ss.Stream, error)

GenerateStream generates a struct of the simplestreams index.json (for a given GitHub repo)

func (*SimpleStreams) GetPathURL

func (s *SimpleStreams) GetPathURL(ctx context.Context, owner, repo, name, arch, version, file string) (string, error)

GetPathURL converts a path (generated by releaseToProducts) and returns the GitHub asset URL for the path

type TagImage

type TagImage struct {
	Name    string
	Version semver.Version
}

TagImage represents an image's name and version parsed from a tag

func ParseTag

func ParseTag(tag string) (TagImage, error)

ParseTag attempts to parse a TagImage from a tag string

func (TagImage) String

func (t TagImage) String() string

Jump to

Keyboard shortcuts

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