Documentation ¶
Index ¶
- func ShowUI(rw http.ResponseWriter, req *http.Request)
- type ErrorResponse
- type Hub
- type RemoveConfigRequest
- type Service
- func (service Service) GetAllConfig(rw http.ResponseWriter, req *http.Request)
- func (service Service) GetAllEvents(rw http.ResponseWriter, req *http.Request)
- func (service Service) GetConfig(rw http.ResponseWriter, req *http.Request)
- func (service Service) GetEvent(rw http.ResponseWriter, req *http.Request)
- func (service Service) RemoveConfig(rw http.ResponseWriter, req *http.Request)
- func (service Service) SetConfig(rw http.ResponseWriter, req *http.Request)
- type SetConfigRequest
- type SystemResponse
- type WsHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrorResponse ¶ added in v1.0.37
type ErrorResponse struct {
Message string `json:"message"`
}
ErrorResponse represents an API response
type Hub ¶
type Hub struct { // Inbound messages from the connections. Broadcast chan []byte // contains filtered or unexported fields }
Hub is a connection hub for websockets
type RemoveConfigRequest ¶ added in v1.0.39
type RemoveConfigRequest struct {
Name string `json:"name"`
}
RemoveConfigRequest represents a 'remove config' request
type Service ¶
type Service struct { DB *data.Manager StartTime time.Time HistoryTTL time.Duration // WsHub is the websocket hub connection for // broadcasting config changes to anybody interested WsHub *Hub }
Service encapsulates API service operations
func (Service) GetAllConfig ¶
func (service Service) GetAllConfig(rw http.ResponseWriter, req *http.Request)
GetAllConfig godoc @Summary Gets all config items @Description Gets all config items @Tags config @Accept json @Produce json @Success 200 {object} api.SystemResponse @Failure 500 {object} api.ErrorResponse @Router /config [get]
func (Service) GetAllEvents ¶ added in v1.0.36
func (service Service) GetAllEvents(rw http.ResponseWriter, req *http.Request)
GetAllEvents godoc @Summary Gets all events in the system @Description Gets all events in the system @Tags events @Accept json @Produce json @Success 200 {object} api.SystemResponse @Failure 500 {object} api.ErrorResponse @Router /events [get]
func (Service) GetConfig ¶
func (service Service) GetConfig(rw http.ResponseWriter, req *http.Request)
GetConfig gets a specfic config item based on config item name
func (Service) GetEvent ¶ added in v1.0.36
func (service Service) GetEvent(rw http.ResponseWriter, req *http.Request)
GetEvent godoc @Summary Gets a log event. @Description Gets a log event. @Tags events @Accept json @Produce json @Param id path string true "The event id to get" @Success 200 {object} api.SystemResponse @Failure 404 {object} api.ErrorResponse @Router /event/{id} [get]
func (Service) RemoveConfig ¶
func (service Service) RemoveConfig(rw http.ResponseWriter, req *http.Request)
RemoveConfig godoc @Summary Removes a specific config item and broadcasts the change on the websocket @Description Removes a specific config item and broadcasts the change on the websocket @Tags config @Accept json @Produce json @Param config body api.RemoveConfigRequest true "The config item to remove" @Success 200 {object} api.SystemResponse @Failure 400 {object} api.ErrorResponse @Failure 500 {object} api.ErrorResponse @Router /config [delete]
func (Service) SetConfig ¶
func (service Service) SetConfig(rw http.ResponseWriter, req *http.Request)
SetConfig godoc @Summary Sets a specific config item and broadcasts the change on the websocket @Description Sets a specific config item and broadcasts the change on the websocket @Tags config @Accept json @Produce json @Param config body api.SetConfigRequest true "The config item to update" @Success 200 {object} api.SystemResponse @Failure 400 {object} api.ErrorResponse @Failure 500 {object} api.ErrorResponse @Router /config [post]
type SetConfigRequest ¶ added in v1.0.39
SetConfigRequest represents a 'set config' request
type SystemResponse ¶
type SystemResponse struct { Message string `json:"message"` Data interface{} `json:"data"` }
SystemResponse is a response for a system request