handlers

package
v0.0.0-...-57a1ebc Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HTTP is the unencrypted web service check
	HTTP = 1
	// HTTPS is the encrypted web service check
	HTTPS = 2
	// SSLCertificate is ssl certificate check
	SSLCertificate = 3
)

Variables

This section is empty.

Functions

func ClientError

func ClientError(w http.ResponseWriter, r *http.Request, status int)

ClientError will display error page for client error i.e. bad request

func NewHandlers

func NewHandlers(repo *DBRepo, a *config.AppConfig)

NewHandlers creates the handlers

func ServerError

func ServerError(w http.ResponseWriter, r *http.Request, err error)

ServerError will display error page for internal server error

Types

type ByHost

type ByHost []models.Schedule

ByHost allows us to sort by host

func (ByHost) Len

func (a ByHost) Len() int

Len is used to sort by host

func (ByHost) Less

func (a ByHost) Less(i, j int) bool

Less is used to sort by host

func (ByHost) Swap

func (a ByHost) Swap(i, j int)

Swap is used to sort by host

type DBRepo

type DBRepo struct {
	App *config.AppConfig
	DB  repository.DatabaseRepo
}

DBRepo is the db repo

var Repo *DBRepo

Repo is the repository

func NewPostgresqlHandlers

func NewPostgresqlHandlers(db *driver.DB, a *config.AppConfig) *DBRepo

NewPostgresqlHandlers creates db repo for postgres

func (*DBRepo) AdminDashboard

func (repo *DBRepo) AdminDashboard(w http.ResponseWriter, r *http.Request)

AdminDashboard displays the dashboard

func (*DBRepo) AllHealthyServices

func (repo *DBRepo) AllHealthyServices(w http.ResponseWriter, r *http.Request)

AllHealthyServices lists all healthy services

func (*DBRepo) AllHosts

func (repo *DBRepo) AllHosts(w http.ResponseWriter, r *http.Request)

AllHosts displays list of all hosts

func (*DBRepo) AllPendingServices

func (repo *DBRepo) AllPendingServices(w http.ResponseWriter, r *http.Request)

AllPendingServices lists all pending services

func (*DBRepo) AllProblemServices

func (repo *DBRepo) AllProblemServices(w http.ResponseWriter, r *http.Request)

AllProblemServices lists all problem services

func (*DBRepo) AllUsers

func (repo *DBRepo) AllUsers(w http.ResponseWriter, r *http.Request)

AllUsers lists all admin users

func (*DBRepo) AllWarningServices

func (repo *DBRepo) AllWarningServices(w http.ResponseWriter, r *http.Request)

AllWarningServices lists all warning services

func (*DBRepo) DeleteUser

func (repo *DBRepo) DeleteUser(w http.ResponseWriter, r *http.Request)

DeleteUser soft deletes a user

func (*DBRepo) Events

func (repo *DBRepo) Events(w http.ResponseWriter, r *http.Request)

Events displays the events page

func (*DBRepo) Host

func (repo *DBRepo) Host(w http.ResponseWriter, r *http.Request)

Host shows the host add/edit form

func (*DBRepo) ListEntries

func (repo *DBRepo) ListEntries(w http.ResponseWriter, r *http.Request)

ListEntries lists schedule entries

func (*DBRepo) Login

func (repo *DBRepo) Login(w http.ResponseWriter, r *http.Request)

Login attempts to log the user in

func (*DBRepo) LoginScreen

func (repo *DBRepo) LoginScreen(w http.ResponseWriter, r *http.Request)

LoginScreen shows the home (login) screen

func (*DBRepo) Logout

func (repo *DBRepo) Logout(w http.ResponseWriter, r *http.Request)

Logout logs the user out

func (*DBRepo) OneUser

func (repo *DBRepo) OneUser(w http.ResponseWriter, r *http.Request)

OneUser displays the add/edit user page

func (*DBRepo) PostHost

func (repo *DBRepo) PostHost(w http.ResponseWriter, r *http.Request)

PostHost handles posting of host form

func (*DBRepo) PostOneUser

func (repo *DBRepo) PostOneUser(w http.ResponseWriter, r *http.Request)

PostOneUser adds/edits a user

func (*DBRepo) PostSettings

func (repo *DBRepo) PostSettings(w http.ResponseWriter, r *http.Request)

PostSettings saves site settings

func (*DBRepo) PusherAuth

func (repo *DBRepo) PusherAuth(w http.ResponseWriter, r *http.Request)

PusherAuth authenticates the user to our pusher server

func (*DBRepo) ScheduledCheck

func (repo *DBRepo) ScheduledCheck(hostServiceID int)

ScheduledCheck performs a scheduled check on a host service by id

func (*DBRepo) SendPrivateMessage

func (repo *DBRepo) SendPrivateMessage(w http.ResponseWriter, r *http.Request)

SendPrivateMessage is sample code for sending to private channel

func (*DBRepo) SetSystemPref

func (repo *DBRepo) SetSystemPref(w http.ResponseWriter, r *http.Request)

SetSystemPref sets a given system preference to supplied value, and returns JSON response

func (*DBRepo) Settings

func (repo *DBRepo) Settings(w http.ResponseWriter, r *http.Request)

Settings displays the settings page

func (*DBRepo) StartMonitoring

func (repo *DBRepo) StartMonitoring()

StartMonitoring starts the monitoring process

func (*DBRepo) TestCheck

func (repo *DBRepo) TestCheck(w http.ResponseWriter, r *http.Request)

TestCheck manually tests a host service and sends JSON response

func (*DBRepo) ToggleMonitoring

func (repo *DBRepo) ToggleMonitoring(w http.ResponseWriter, r *http.Request)

ToggleMonitoring turns monitoring on and off

func (*DBRepo) ToggleServiceForHost

func (repo *DBRepo) ToggleServiceForHost(w http.ResponseWriter, r *http.Request)

ToggleServiceForHost turns a host service on or off (active or inactive)

Jump to

Keyboard shortcuts

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