checks

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2018 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	Node        string
	CheckID     string
	Name        string
	Status      string
	Notes       string
	Output      string
	ServiceID   string
	ServiceName string
	ServiceTags []string
	Definition  CheckDefinition
	CreateIndex uint64
	ModifyIndex uint64
}

Check the result of a Consul check.

func (*Check) IsCheckId

func (c *Check) IsCheckId(checkId string) bool

IsCheckId returns True if the Check CheckID/Name matches the specified check.

func (*Check) IsCheckName

func (c *Check) IsCheckName(checkName string) bool

IsCheckName returns True if the Check CheckName matches the specified checkName.

func (*Check) IsServiceId

func (c *Check) IsServiceId(serviceId string) bool

IsServiceId returns True if the Check ServiceId matches the specified serviceId.

func (*Check) IsServiceName

func (c *Check) IsServiceName(serviceName string) bool

IsServiceName returns True if the Check ServiceName matches the specified serviceName.

func (*Check) MatchesStatus

func (c *Check) MatchesStatus(s HealthStatus) (bool, error)

MatchesStatus returns True if the Check has a Status the same or worse than the specified status.

type CheckDefinition

type CheckDefinition struct {
	HTTP                           string
	Header                         map[string][]string
	Method                         string
	TLSSkipVerify                  bool
	TCP                            string
	Interval                       time.Duration
	Timeout                        time.Duration
	DeregisterCriticalServiceAfter time.Duration
}

CheckDefinition represents the configuration of a Consul check.

type HealthStatus

type HealthStatus int

HealthStatus represents the status of a Consul health check.

const (
	// HealthPassing represents Consul health check in the Passing state.
	HealthPassing HealthStatus = iota

	// HealthMaintenance represents Consul health check in the Maintenance state.
	HealthMaintenance

	// HealthWarning represents Consul health check in the Warning state
	HealthWarning

	// HealthCritical represents Consul health check in the Critical state
	HealthCritical
)

func ParseHealthStatus

func ParseHealthStatus(s string) (HealthStatus, bool)

ParseHealthStatus parses a string into a HealthStatus

func (HealthStatus) String

func (s HealthStatus) String() string

type Result

type Result struct {
	Status ResultStatus
	Detail string            `json:",omitempty"`
	Checks map[string]*Check `json:",omitempty"`
}

Result represents the result of a Consulate call.

type ResultStatus

type ResultStatus string

ResultStatus represents the status of a Consulate call.

const (
	// Ok represents a successful call to Consulate.
	Ok ResultStatus = "Ok"

	// Failed represents a failed call to Consulate.
	Failed ResultStatus = "Failed"

	// NoChecks represents verify check call to Consulate which had no checks to verify.
	NoChecks ResultStatus = "No Checks"
)

Jump to

Keyboard shortcuts

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