checks

package
v0.0.0-...-b7fae21 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2020 License: MIT Imports: 10 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 {
	Initialize(context.Context) error
	Configure(map[string]interface{}) error
	Run() ([]byte, error)
}

Check interface is the interface that all checks has to implement

func FromString

func FromString(checkType string) (Check, error)

FromString returns a `Check` parsed by a string

type HTTPCheck

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

HTTPCheck is a struct that defines the HTTP check. It holds the HTTP client and an HTTPCheckConfig struct.

func (*HTTPCheck) Configure

func (check *HTTPCheck) Configure(config map[string]interface{}) error

Configure decodes map[string]interface{} to an HTTPCheckConfig struct instance. It does so using `mapstructure`. After decoding, it configures some default values in case they were not given in the configuration.

func (*HTTPCheck) GetFullURL

func (check *HTTPCheck) GetFullURL() string

GetFullURL returns the string represantation of the check's URL

func (*HTTPCheck) Initialize

func (check *HTTPCheck) Initialize(ctx context.Context) error

Initialize initializing an HTTP client for the HTTPCheck.

func (*HTTPCheck) Run

func (check *HTTPCheck) Run() ([]byte, error)

Run runs the HTTP check

type HTTPCheckConfig

type HTTPCheckConfig struct {
	URL                  string `mapstructure:"url"`
	Method               string `mapstructure:"method"`
	Payload              []byte `mapstructure:"payload"`
	ErrorHTTPStatusCodes []int  `mapstructure:"error_http_status_codes"`
	// contains filtered or unexported fields
}

HTTPCheckConfig is a struct that holds the configuration required for the HTTP check. It is populated with `mapstructure` and holds some private fields that suppose to hold a parsed/verified version of the configuration input.

Jump to

Keyboard shortcuts

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