Documentation
¶
Index ¶
- func Crash(server *http.Server) func(ctx *gin.Context)
- func GoTurboCPU(c *gin.Context)
- func GoTurboMemory(c *gin.Context)
- type Context
- type Handler
- func (h *Handler) AddProxy(c Context)
- func (h *Handler) Call(c Context)
- func (h *Handler) DeleteProxy(c Context)
- func (h *Handler) HTTPStat(c *gin.Context)
- func (h *Handler) Health(c *gin.Context)
- func (h *Handler) MakeHealthPerfect(c *gin.Context)
- func (h *Handler) MakeHealthSick(c *gin.Context)
- func (h *Handler) MakeReadyPerfect(c *gin.Context)
- func (h *Handler) MakeReadySick(c *gin.Context)
- func (h *Handler) Meta(c *gin.Context)
- func (h *Handler) ProxyRoute(c Context)
- func (h *Handler) Ready(c *gin.Context)
- func (h *Handler) Version(c *gin.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Crash ¶
Crash will make dobby to kill itself As dobby dies, the gin server also shuts down. @Summary Suicide @Description Make Dobby kill itself @Tags Control @Accept json @Router /control/crash [put]
func GoTurboCPU ¶
GoTurboCPU will make dobby go Turbo Watch the video `https://youtu.be/TNjAZZ3vQ8o?t=14` for more context on `Going Turbo` @Summary CPU Spike @Description Make Dobby create a CPU spike @Tags Control @Accept json @Produce json @Success 200 {object} model.ControlSuccess @Router /control/goturbo/cpu [put]
func GoTurboMemory ¶
GoTurboMemory will make dobby go Turbo Watch the video `https://youtu.be/TNjAZZ3vQ8o?t=14` for more context on `Going Turbo` @Summary Memory Spike @Description Make Dobby create a memory spike @Tags Control @Accept json @Produce json @Success 200 {object} model.ControlSuccess @Router /control/goturbo/memory [put]
Types ¶
type Context ¶
type Context interface { JSON(code int, obj interface{}) GetRequestBody() io.ReadCloser Status(code int) GetURI() *url.URL GetMethod() string SendResponse(response *http.Response, url string) }
Context is the interface represents the minimalistic gin.Context this is used to create mock struct while testing
func NewDefaultContext ¶
NewDefaultContext creates the wrapper Context with gin Context
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is provides HandlerFunc for Gin Context
func (*Handler) AddProxy ¶
AddProxy allows to configure proxy to any existing endpoint @Summary Add proxy to any http endpoint @Description Configure proxy route to another endpoint @Description Supports all REST operations @Tags Feature @Accept json @Produce json @Success 200 {object} interface{} @Router /proxy [post] @Param body body proxyRequest true "'{path:/time, method: GET, proxy: {url:http://worldtimeapi.org/api/timezone/asia/kolkata, method:GET}}'"
func (*Handler) Call ¶
Call allows to make a http call to another service and send the response @Summary Call a http endpoint @Description Make a http call to another service and send the response @Description Supports all REST operations @Tags Feature @Accept json @Produce json @Success 200 {object} interface{} @Router /call [post] @Param body body model.CallRequest true "'{url: http://httpbin.org/post, method: POST, body: {key: value}}' will make a post request to http://httpbin.org/post" https://github.com/swaggo/swag/blob/3d90fc0a5c6ef9566df81fe34425b0b35b0f651e/operation.go#L184
func (*Handler) DeleteProxy ¶
DeleteProxy allows to remove configured proxy to any existing endpoint @Summary Delete configured proxy to any http endpoint @Description Delete configured proxy route to another endpoint @Description Supports all REST operations @Tags Feature @Accept json @Produce json @Success 200 {object} interface{} @Router /proxy [delete] @Param body body proxyRequest true "'{path:/time, method: GET, proxy: {url:http://worldtimeapi.org/api/timezone/asia/kolkata, method:GET}}'"
func (*Handler) HTTPStat ¶
HTTPStat returns the status code send by the client @Summary Repeat Status @Description Ask Dobby to return the status code sent by the client @Tags Status @Accept json @Produce json @Failure 400 {object} model.Error @Param statusCode path int true "Status Code - E.g. 200" @Param delay query int false "Dela(milliseconds) - E.g. 1000" @Router /return/{statusCode} [get]
func (*Handler) Health ¶
Health return the dobby health status @Summary Dobby Health @Description Get Dobby's health status @Tags Status @Accept json @Produce json @Success 200 {object} model.Health @Failure 500 {object} model.Health @Router /health [get]
func (*Handler) MakeHealthPerfect ¶
MakeHealthPerfect godoc @Summary Make Healthy @Description Make Dobby healthy @Tags Control @Accept json @Produce json @Success 200 {object} model.ControlSuccess @Router /control/health/perfect [put]
func (*Handler) MakeHealthSick ¶
MakeHealthSick godoc @Summary Make Unhealthy @Description Make Dobby sick or unhealthy @Tags Control @Accept json @Produce json @Param resetInSeconds query int false "Recover health after sometime (seconds) - E.g. 2" @Success 200 {object} model.ControlSuccess @Router /control/health/sick [put]
func (*Handler) MakeReadyPerfect ¶
MakeReadyPerfect godoc @Summary Make Ready @Description Make Dobby ready @Tags Control @Accept json @Produce json @Success 200 {object} model.ControlSuccess @Router /control/ready/perfect [put]
func (*Handler) MakeReadySick ¶
MakeReadySick godoc @Summary Make Unready @Description Make Dobby unready @Tags Control @Accept json @Produce json @Success 200 {object} model.ControlSuccess @Param resetInSeconds query int false "Recover readiness after sometime (seconds) - E.g. 2" @Router /control/ready/sick [put]
func (*Handler) Meta ¶
Meta return dobby's metadata @Summary Dobby Metadata @Description Get Dobby's metadata @Tags Status @Accept json @Produce json @Success 200 {object} model.Metadata @Failure 503 {object} model.Error @Failure 500 {object} model.Error @Router /meta [get]
func (*Handler) ProxyRoute ¶
ProxyRoute will route to custom route if the route is found in proxyRequests this will be invoked when no standard routes are found in gin
func (*Handler) Ready ¶
Ready return the dobby health status @Summary Dobby Ready @Description Get Dobby's readiness @Tags Status @Accept json @Produce json @Success 200 {object} model.Ready @Failure 503 {object} model.Ready @Router /ready [get]