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: 15 Imported by: 0

Documentation

Overview

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 SetupRoutesForHostDataController

func SetupRoutesForHostDataController(router *mux.Router, ctrl HostDataControllerInterface)

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

Types

type HostDataController

type HostDataController 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.HostDataServiceInterface
	// TimeNow contains a function that return the current time
	TimeNow func() time.Time
	// Log contains logger formatted
	Log *logrus.Logger
}

HostDataController is the struct used to handle the requests from agents and contains the concrete implementation of HostDataControllerInterface

func (*HostDataController) AuthenticateMiddleware

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

AuthenticateMiddleware return the middleware used to authenticate (request) users

func (*HostDataController) UpdateHostInfo

func (ctrl *HostDataController) UpdateHostInfo(w http.ResponseWriter, r *http.Request)

UpdateHostInfo update the informations about a host using the HostData in the request

type HostDataControllerInterface

type HostDataControllerInterface interface {
	// UpdateHostInfo update the informations about a host using the HostData in the request
	UpdateHostInfo(w http.ResponseWriter, r *http.Request)
	// AuthenticateMiddleware return the middleware used to authenticate users
	AuthenticateMiddleware() func(http.Handler) http.Handler
}

HostDataControllerInterface is a interface that wrap methods used to handle the request for HostData endpoints

Jump to

Keyboard shortcuts

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