Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Critical = HealthState("critical") Unknown = HealthState("unknown") Warning = HealthState("warning") Passing = HealthState("passing") )
String representations of the canonical health states
Functions ¶
func Compare ¶
func Compare(a, b HealthState) int
Compare two HealthStates. Return 0 if equal, a value less than 0 if a < b and a value greater than 0 if a > b. The ordering is Passing > Warning > Unknown > Critical.
Types ¶
type HealthState ¶
type HealthState string
func ToHealthState ¶
func ToHealthState(str string) HealthState
ToHealthState converts a string to its corresponding HealthState value. Unrecognized values become Unknown.
func (HealthState) Int ¶
func (s HealthState) Int() int
Int converts a HealthState to an enum representation suitable for comparisons.
func (HealthState) Is ¶
func (s HealthState) Is(state string) bool
Returns whether the given string matches a particular health state
type Result ¶
Result stores the health state of a service.
type ResultList ¶
type ResultList []Result
ResultList is a type alias that adds some extra methods that operate on the list.
func (ResultList) MaxValue ¶
func (l ResultList) MaxValue() *Result
MaxValue returns a pointer to a Result with the best health status in the list. If the list is empty, returns nil.
func (ResultList) MinValue ¶
func (l ResultList) MinValue() *Result
MinValue returns a pointer to a Result with the worst health status in the list. If the list is empty, returns nil.