server

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

README

PagerDuty Agent: Server Package

The agent's daemon server, handling HTTP requests and responses from agent commands as well as managing the underlying event queue.

For example usage see:

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHeartbeatError = errors.New("an error was encountered while sending the heartbeat")

Functions

func Router

func Router(s *Server) *mux.Router

Types

type ErrorResponse

type ErrorResponse struct {
	Errors []string `json:"errors"`
}

type Heartbeat added in v0.3.0

type Heartbeat interface {
	Start()
	Shutdown()
}

func NewHeartbeat added in v0.3.0

func NewHeartbeat() Heartbeat

type Option

type Option func(*Server)

type Queue

type Queue interface {
	Enqueue(*eventsapi.EventContainer) (string, error)
	Retry(string) (int, error)
	Shutdown() error
	Start() error
	Status(string) ([]persistentqueue.StatusItem, error)
}

type RetryResponse

type RetryResponse struct {
	Message string `json:"message"`
}

type SendResponse

type SendResponse struct {
	Key string `json:"key"`
}

type Server

type Server struct {
	HTTPServer *http.Server
	Queue      Queue
	Heartbeat  Heartbeat
	// contains filtered or unexported fields
}

func NewServer

func NewServer(address, secret, pidfile string, queue Queue) *Server

func (*Server) HealthHandler

func (s *Server) HealthHandler(rw http.ResponseWriter, _ *http.Request)

func (*Server) RetryHandler

func (s *Server) RetryHandler(rw http.ResponseWriter, req *http.Request)

func (*Server) SendHandler

func (s *Server) SendHandler(rw http.ResponseWriter, req *http.Request)

func (*Server) Start

func (s *Server) Start() error

func (*Server) StatusHandler

func (s *Server) StatusHandler(rw http.ResponseWriter, req *http.Request)

type StatusResponse

type StatusResponse struct {
	StatusItems []persistentqueue.StatusItem `json:"status_items,omitempty"`
}

Jump to

Keyboard shortcuts

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