ready

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: MIT Imports: 7 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 struct {
	// Frequency is how often the check should be retried when we are trying to
	// detect if the service comes online.
	Frequency time.Duration `yaml:"frequency" validate:"required"`
	// Maximum is the maximum number of attempts to make before giving up on
	// the service coming online.
	Maximum int        `yaml:"maximum" validate:"required"`
	HTTP    *HTTPCheck `yaml:"http" validate:"required"`
}

func (*Check) Test

func (c *Check) Test(ctx context.Context) error

Test runs a check

func (*Check) Wait

func (c *Check) Wait(ctx context.Context, log *zap.Logger) error

Wait will provide a way to run a check continously until it passes or the maximum try threshold is passed.

type HTTPCheck

type HTTPCheck struct {
	// Host is the IP/Hostname + Port combination to connect to when making the
	// request.
	Host string `yaml:"-"`
	// ExpectedStatus is the status code we expect the HTTP response to have.
	// It defaults to 200.
	ExpectedStatus int `yaml:"expectedStatus"`
	// Path is the path that the HTTP request should be made to.
	Path string `yaml:"path"`
	// Headers is a slice of headers to attach to the HTTP request.
	Headers []HTTPHeader `yaml:"headers"`
	// Timeout is the amount of time to allow for the request, failing if the
	// request takes longer. This defaults to 5 seconds.
	Timeout time.Duration `yaml:"timeout"`
}

func (*HTTPCheck) Test

func (hc *HTTPCheck) Test(ctx context.Context) error

type HTTPHeader

type HTTPHeader struct {
	// Name is the key of the headers to set. This will be canonicalized.
	Name string `yaml:"name"`
	// Value is the value to set in the header specified by Name
	Value string `yaml:"value"`
}

Jump to

Keyboard shortcuts

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