handler

package
v0.0.0-...-fd51218 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2016 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

docker and swarm handler

kubernetes handler

kubernetes handler

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCredsHeaders

func AddCredsHeaders(req *http.Request, creds auth.Creds)

func DoRegistryCall

func DoRegistryCall(w http.ResponseWriter, r *http.Request, uriPath string, method string, creds auth.Creds, req_id string)

using internal api exposed by registry microservice

func DockerEndpointHandler

func DockerEndpointHandler(w http.ResponseWriter, r *http.Request)

http proxy forwarding with hijack support handler for docker/swarm

func ErrorHandler

func ErrorHandler(w http.ResponseWriter, r *http.Request, status int)

return general status code

func ErrorHandlerWithMsg

func ErrorHandlerWithMsg(w http.ResponseWriter, r *http.Request, status int, msg string)

func ForbiddenOperationHandler

func ForbiddenOperationHandler(w http.ResponseWriter, r *http.Request, msg string)

Return 403 for Forbidden URIs

func GetRegistryApiHosts

func GetRegistryApiHosts() (hosts []string)

func GetUriPattern

func GetUriPattern(uri string, prefixes []string) string

return uri prefix if supported

func HealthEndpointHandler

func HealthEndpointHandler(w http.ResponseWriter, r *http.Request)

func InitDockerHandler

func InitDockerHandler()

called from init() of the handler package, before any requests are handled

func InitHealthHandler

func InitHealthHandler()

called from init() of the package

func InitKubeAdminHandler

func InitKubeAdminHandler()

called from init() of the package

func InitKubeHandler

func InitKubeHandler()

called from init() of the package

func InjectRegAuthHeader

func InjectRegAuthHeader(r *http.Request, creds auth.Creds)

func IsExactPattern

func IsExactPattern(uri string, prefixes []string) bool

return true if the URI is exactly as provider patterns

func IsSupportedPattern

func IsSupportedPattern(uri string, prefixes []string) bool

return true if uri prefix is supported

func KubeAdminEndpointHandler

func KubeAdminEndpointHandler(w http.ResponseWriter, r *http.Request)

public handler for Kubernetes

func KubeEndpointHandler

func KubeEndpointHandler(w http.ResponseWriter, r *http.Request)

public handler for Kubernetes

func NoEndpointHandler

func NoEndpointHandler(w http.ResponseWriter, r *http.Request)

Return 404 for non-supported URIs

func NotAuthorizedHandler

func NotAuthorizedHandler(w http.ResponseWriter, r *http.Request)

Return 401 for non authorized requests

func NotImplementedHandler

func NotImplementedHandler(w http.ResponseWriter, r *http.Request)

Return 501 for non-supported URIs

func OkHandler

func OkHandler(w http.ResponseWriter, r *http.Request, status int)

return general status code

func OkHandlerWithMsg

func OkHandlerWithMsg(w http.ResponseWriter, r *http.Request, status int, msg string)

func TestPatt

func TestPatt()

Types

type Route

type Route struct {
	// contains filtered or unexported fields
}

func NewRoute

func NewRoute(method string, pattern string, handler RouteHandler) Route

type RouteHandler

type RouteHandler func(w http.ResponseWriter, r *http.Request, body []byte, creds auth.Creds, vars map[string]string, req_id string)

type Router

type Router struct {
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(routes []Route) *Router

func (*Router) CheckRoute

func (router *Router) CheckRoute(req *http.Request) (found bool, route Route)

func (*Router) DoRoute

func (router *Router) DoRoute(w http.ResponseWriter, req *http.Request, body []byte, creds auth.Creds, req_id string)

uses SelectRoute to determine target handler and invokes it

Jump to

Keyboard shortcuts

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