http

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// URL is the URL to monitor
	URL string `json:"url"`
	// Method is the HTTP method to use
	Method string `json:"method"`
	// Headers is the headers to send with the request
	Headers map[string]string `json:"headers"`
	// Body is the body to send with the request
	Body string `json:"body"`
	// ExpectedStatusCode is the expected status code
	ExpectedStatusCode int `json:"expectedStatusCode"`
	// ExpectedBody is the expected body
	ExpectedBody string `json:"expectedBody"`
}

Config is the config for the HTTP monitor

type ConfigHeader

type ConfigHeader struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

ConfigHeader is the header for the HTTP config

type JSONConfig

type JSONConfig struct {
	monitors.JSONBaseConfig
	URL                  string       `json:"url"`
	Method               string       `json:"method"`
	Headers              ConfigHeader `json:"headers"`
	ExpectedStatusCode   int          `json:"expectedStatusCode"`
	ExpectedResponseBody string       `json:"expectedResponseBody"`
}

JSONConfig is the config for the HTTP monitor

type Monitor

type Monitor struct {
	monitors.BaseMonitor

	Config *Config
	// contains filtered or unexported fields
}

Monitor is a monitor that monitors http endpoints it implements the Monitor interface

func (*Monitor) GetConfig

func (m *Monitor) GetConfig() interface{}

GetConfig returns the config for the monitor

func (*Monitor) GetNotificationBody

func (m *Monitor) GetNotificationBody(state *monitors.State) *monitors.NotificationBody

GetNotificationBody returns the notification body

func (*Monitor) Init

func (m *Monitor) Init() error

Init initializes the monitor

func (*Monitor) Process

func (m *Monitor) Process() error

Process runs the monitor

func (*Monitor) SetConfig

func (m *Monitor) SetConfig(config interface{}) error

SetConfig sets the config for the monitor

Jump to

Keyboard shortcuts

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