handlers

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BroadcastWakeRequest

type BroadcastWakeRequest struct {
	Port int    `json:"port" validate:"gte=1,lte=65535" example:"9"`
	Mac  string `json:"mac" validate:"required,mac" example:"00:11:22:33:44:55"`
}

func NewBroadcastWakeRequest

func NewBroadcastWakeRequest() *BroadcastWakeRequest

type Response

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

type RootHandler

type RootHandler struct{}

func NewRootHandler

func NewRootHandler() *RootHandler

func (*RootHandler) Health

func (h *RootHandler) Health(c echo.Context) error

Health godoc

@Summary		Health check
@Description	Health check
@Tags			root
@Accept			json
@Produce		json

@Success		200	{object}	Response	"OK"
@Failure		500	{object}	Response
@Router			/health [get]

func (*RootHandler) Register

func (h *RootHandler) Register(g *echo.Group)

func (*RootHandler) Root

func (h *RootHandler) Root(c echo.Context) error

Root godoc

@Summary		Root redirect to swagger
@Description	Redirect to swagger docs
@Tags			root
@Accept			plain
@Produce		html
@Router			/ [get]

type ServerHandler

type ServerHandler struct{}

func NewServerHandler

func NewServerHandler() *ServerHandler

func (*ServerHandler) BroadcastWakeServer

func (h *ServerHandler) BroadcastWakeServer(c echo.Context) error

BroadcastWakeServer godoc

@Summary		Wake a server using just a mac
@Description	Wake a server using Wake on LAN by using the mac and enumerating all available broadcast addresses
@Tags			servers
@Accept			json
@Produce		json
@Param			broadcastWakeRequest	body		BroadcastWakeRequest	true	"Broadcast wake request"
@Success		201						{object}	Response				"Wake on LAN packets successfully sent to all available broadcast addresses"
@Failure		400						{object}	Response				"Input validation failed"
@Failure		500						{object}	Response				"Wake on LAN packet failed to send"
@Router			/servers/broadcastwake [post]

func (*ServerHandler) Register

func (h *ServerHandler) Register(g *echo.Group)

func (*ServerHandler) WakeServer

func (h *ServerHandler) WakeServer(c echo.Context) error

WakeServer godoc

@Summary		Wake a server using a mac and a broadcast address
@Description	Wake a server using Wake on LAN using the mac and broadcast address provided
@Tags			servers
@Accept			json
@Produce		json
@Param			wakeServerRequest	body		WakeServerRequest	true	"Wake server request"
@Success		201					{object}	Response			"Wake on LAN packet sent"
@Failure		400					{object}	Response			"Input validation failed"
@Failure		500					{object}	Response			"Wake on LAN packet failed to send"
@Router			/servers/wake [post]

type UPSWakeHandler

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

func NewUPSWakeHandler

func NewUPSWakeHandler(cfg *config.Config, rulesFS hackpadfs.FS) *UPSWakeHandler

func (*UPSWakeHandler) ListNutServerMappings

func (h *UPSWakeHandler) ListNutServerMappings(c echo.Context) error

ListNutServerMappings godoc

@Summary		List NUT server mappings
@Description	List NUT server mappings using the config stored in the server
@Tags			UPSWake
@Accept			json
@Produce		json
@Success		200	{object}	config.Config
@Router			/upswake [get]

func (*UPSWakeHandler) Register

func (h *UPSWakeHandler) Register(g *echo.Group)

func (*UPSWakeHandler) RunWakeEvaluation

func (h *UPSWakeHandler) RunWakeEvaluation(c echo.Context) error

RunWakeEvaluation godoc

@Summary		Run wake evaluation
@Description	Run wake evaluation using the config and rules stored in the server
@Tags			UPSWake
@Accept			json
@Produce		json
@Param			macAddress	body		macAddress	true	"MAC address"
@Success		200			{object}	Response "Wake on LAN sent"
@Success		304			{object}	Response "No rule evaluated to true"
@Failure		400			{object}	Response "Bad request"
@Failure		404			{object}	Response "MAC address not found in the config"
@Failure		500			{object}	Response "Internal server error"
@Router			/upswake	[post]

type WakeServerRequest

type WakeServerRequest struct {
	Port      int    `json:"port" validate:"gte=1,lte=65535" example:"9"`
	Broadcast string `json:"broadcast" validate:"required,ip" example:"192.168.1.13"`
	Mac       string `json:"mac" validate:"required,mac" example:"00:11:22:33:44:55"`
}

func NewWakeServerRequest

func NewWakeServerRequest() *WakeServerRequest

Jump to

Keyboard shortcuts

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