Documentation ¶
Index ¶
- func CheckError(w http.ResponseWriter, status int, err error) bool
- func CheckInternalServerError(w http.ResponseWriter, err error) bool
- func NodeHealthRequestHandlerFn(clientCtx client.Context) http.HandlerFunc
- func PostProcessResponseBare(w http.ResponseWriter, ctx client.Context, body interface{})
- func RegisterHealthcheckRoute(context client.Context, r *mux.Router)
- func WriteErrorResponse(w http.ResponseWriter, status int, err string)
- type ErrorResponse
- type HealthcheckResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckError ¶
func CheckError(w http.ResponseWriter, status int, err error) bool
CheckError takes care of writing an error response if err is not nil. Returns false when err is nil; it returns true otherwise.
func CheckInternalServerError ¶
func CheckInternalServerError(w http.ResponseWriter, err error) bool
CheckInternalServerError attaches an error message to an HTTP 500 INTERNAL SERVER ERROR response. Returns false when err is nil; it returns true otherwise.
func NodeHealthRequestHandlerFn ¶
func NodeHealthRequestHandlerFn(clientCtx client.Context) http.HandlerFunc
NodeHealthRequestHandlerFn REST handler for node health check - aws recognizes only http status codes
func PostProcessResponseBare ¶
func PostProcessResponseBare(w http.ResponseWriter, ctx client.Context, body interface{})
PostProcessResponseBare post processes a body similar to PostProcessResponse except it does not wrap the body and inject the height.
func WriteErrorResponse ¶
func WriteErrorResponse(w http.ResponseWriter, status int, err string)
WriteErrorResponse prepares and writes a HTTP error given a status code and an error message.
Types ¶
type ErrorResponse ¶
ErrorResponse defines the attributes of a JSON error response.
func NewErrorResponse ¶
func NewErrorResponse(code int, err string) ErrorResponse
NewErrorResponse creates a new ErrorResponse instance.
type HealthcheckResponse ¶
type HealthcheckResponse struct {
Health string `json:"health"`
}