http

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentHTTP added in v0.2.0

type AgentHTTP interface {
	// DisplayMetrics returns a summary of metrics collected by the agent.
	DisplayMetrics(resp http.ResponseWriter, req *http.Request) (interface{}, error)

	// ReloadAgent triggers the agent to reload policies and configuration.
	ReloadAgent(resp http.ResponseWriter, req *http.Request) (interface{}, error)
}

AgentHTTP is the interface that defines the HTTP handlers that an Agent must implement in order to be accessible through the HTTP API.

type Server

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

func NewHTTPServer

func NewHTTPServer(debug, prom bool, cfg *config.HTTP, log hclog.Logger, agent AgentHTTP) (*Server, error)

NewHTTPServer creates a new agent HTTP server.

func TestServer added in v0.2.0

func TestServer(t *testing.T, enableProm bool) (*Server, func())

func (*Server) Start

func (s *Server) Start()

Run is used to serve the HTTP server. The function will block and should be run via a go-routine. Unless http.Server.Serve panics/fails, the server can be stopped by calling the Stop function.

func (*Server) Stop

func (s *Server) Stop()

Stop attempts to gracefully stop the HTTP server. If the server does not stop before the timeout is reached, it will be ungracefully stopped.

Jump to

Keyboard shortcuts

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