controller

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: GPL-3.0, GPL-3.0-or-later Imports: 12 Imported by: 0

Documentation

Overview

Package controller contains structs and methods used to provide endpoints for storing hostdata informations

Package controller contains structs and methods used to provide endpoints for storing hostdata informations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupRoutesForAlertQueueController

func SetupRoutesForAlertQueueController(router *mux.Router, ctrl AlertQueueControllerInterface)

SetupRoutesForAlertQueueController setup the routes of the router using the handler in the controller as http handler

Types

type AlertQueueController

type AlertQueueController struct {
	// Config contains the dataservice global configuration
	Config config.Configuration
	// Service contains the underlying service used to perform various logical and store operations
	Service service.AlertServiceInterface
	// TimeNow contains a function that return the current time
	TimeNow func() time.Time
	// Log contains logger formatted
	Log *logrus.Logger
}

AlertQueueController is the struct used to handle the requests from agents and contains the concrete implementation of AlertQueueControllerInterface

func (*AlertQueueController) AuthenticateMiddleware

func (ctrl *AlertQueueController) AuthenticateMiddleware() func(http.Handler) http.Handler

AuthenticateMiddleware return the middleware used to authenticate (request) users

func (*AlertQueueController) HostDataInsertion

func (ctrl *AlertQueueController) HostDataInsertion(w http.ResponseWriter, r *http.Request)

HostDataInsertion insert the event HostDataInsertion with the id in the queue

func (*AlertQueueController) ThrowNewAlert

func (ctrl *AlertQueueController) ThrowNewAlert(w http.ResponseWriter, r *http.Request)

type AlertQueueControllerInterface

type AlertQueueControllerInterface interface {
	ThrowNewAlert(w http.ResponseWriter, r *http.Request)
	// HostDataInsertion insert the event HostDataInsertion with the id in the queue
	HostDataInsertion(w http.ResponseWriter, r *http.Request)
	// AuthenticateMiddleware return the middleware used to authenticate users
	AuthenticateMiddleware() func(http.Handler) http.Handler
}

AlertQueueControllerInterface is a interface that wrap methods used to inserting events in the queue

Jump to

Keyboard shortcuts

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