rest

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSendMessage = errors.New("error sending message to the agent")

ErrSendMessage is returned by the ShutDown function when there were any error trying to send a message to the agent.

Functions

This section is empty.

Types

type Pusher

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

Pusher communicate state changes to agent by performing http calls

func NewPusher

func NewPusher(config PusherConfig, checkID string, logger *log.Entry) *Pusher

NewPusher Creates a new push component that can be used to inform the agent state changes of the check by using http rest calls.

func (*Pusher) Shutdown

func (p *Pusher) Shutdown() error

Shutdown signals the pusher to stop accepting messages and wait for the pending messages to be send.

func (*Pusher) UpdateState

func (p *Pusher) UpdateState(state interface{})

UpdateState sends a update state message to an agent by calling the rest api the agent must expose. Note that the function doesn't return any kind of error, that's because a Pusher is expected to handle error in sending push messages by it's own. WARN: Calling this method after calling ShutDown method will cause the program to panic.

type PusherConfig

type PusherConfig struct {
	AgentAddr string `toml:"AgentEndpoint"`
	BufferLen int    `toml:"BufferLen"`
}

PusherConfig holds the configuration needed by a RestPusher to send push notifications to the agent

Jump to

Keyboard shortcuts

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