server

package
v0.0.0-...-f01516d Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package server provides a HTTP based JSON REST interface for creating, reading, and deleting secret volumes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound determines whether the supplied error's cause should be treated as a HTTP 404 not found.

Types

type HRHTTPRouterOption

type HRHTTPRouterOption func(*hrHTTPRouter) error

A HRHTTPRouterOption represents an argument to NewHRHTTPRouter.

func Router

Router provides an alternative Router to be used by NewHRHTTPRouter. A router returned by httprouter.New() is used by default.

type HTTPHandlers

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

HTTPHandlers contains HTTP handlers for secret volume CRD operations.

func NewHTTPHandlers

func NewHTTPHandlers(v volume.Manager, ho ...HTTPHandlersOption) (*HTTPHandlers, error)

NewHTTPHandlers creates HTTP handlers for secret volume CRD operations.

func (*HTTPHandlers) HTTPServer

func (h *HTTPHandlers) HTTPServer(addr string) *http.Server

HTTPServer returns a HTTP server configured to run at the supplied address with the HTTP handlers defined within HTTPHandlers.

type HTTPHandlersOption

type HTTPHandlersOption func(*HTTPHandlers) error

A HTTPHandlersOption represents an argument to NewHTTPHandlers.

func HTTPHandlersRouter

func HTTPHandlersRouter(r HTTPRouter) HTTPHandlersOption

HTTPHandlersRouter provides an alternative HTTPRouter implementation to be used by HTTPHandlers.

type HTTPRouter

type HTTPRouter interface {
	// Handler attaches the supplied Handler to the supplied HTTP method and
	// path.
	Handler(method, path string, handler http.Handler)
	// GET is a convenience wrapper around Handler.
	GET(path string, handler http.Handler)
	// POST is a convenience wrapper around Handler.
	POST(path string, handler http.Handler)
	// DELETE is a convenience wrapper around Handler.
	DELETE(path string, handler http.Handler)
	// ServeHTTP allows the use of a HTTPRouter as a http.Handler.
	ServeHTTP(w http.ResponseWriter, r *http.Request)
	// GetParam returns a parameter encoded within a path handled by Handler.
	// The syntax for encoding a parameter in the path will vary depending on
	// the underlying routing implementation, but it might (read: does) work
	// as per the https://github.com/julienschmidt/httprouter implementation.
	// i.e. If your route path is defined as /things/:thing GetParam(thing) will
	// return myawesomething given a Request for /things/myawesomething.
	GetParam(r *http.Request, key string) string
}

A HTTPRouter provides a HTTP request router (aka) mux implementation.

func NewHRHTTPRouter

func NewHRHTTPRouter(ro ...HRHTTPRouterOption) (HTTPRouter, error)

NewHRHTTPRouter creates a new HTTPRouter backed by https://github.com/julienschmidt/httprouter.

Jump to

Keyboard shortcuts

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