util

package
v0.0.0-...-4fbd946 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddIpToContextAndLogger

func AddIpToContextAndLogger(next http.Handler) http.Handler

func ContextWithIp

func ContextWithIp(ctx context.Context, ip iam4kube.IP) context.Context

func ErrorRenderer

func ErrorRenderer(errorCounter prometheus.Counter, f func(http.ResponseWriter, *http.Request) error) http.HandlerFunc

func Iam4kubeServerHeader

func Iam4kubeServerHeader() func(http.Handler) http.Handler

func IpFromContext

func IpFromContext(ctx context.Context) iam4kube.IP

func PageNotFound

func PageNotFound(w http.ResponseWriter, _ *http.Request)

func PerRequestContextLogger

func PerRequestContextLogger(logger *zap.Logger) func(next http.Handler) http.Handler

func RegisterAll

func RegisterAll(registry prometheus.Registerer, metrics ...prometheus.Collector) error

func RoleNameFromRoleArn

func RoleNameFromRoleArn(roleArn arn.ARN) (string, error)

RoleNameFromRoleArn returns the role name part of the ARN. It does not perform validation of the general ARN structure.

func SetServerHeader

func SetServerHeader(server string) func(http.Handler) http.Handler

func StartStopServer

func StartStopServer(ctx context.Context, srv *http.Server, shutdownTimeout time.Duration) error

func TimeRequest

func TimeRequest(histogram prometheus.Histogram, next http.Handler) http.HandlerFunc

func ValidateIamRoleArn

func ValidateIamRoleArn(roleArn arn.ARN) error

func WriteJson

func WriteJson(w http.ResponseWriter, data interface{}) error

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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