api

package
v0.0.0-...-ca83fcd Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const APIKeyHeaderKey = "apikey"

APIKeyHeader in this header thr right api key should be inserted

Variables

View Source
var (
	ContextKeyOffset = contextKey("offset")
	ContextKeyLimit  = contextKey("limit")
)

Functions

func MetricsHandler

func MetricsHandler(cfg MetricsConfig) func(next http.Handler) http.Handler

MetricsHandler creates a new directly usable handler

func Paginate

func Paginate(next http.Handler) http.Handler

Paginate is a middleware logic for populating the context with offset and limit values

func RoleCheck

func RoleCheck(allowedRoles []string) func(next http.Handler) http.Handler

RoleCheck implements a simple middleware handler for adding basic http auth to a route.

func SysAPIHandler

func SysAPIHandler(cfg SysAPIConfig) func(next http.Handler) http.Handler

SysAPIHandler creates a new directly usable handler

func TraceEnhancer

func TraceEnhancer(next http.Handler) http.Handler

TraceEnhancer is a middleware that will set the http method and url as operation-name of the top level span.

Types

type MetricsConfig

type MetricsConfig struct {
	// Skip particular requests from the handler
	SkipFunc func(r *http.Request) bool
}

MetricsConfig defining a handler for checking system id and api key

type SysAPIConfig

type SysAPIConfig struct {
	Apikey string
	// Skip particular requests from the handler
	SkipFunc func(r *http.Request) bool
}

SysAPIKey defining a handler for checking system id and api key

Jump to

Keyboard shortcuts

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