api

package
v0.0.0-...-f37d2a6 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2017 License: BSD-2-Clause Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Routes = map[Route]RouterArguments{
	Home:          RouterArguments{Path: "/", Method: http.MethodGet},
	Ping:          RouterArguments{Path: "/ping", Method: http.MethodGet},
	AddService:    RouterArguments{Path: "/services", Method: http.MethodPost},
	ListServices:  RouterArguments{Path: "/services", Method: http.MethodGet},
	RemoveService: RouterArguments{Path: "/services/{host}", Method: http.MethodDelete},
	FindService:   RouterArguments{Path: "/services/{host}", Method: http.MethodGet},
	UpdateService: RouterArguments{Path: "/services/{host}", Method: http.MethodPatch},
}

Functions

This section is empty.

Types

type ApihubServer

type ApihubServer struct {
	net.Listener
	// contains filtered or unexported fields
}

func New

func New(log lager.Logger, listenNetwork, listenAddr string, storage apihub.Storage, servicePublisher apihub.ServicePublisher) *ApihubServer

func (*ApihubServer) Handler

func (a *ApihubServer) Handler() http.Handler

func (*ApihubServer) ServeHTTP

func (a *ApihubServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*ApihubServer) Start

func (a *ApihubServer) Start(keep bool) error

func (*ApihubServer) Stop

func (a *ApihubServer) Stop() error

type CollectionSerializer

type CollectionSerializer struct {
	Items interface{} `json:"items"`
	Count int         `json:"item_count"`
}

func Collection

func Collection(data interface{}, count int) *CollectionSerializer

type Route

type Route int
const (
	Home Route = iota
	Ping
	AddService
	ListServices
	RemoveService
	FindService
	UpdateService
)

type Router

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

func NewRouter

func NewRouter() *Router

func (*Router) AddHandler

func (router *Router) AddHandler(args RouterArguments)

func (*Router) Handler

func (router *Router) Handler() http.Handler

func (*Router) NotFoundHandler

func (router *Router) NotFoundHandler(h http.Handler)

type RouterArguments

type RouterArguments struct {
	Handler    http.HandlerFunc
	Path       string
	PathPrefix string
	Method     string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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