Documentation
¶
Overview ¶
Package v2 provides a ready to use HTTP component.
Index ¶
Constants ¶
const ( // Alive represents a state defining an Alive state. Alive AliveStatus = 1 // Unhealthy represents an unhealthy alive state. Unhealthy AliveStatus = 2 // Ready represents a state defining a Ready state. Ready ReadyStatus = 1 // NotReady represents a state defining a NotReady state. NotReady ReadyStatus = 2 // AlivePath of the component. AlivePath = "GET /alive" // ReadyPath of the component. ReadyPath = "GET /ready" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AliveStatus ¶
type AliveStatus int
AliveStatus type representing the liveness of the service via HTTP component.
type Component ¶
type Component struct {
// contains filtered or unexported fields
}
Component implementation of an HTTP router.
type LivenessCheckFunc ¶ added in v0.74.0
type LivenessCheckFunc func() AliveStatus
LivenessCheckFunc defines a function type for implementing a liveness check.
type OptionFunc ¶ added in v0.74.0
OptionFunc definition for configuring the component in a functional way.
func WithHandlerTimeout ¶ added in v0.74.0
func WithHandlerTimeout(wt time.Duration) OptionFunc
WithHandlerTimeout functional option.
func WithReadTimeout ¶ added in v0.74.0
func WithReadTimeout(rt time.Duration) OptionFunc
WithReadTimeout functional option.
func WithShutdownGracePeriod ¶ added in v0.74.0
func WithShutdownGracePeriod(gp time.Duration) OptionFunc
WithShutdownGracePeriod functional option.
func WithTLS ¶ added in v0.74.0
func WithTLS(cert, key string) OptionFunc
WithTLS functional option.
func WithWriteTimeout ¶ added in v0.74.0
func WithWriteTimeout(wt time.Duration) OptionFunc
WithWriteTimeout functional option.
type ReadyCheckFunc ¶
type ReadyCheckFunc func() ReadyStatus
ReadyCheckFunc defines a function type for implementing a readiness check.
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
Route definition of an HTTP route.
func LivenessCheckRoute ¶ added in v0.74.0
func LivenessCheckRoute(acf LivenessCheckFunc) (*Route, error)
LivenessCheckRoute returns a route for liveness checks.
func LoggingRoutes ¶ added in v0.74.0
func LoggingRoutes() []*Route
LoggingRoutes returns a routes relates to logs.
func NewRoute ¶ added in v0.74.0
func NewRoute(path string, handler http.HandlerFunc, oo ...RouteOptionFunc) (*Route, error)
NewRoute creates a new raw route with functional configuration.
func ProfilingRoutes ¶ added in v0.74.0
func ReadyCheckRoute ¶ added in v0.74.0
func ReadyCheckRoute(rcf ReadyCheckFunc) (*Route, error)
ReadyCheckRoute returns a route for ready checks.
func (Route) Handler ¶ added in v0.40.1
func (r Route) Handler() http.HandlerFunc
func (Route) Middlewares ¶ added in v0.40.1
func (r Route) Middlewares() []patronhttp.Func
type RouteOptionFunc ¶ added in v0.74.0
RouteOptionFunc definition for configuring the route in a functional way.
func WithAuth ¶ added in v0.74.0
func WithAuth(auth auth.Authenticator) RouteOptionFunc
WithAuth option for setting the route auth.
func WithCache ¶ added in v0.74.0
func WithCache(cache cache.TTLCache, ageBounds httpcache.Age) RouteOptionFunc
WithCache option for setting the route cache.
func WithMiddlewares ¶ added in v0.74.0
func WithMiddlewares(mm ...patronhttp.Func) RouteOptionFunc
WithMiddlewares option for setting the route optionFuncs.
func WithRateLimiting ¶ added in v0.74.0
func WithRateLimiting(limit float64, burst int) (RouteOptionFunc, error)
WithRateLimiting option for setting a route rate limiter.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package auth provides abstractions for concrete implementations.
|
Package auth provides abstractions for concrete implementations. |
apikey
Package apikey is a concrete implementation of the auth abstractions.
|
Package apikey is a concrete implementation of the auth abstractions. |
Package cache provides a cache control and implementation components for http routes.
|
Package cache provides a cache control and implementation components for http routes. |