Documentation
¶
Index ¶
- func APIHandler(fn func(ctx context.Context, w http.ResponseWriter, r *http.Request) error) http.HandlerFunc
- func CheckClusterNoAuth(next http.Handler) http.Handler
- func ClusterNameFromContext(ctx context.Context) string
- func ContextWithClusterName(ctx context.Context, clusterName string) context.Context
- func Error(w http.ResponseWriter, r *http.Request, err error)
- func ErrorTypeToHTTPCode(typ lfsb.ErrorType) int
- func HTTPCodeToErrorType(code int) lfsb.ErrorType
- func RenderResponse(w http.ResponseWriter, resp any) error
- type ErrorResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIHandler ¶
func APIHandler(fn func(ctx context.Context, w http.ResponseWriter, r *http.Request) error) http.HandlerFunc
APIHandler transforms a handler func with a returning error into Go's http.Handler
func CheckClusterNoAuth ¶
CheckClusterNoAuth pulls the cluster information out of the request, doing no auth{nz} checks.
func ClusterNameFromContext ¶
ClusterNameFromContext returns the cluster name from a context. It panics if context doesn't have one.
func ContextWithClusterName ¶
ContextWithOrgID returns a context with the given cluster name.
func ErrorTypeToHTTPCode ¶
func HTTPCodeToErrorType ¶
func RenderResponse ¶
func RenderResponse(w http.ResponseWriter, resp any) error
RenderResponse renders API response as JSON.
Types ¶
Click to show internal directories.
Click to hide internal directories.