icingaapi

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	Address  string `yaml:"address" json:"address"`
	Port     int    `yaml:"port" json:"port"`
	Username string `yaml:"username" json:"-"`
	Password string `yaml:"password" json:"-"`
}

func (*Endpoint) IsReachable

func (endpoint *Endpoint) IsReachable(timeout time.Duration) error

IsReachable checks if the endpoint is reachable within 5 sec

func (*Endpoint) Request

func (endpoint *Endpoint) Request(resourcePath string, timeout time.Duration) ([]byte, error)

Request prepares a new request for the given resourcePath and executes it. Url for the request is build by the given resourcePath, and the Endpoint details (url => 'https://<endpoint.address>:<endpoint.port>/<resourcePath>')

A context with 10sec timeout for the request is build. BasicAuth with username and password set.
Returns err if something went wrong. Result is given as []byte.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳