rpc

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

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 RegisterHealthcheckRoute

func RegisterHealthcheckRoute(context client.Context, r *mux.Router)

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

type ErrorResponse struct {
	Code  int    `json:"code,omitempty"`
	Error string `json:"error"`
}

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"`
}

Jump to

Keyboard shortcuts

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