check

package
v0.0.0-...-354d10d Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelBest     = "best"
	LevelOptional = "optional"
	LevelWarn     = "warn"
)

Indicates the possible levels that can be utilized in the implementation of a check.

Variables

View Source
var (
	DefaultCertImageFilename    = "cert-image.json"
	DefaultRPMManifestFilename  = "rpm-manifest.json"
	DefaultTestResultsFilename  = "results.json"
	DefaultArtifactsTarFileName = "artifacts.tar"
	DefaultPyxisHost            = "catalog.redhat.com/api/containers"
	DefaultPyxisEnv             = "prod"
	SystemdDir                  = "/etc/systemd/system"
)

Functions

This section is empty.

Types

type Check

type Check interface {
	// Validate will test the provided image and determine whether the
	// image complies with the check's requirements.
	Validate(ctx context.Context, imageReference image.ImageReference) (result bool, err error)
	// Name returns the name of the check.
	Name() string
	// Metadata returns the check's metadata.
	Metadata() Metadata
	// Help return the check's help information
	Help() HelpText
}

Check as an interface containing all methods necessary to use and identify a given check.

func NewGenericCheck

func NewGenericCheck(
	name string,
	validatorFn ValidatorFunc,
	metadata Metadata,
	helptext HelpText,
) Check

NewGenericCheck returns a basic check implementation with the provided inputs. This is to enable a quick way to add additional checks to the default checks already enforced.

Developers can always define structs with internal keys and methods, and have that fulfill the Check interface. However, if no internal data or methods are needed, then this generic check provides an easier, purely-functional approach.

type HelpText

type HelpText struct {
	// Message is text provided to the user indicating where they should look
	// to find out why they failed or encountered an error in validation.
	Message string `json:"message" xml:"message"`
	// Suggestion is text provided to the user indicating what might need to
	// change in order to pass a check.
	Suggestion string `json:"suggestion" xml:"suggestion"`
}

HelpText is the help message associated with any given check

type Metadata

type Metadata struct {
	// Description contains a brief text detailing the overall goal of the check.
	Description string `json:"description" xml:"description"`
	// Level describes the certification level associated with the given check.
	//
	// TODO: define this more explicitly when requirements surrounding this metadata
	// text.
	Level string `json:"level" xml:"level"`
	// KnowledgeBaseURL is a URL detailing how to resolve a check failure.
	KnowledgeBaseURL string `json:"knowledge_base_url,omitempty" xml:"knowledgeBaseURL"`
	// CheckURL is a URL pointing to the official policy documentation from Red Hat, containing
	// information on exactly what is being tested and why.
	CheckURL string `json:"check_url,omitempty" xml:"checkURL"`
}

Metadata contains useful information regarding the check.

type ValidatorFunc

type ValidatorFunc = func(context.Context, image.ImageReference) (bool, error)

ValidatorFunc describes a function that, when executed, will check that an artifact (e.g. operator bundle) complies with a given check.

Jump to

Keyboard shortcuts

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