checks

package
v0.0.0-...-0664273 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

check.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PerformChecks

func PerformChecks(ctx config.TicliContext)

Entry point to performing checks

Types

type Check

type Check struct {
	// Name of check, for identification purposes
	CheckName string
	// Platform compatibility, e.g. "darwin"
	Platform string
	// Function to execute
	Fn CheckFunc
}

type CheckFunc

type CheckFunc func(ctx config.TicliContext) (CheckStatus, string, error)

type CheckResult

type CheckResult struct {
	// Name of check, for identification purposes
	CheckName string
	// Result of check
	Status CheckStatus
	// Optional information to relay to user
	Notes string
	// Source of check, e.g. "script", "platform", "rule"
	Source string
}

CheckResult represents the result of a check.

type CheckStatus

type CheckStatus int

CheckStatus represents the status of a check.

const (
	// StatusSuccess indicates that the check passed.
	StatusSuccess CheckStatus = iota
	// StatusFail indicates that the check failed.
	StatusFail
	// StatusWarning indicates that the check passed, but with warnings.
	StatusWarning
	// StatusInconclusive indicates that the check was inconclusive.
	StatusInconclusive
	// StatusSkipped indicates that the check was skipped deliberately, either through filtering or configuration.
	StatusSkipped
	// StatusNotApplicable indicates that the check was not applicable to the current platform.
	StatusNotApplicable
	// StatusUnknown indicates that the check status is unknown, hopefully the notes field has more information.
	StatusUnknown
)

func ParseCheckStatus

func ParseCheckStatus(s string) (CheckStatus, error)

ParseCheckStatus parses the given string s and returns the appropriate CheckStatus.

func (CheckStatus) String

func (s CheckStatus) String() string

Returns the string representation of the given CheckStatus.

type Checker

type Checker interface {
	DoSetup() error
	DoCleanup() error
	DoCheck() ([]CheckResult, error)
	CheckerName() string
}

func NewGenericChecker

func NewGenericChecker(ctx config.TicliContext) Checker

func NewPlatformChecker

func NewPlatformChecker(ctx config.TicliContext) Checker

type GenericChecker

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

Platform-independent hardcoded checks go in here.

func (*GenericChecker) CheckerName

func (c *GenericChecker) CheckerName() string

func (*GenericChecker) DoCheck

func (c *GenericChecker) DoCheck() ([]CheckResult, error)

func (*GenericChecker) DoCleanup

func (c *GenericChecker) DoCleanup() error

func (*GenericChecker) DoSetup

func (c *GenericChecker) DoSetup() error

type LinuxChecker

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

func (*LinuxChecker) CheckerName

func (c *LinuxChecker) CheckerName() string

func (*LinuxChecker) DoCleanup

func (c *LinuxChecker) DoCleanup(cfg config.ConfigType) error

func (*LinuxChecker) DoSetup

func (c *LinuxChecker) DoSetup(cfg config.ConfigType) error

type RulebasedChecker

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

func (*RulebasedChecker) CheckerName

func (c *RulebasedChecker) CheckerName() string

func (*RulebasedChecker) DoCheck

func (c *RulebasedChecker) DoCheck() ([]CheckResult, error)

func (*RulebasedChecker) DoCleanup

func (c *RulebasedChecker) DoCleanup() error

func (*RulebasedChecker) DoSetup

func (c *RulebasedChecker) DoSetup() error

type ScriptBasedChecker

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

Scriptbased checks go in here.

func (*ScriptBasedChecker) CheckerName

func (c *ScriptBasedChecker) CheckerName() string

func (*ScriptBasedChecker) DoCheck

func (gc *ScriptBasedChecker) DoCheck() ([]CheckResult, error)

func (*ScriptBasedChecker) DoCleanup

func (c *ScriptBasedChecker) DoCleanup() error

func (*ScriptBasedChecker) DoSetup

func (c *ScriptBasedChecker) DoSetup() error

Jump to

Keyboard shortcuts

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