imagefilter

package
v0.103.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DistroLister

type DistroLister interface {
	ListDistros() []string
}

type ImageFilter

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

ImageFilter is an a flexible way to filter the available images.

func New

func New(fac *distrofactory.Factory, repos DistroLister) (*ImageFilter, error)

New creates a new ImageFilter that can be used to filter the list of available images

func (*ImageFilter) Filter

func (i *ImageFilter) Filter(searchTerms ...string) ([]Result, error)

Filter filters the available images for the given distrofactory/reporegistry based on the given filter terms. Glob like patterns (?, *) are supported, see fnmatch(3).

Without a prefix in the filter term a simple name filtering is performed. With a prefix the specified property is filtered, e.g. "arch:i386". Adding filtering will narrow down the filtering (terms are combined via AND).

The following prefixes are supported: "distro:" - the distro name, e.g. rhel-9, or fedora* "arch:" - the architecture, e.g. x86_64 "type": - the image type, e.g. ami, or qcow? "bootmode": - the bootmode, e.g. "legacy", "uefi", "hybrid"

type OutputFormat

type OutputFormat string

OutputFormat contains the valid output formats for formatting results

const (
	OutputFormatDefault OutputFormat = ""
	OutputFormatText    OutputFormat = "text"
	OutputFormatJSON    OutputFormat = "json"
)

type Result

type Result struct {
	Distro  distro.Distro
	Arch    distro.Arch
	ImgType distro.ImageType
}

Result contains a result from a imagefilter.Filter run

type ResultsFormatter

type ResultsFormatter interface {
	Output(io.Writer, []Result) error
}

ResultFormatter will format the given result list to the given io.Writer

func NewResultsFormatter

func NewResultsFormatter(format OutputFormat) (ResultsFormatter, error)

NewResultFormatter will create a formatter based on the given format.

Jump to

Keyboard shortcuts

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