simplestreams

package
v0.0.0-...-3c2809b Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: AGPL-3.0, Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DownloadableFile

type DownloadableFile struct {
	Path   string
	Sha256 string
	Size   int64
}

DownloadableFile represents a file with its URL, hash and size.

type Product

type Product struct {
	Aliases         string                    `json:"aliases"`
	Architecture    string                    `json:"arch"`
	OperatingSystem string                    `json:"os"`
	LXDRequirements map[string]string         `json:"lxd_requirements,omitempty"`
	Requirements    map[string]string         `json:"requirements,omitempty"`
	Release         string                    `json:"release"`
	ReleaseCodename string                    `json:"release_codename,omitempty"`
	ReleaseTitle    string                    `json:"release_title"`
	Supported       bool                      `json:"supported,omitempty"`
	SupportedEOL    string                    `json:"support_eol,omitempty"`
	Version         string                    `json:"version,omitempty"`
	Versions        map[string]ProductVersion `json:"versions"`

	// Non-standard fields (only used on some image servers).
	Variant string `json:"variant,omitempty"`
}

Product represents a single product inside download.json.

type ProductVersion

type ProductVersion struct {
	Items      map[string]ProductVersionItem `json:"items"`
	Label      string                        `json:"label,omitempty"`
	PublicName string                        `json:"pubname,omitempty"`
}

ProductVersion represents a particular version of a product.

type ProductVersionItem

type ProductVersionItem struct {
	LXDHashSha256DiskImg     string `json:"combined_disk1-img_sha256,omitempty"`
	LXDHashSha256DiskKvmImg  string `json:"combined_disk-kvm-img_sha256,omitempty"`
	LXDHashSha256DiskUefiImg string `json:"combined_uefi1-img_sha256,omitempty"`
	LXDHashSha256RootXz      string `json:"combined_rootxz_sha256,omitempty"`
	LXDHashSha256            string `json:"combined_sha256,omitempty"`
	LXDHashSha256SquashFs    string `json:"combined_squashfs_sha256,omitempty"`
	FileType                 string `json:"ftype"`
	HashMd5                  string `json:"md5,omitempty"`
	Path                     string `json:"path"`
	HashSha256               string `json:"sha256,omitempty"`
	Size                     int64  `json:"size"`
	DeltaBase                string `json:"delta_base,omitempty"`
}

ProductVersionItem represents a file/item of a particular ProductVersion.

type Products

type Products struct {
	ContentID string             `json:"content_id"`
	DataType  string             `json:"datatype"`
	Format    string             `json:"format"`
	License   string             `json:"license,omitempty"`
	Products  map[string]Product `json:"products"`
	Updated   string             `json:"updated,omitempty"`
}

Products represents the base of download.json.

func (*Products) ToLXD

func (s *Products) ToLXD() ([]api.Image, map[string][][]string)

ToLXD converts the products data into a list of LXD images and associated downloadable files.

type SimpleStreams

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

SimpleStreams represents a simplestream client.

func NewClient

func NewClient(url string, httpClient http.Client, useragent string) *SimpleStreams

NewClient returns a simplestreams client for the provided stream URL.

func (*SimpleStreams) GetAlias

func (s *SimpleStreams) GetAlias(imageType string, name string) (*api.ImageAliasesEntry, error)

GetAlias returns a LXD ImageAliasesEntry for the provided alias name.

func (*SimpleStreams) GetAliasArchitectures

func (s *SimpleStreams) GetAliasArchitectures(imageType string, name string) (map[string]*api.ImageAliasesEntry, error)

GetAliasArchitectures returns a map of architecture / alias entries for an alias.

func (*SimpleStreams) GetFiles

func (s *SimpleStreams) GetFiles(fingerprint string) (map[string]DownloadableFile, error)

GetFiles returns a map of files for the provided image fingerprint.

func (*SimpleStreams) GetImage

func (s *SimpleStreams) GetImage(fingerprint string) (*api.Image, error)

GetImage returns a LXD image for the provided image fingerprint.

func (*SimpleStreams) ListAliases

func (s *SimpleStreams) ListAliases() ([]api.ImageAliasesEntry, error)

ListAliases returns a list of image aliases for the provided image fingerprint.

func (*SimpleStreams) ListImages

func (s *SimpleStreams) ListImages() ([]api.Image, error)

ListImages returns a list of LXD images.

func (*SimpleStreams) SetCache

func (s *SimpleStreams) SetCache(path string, expiry time.Duration)

SetCache configures the on-disk cache.

type Stream

type Stream struct {
	Index   map[string]StreamIndex `json:"index"`
	Updated string                 `json:"updated,omitempty"`
	Format  string                 `json:"format"`
}

Stream represents the base structure of index.json.

type StreamIndex

type StreamIndex struct {
	DataType string   `json:"datatype"`
	Path     string   `json:"path"`
	Updated  string   `json:"updated,omitempty"`
	Products []string `json:"products"`
	Format   string   `json:"format,omitempty"`
}

StreamIndex represents the Index entry inside index.json.

Jump to

Keyboard shortcuts

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