api

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustConstraint

func MustConstraint(s string) *semver.Constraints

Types

type CaptureWriter

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

CaptureWriter is a writer that stores all results in an internal buffer.

func (*CaptureWriter) Clear

func (w *CaptureWriter) Clear()

func (*CaptureWriter) Empty

func (w *CaptureWriter) Empty() bool

func (*CaptureWriter) Get

func (w *CaptureWriter) Get() []*CheckResult

func (*CaptureWriter) Len

func (w *CaptureWriter) Len() int

func (*CaptureWriter) WriteResult

func (w *CaptureWriter) WriteResult(result *CheckResult) error

type CheckResult

type CheckResult struct {
	Name    string                 `json:"name"`
	State   CheckState             `json:"state"`
	Summary string                 `json:"summary"`
	Details map[string]interface{} `json:"details,omitempty"`
}

func ErrorResult

func ErrorResult(name string, summary string, err error) *CheckResult

ErrorResult returns a CheckResult when an error occurs.

func PassResult

func PassResult(name string, summary string) *CheckResult

PassResults returns a CheckResult when everything is OK.

func SkippedResult

func SkippedResult(name string, summary string, err error) *CheckResult

SkippedResult returns a CheckResult indicating the check was skipped.

func WarnResult

func WarnResult(name string, summary string) *CheckResult

WarnResult returns a CheckResult when a warning occurs.

type CheckState

type CheckState int
const (
	// StatePassed indicates that the check passed successfully.
	StatePassed CheckState = iota

	// StateWarning indicates a condition where Coder will gracefully degrade,
	// but the user will not have an optimal experience.
	StateWarning

	// StateFailed indicates a condition where Coder will not be able to install
	// successfully.
	StateFailed

	// StateInfo indicates a result for informational or diagnostic purposes
	// only, with no bearing on the ability to install Coder.
	StateInfo

	// StateSkipped indicates an indeterminate result due to a skipped check.
	StateSkipped
)

func (CheckState) Color

func (s CheckState) Color() (PrintFunc, error)

func (CheckState) Emoji

func (s CheckState) Emoji() (string, error)

func (CheckState) MustColor

func (s CheckState) MustColor() PrintFunc

func (CheckState) MustEmoji

func (s CheckState) MustEmoji() string

func (CheckState) MustText

func (s CheckState) MustText() string

func (CheckState) String

func (s CheckState) String() string

func (CheckState) Text

func (s CheckState) Text() (string, error)

type CheckTarget

type CheckTarget string

CheckTarget indicates the subject of a Checker

const (
	// CheckTargetUndefined indicates that a Checker does not run against any specific target.
	CheckTargetUndefined CheckTarget = ""

	// CheckTargetLocal indicates that a Checker runs against the local machine.
	CheckTargetLocal CheckTarget = "local"

	// CheckTargetKubernetes indicates that a Checker runs against a Kubernetes cluster.
	CheckTargetKubernetes = "kubernetes"
)

type Checker

type Checker interface {
	// Validate returns an error if, and only if, the Checker was not
	// configured correctly.
	//
	// This method is responsible for verifying that the Checker has
	// all required parameters and the required parameters are valid,
	// and that optional parameters are valid, if set.
	Validate() error

	// Run runs the checks and returns the results.
	//
	// This method will run through the checks and return results.
	Run(context.Context) error
}

type DiscardWriter

type DiscardWriter struct {
}

DiscardWriter is a writer that discards all results.

func (*DiscardWriter) WriteResult

func (*DiscardWriter) WriteResult(_ *CheckResult) error

type PrintFunc

type PrintFunc func(format string, args ...interface{}) string

type ResultWriter

type ResultWriter interface {
	WriteResult(*CheckResult) error
}

ResultWriter writes the given result to a configured output.

Jump to

Keyboard shortcuts

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