types

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BundleParser

type BundleParser interface {
	ParseBundles(addonName string, manifestsPath string) ([]registry.Bundle, error)
}

type IndexImageExtractor

type IndexImageExtractor interface {
	ExtractBundlesFromImage(indexImage string, extractTo string) error
	CacheKey(indexImage, addonName string) string
	CacheHit(key string) bool
	ExtractionPath() string
	ManifestsPath(addonName string) string
	CacheLocation() string
	WriteToCache(value string) error
}

type MetaBundle

type MetaBundle struct {
	AddonMeta *v1alpha1.AddonMetadataSpec
	Bundles   []registry.Bundle
}

func NewMetaBundle

func NewMetaBundle(addonMeta *v1alpha1.AddonMetadataSpec, bundles []registry.Bundle) *MetaBundle

type Middleware

type Middleware func(Validator) Validator

type ValidateFunc

type ValidateFunc func(mb MetaBundle) ValidatorResult

type Validator

type Validator struct {
	Name        string
	Code        string
	Description string
	Runner      ValidateFunc
	// Optional: override defaults from RetryMiddleware
	RetryCount int
	// Optional: override defaults from RetryMiddleware
	RetryDelaySeconds int
}

func (Validator) Run added in v0.8.0

Run applies validation to the given MetaBundle returning a result indicating whether the validation was successful, failed, or encountered an error.

func (Validator) WithRunner

func (v Validator) WithRunner(fn ValidateFunc) Validator

WithRunner - Needs to create a new validator otherwise the memory address of the original Runner is lost, and it causes infinite loop scenarios (e.g.: RetryMiddleware)

type ValidatorList added in v0.8.0

type ValidatorList []Validator

ValidatorList - implements Sort interface to sort validators per Code

func (ValidatorList) Len added in v0.8.0

func (v ValidatorList) Len() int

func (ValidatorList) Less added in v0.8.0

func (v ValidatorList) Less(i, j int) bool

func (ValidatorList) Swap added in v0.8.0

func (v ValidatorList) Swap(i, j int)

type ValidatorResult

type ValidatorResult struct {

	// "" if validation is successful, else information about why it failed
	FailureMsgs []string
	// reports error that happened in the validation code
	Error error
	// if an error occured in the validation code, determines if it was retryable
	RetryableError bool
	// ValidatorCode is the code of the Validator which produced the result instance.
	ValidatorCode string
	// ValidatorDescription describes the Validator which produced the result instance.
	ValidatorDescription string
	// ValidatorName is the name of the Validator which produced the result instance.
	ValidatorName string
	// contains filtered or unexported fields
}

ValidatorResult - encompasses validator result information

func ValidatorResultError added in v0.8.0

func ValidatorResultError(err error, retryable bool) ValidatorResult

ValidatorResultError returns an errored validator result with the given error and flag to indicate whether the error may be retried.

func ValidatorResultFailure added in v0.8.0

func ValidatorResultFailure(msgs ...string) ValidatorResult

ValidatorResultFailure returns a failed validator result with the given failure messagees.

func ValidatorResultSuccess added in v0.8.0

func ValidatorResultSuccess() ValidatorResult

ValidatorResultSuccess returns an otherwise empty successful validator result.

func (ValidatorResult) IsError

func (vr ValidatorResult) IsError() bool

func (ValidatorResult) IsRetryableError

func (vr ValidatorResult) IsRetryableError() bool

func (ValidatorResult) IsSuccess

func (vr ValidatorResult) IsSuccess() bool

type ValidatorTest

type ValidatorTest interface {
	Name() string
	Run(MetaBundle) ValidatorResult
	SucceedingCandidates() ([]MetaBundle, error)
	FailingCandidates() ([]MetaBundle, error)
}

Jump to

Keyboard shortcuts

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