preflight

package
v0.62.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check interface {
	Enabled() bool
	SetEnabled(bool)
	SetConfig(CheckConfig) error
	Run(context.Context, *ctldgraph.ChangeGraph) error
}

func NewCheck

func NewCheck(cf CheckFunc, sf ConfigFunc, enabled bool) Check

type CheckConfig

type CheckConfig map[string]any

type ConfigFunc

type ConfigFunc func(CheckConfig) error

type Registry

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

Registry is a collection of preflight checks

func NewRegistry

func NewRegistry(checks map[string]Check) *Registry

NewRegistry will return a new *Registry with the provided set of preflight checks added to the registry

func (*Registry) AddCheck

func (c *Registry) AddCheck(name string, check Check)

AddCheck adds a new preflight check to the registry. The name provided will map to the provided Check.

func (*Registry) AddFlags

func (c *Registry) AddFlags(flags *pflag.FlagSet)

AddFlags adds the --preflight flag to a pflag.FlagSet and configures the preflight checks in the registry based on the user provided values. If no values are provided by a user the default values are used.

func (*Registry) Run

Run will execute any enabled preflight checks. The provided Context and ChangeGraph will be passed to the preflight checks that are being executed.

func (*Registry) Set

func (c *Registry) Set(s string) error

Set takes in a string in the format of CheckName,... and sets the specified preflight check as enabled if listed, otherwise, sets as disabled if not listed. Returns an error if there is a problem parsing the preflight checks

func (*Registry) SetConfig

func (c *Registry) SetConfig(conf []config.PreflightRule) error

func (*Registry) String

func (c *Registry) String() string

String returns a string representation of the enabled preflight checks. It follows the format: CheckName,... This method is needed so Registry implements the pflag.Value interface

func (*Registry) Type

func (c *Registry) Type() string

Type returns a string representing the type of the Registry. It is needed to implement the pflag.Value interface

Jump to

Keyboard shortcuts

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