Documentation ¶
Index ¶
- Variables
- func New(laddr string, gf GraphFactory) *http.Server
- func RunServer(v *config.Verbosity, laddr string) error
- type ArtifactResource
- type DELETEManifestHandler
- type Deleteable
- type ExchangeFactory
- type ExchangeLogger
- type Exchanger
- type GDMHandler
- type GDMResource
- type GETManifestHandler
- type Getable
- type GraphFactory
- type Injector
- type KV
- type ManifestResource
- type MetaHandler
- func (mh *MetaHandler) DeleteHandling(factory ExchangeFactory) httprouter.Handle
- func (mh *MetaHandler) ExchangeGraph(w http.ResponseWriter, r *http.Request, p httprouter.Params) Injector
- func (mh *MetaHandler) GetHandling(factory ExchangeFactory) httprouter.Handle
- func (mh *MetaHandler) HeadHandling(factory ExchangeFactory) httprouter.Handle
- func (mh *MetaHandler) InstallPanicHandler()
- func (mh *MetaHandler) PutHandling(factory ExchangeFactory) httprouter.Handle
- type PUTArtifactHandler
- type PUTManifestHandler
- type Putable
- type QueryValues
- type Resource
- type ResponseWriter
- type RouteMap
- type ServerListHandler
- type ServerListResource
- type StateDefGetHandler
- type StateDefResource
- type StatusHandler
- type StatusMiddleware
- type StatusResource
Constants ¶
This section is empty.
Variables ¶
var ( // SousRouteMap is the configuration of route for the application. SousRouteMap = RouteMap{ {"gdm", "/gdm", &GDMResource{}}, {"defs", "/defs", &StateDefResource{}}, {"manifest", "/manifest", &ManifestResource{}}, {"artifact", "/artifact", &ArtifactResource{}}, {"status", "/status", &StatusResource{}}, {"servers", "/servers", &ServerListResource{}}, } )
Functions ¶
Types ¶
type ArtifactResource ¶
type ArtifactResource struct{}
func (*ArtifactResource) Put ¶
func (ar *ArtifactResource) Put() *PUTArtifactHandler
type DELETEManifestHandler ¶
type DELETEManifestHandler struct { *sous.State *QueryValues StateWriter graph.StateWriter }
DELETEManifestHandler handles DELETE exchanges for manifests
func (*DELETEManifestHandler) Exchange ¶
func (dmh *DELETEManifestHandler) Exchange() (interface{}, int)
Exchange implements Exchanger
type Deleteable ¶
type Deleteable interface {
Delete() Exchanger
}
Deleteable tags ResourceFamilies that respond to DELETE
type ExchangeFactory ¶
type ExchangeFactory func() Exchanger
An ExchangeFactory builds an Exchanger - they're used to configure the RouteMap
type ExchangeLogger ¶
type ExchangeLogger struct { Exchanger Exchanger *sous.LogSet *http.Request httprouter.Params }
ExchangeLogger wraps and logs the exchange.
func (*ExchangeLogger) Exchange ¶
func (xlog *ExchangeLogger) Exchange() (data interface{}, status int)
Exchange implements Exchanger on ExchangeLogger.
type Exchanger ¶
type Exchanger interface {
Exchange() (interface{}, int)
}
A Exchanger has an Exchange method - which is presumed to write to an injected ResponseWriter
type GDMHandler ¶
type GDMHandler struct {
GDM graph.CurrentGDM
}
GDMHandler is an injectable request handler
func (*GDMHandler) Exchange ¶
func (h *GDMHandler) Exchange() (interface{}, int)
Exchange implements the Handler interface
type GDMResource ¶
type GDMResource struct{}
GDMResource is the resource for the GDM
func (*GDMResource) Get ¶
func (gr *GDMResource) Get() Exchanger
Get implements Getable on GDMResource
type GETManifestHandler ¶
type GETManifestHandler struct { *sous.State *QueryValues }
GETManifestHandler handles GET exchanges for manifests
func (*GETManifestHandler) Exchange ¶
func (gmh *GETManifestHandler) Exchange() (interface{}, int)
Exchange implements Exchanger
type Getable ¶
type Getable interface {
Get() Exchanger
}
Getable tags ResourceFamilies that respond to GET
type Injector ¶
type Injector interface { Inject(...interface{}) error Add(...interface{}) }
Injector is an interface for DI systems.
type ManifestResource ¶
type ManifestResource struct{}
ManifestResource describes resources for manifests
func (*ManifestResource) Delete ¶
func (mr *ManifestResource) Delete() Exchanger
Delete implements Deleteable for ManifestResource
func (*ManifestResource) Get ¶
func (mr *ManifestResource) Get() Exchanger
Get implements Getable for ManifestResource
func (*ManifestResource) Put ¶
func (mr *ManifestResource) Put() Exchanger
Put implements Putable for ManifestResource
type MetaHandler ¶
type MetaHandler struct {
// contains filtered or unexported fields
}
The MetaHandler collects common behavior for route handlers.
func (*MetaHandler) DeleteHandling ¶
func (mh *MetaHandler) DeleteHandling(factory ExchangeFactory) httprouter.Handle
DeleteHandling handles Delete requests.
func (*MetaHandler) ExchangeGraph ¶
func (mh *MetaHandler) ExchangeGraph(w http.ResponseWriter, r *http.Request, p httprouter.Params) Injector
func (*MetaHandler) GetHandling ¶
func (mh *MetaHandler) GetHandling(factory ExchangeFactory) httprouter.Handle
GetHandling handles Get requests.
func (*MetaHandler) HeadHandling ¶
func (mh *MetaHandler) HeadHandling(factory ExchangeFactory) httprouter.Handle
HeadHandling handles Head requests.
func (*MetaHandler) InstallPanicHandler ¶
func (mh *MetaHandler) InstallPanicHandler()
InstallPanicHandler installs an panic handler into the router.
func (*MetaHandler) PutHandling ¶
func (mh *MetaHandler) PutHandling(factory ExchangeFactory) httprouter.Handle
PutHandling handles PUT requests.
type PUTArtifactHandler ¶
type PUTArtifactHandler struct { *http.Request *QueryValues sous.Inserter }
func (*PUTArtifactHandler) Exchange ¶
func (pah *PUTArtifactHandler) Exchange() (interface{}, int)
type PUTManifestHandler ¶
type PUTManifestHandler struct { *sous.State *sous.LogSet *http.Request *QueryValues StateWriter graph.StateWriter }
PUTManifestHandler handles PUT exchanges for manifests
func (*PUTManifestHandler) Exchange ¶
func (pmh *PUTManifestHandler) Exchange() (interface{}, int)
Exchange implements Exchanger
type Putable ¶
type Putable interface {
Put() Exchanger
}
Putable tags ResourceFamilies that respond to PUT
type QueryValues ¶
QueryValues wrap url.Values to keep them needing to be re-exported
type Resource ¶
type Resource interface{}
A ResourceFamily bundles up the exchangers that deal with a kind of resources (n.b. that properly, URL == resource, so a URL pattern == many resources
type ResponseWriter ¶
type ResponseWriter struct {
http.ResponseWriter
}
ResponseWriter wraps the the http.ResponseWriter interface. XXX This is a workaround for Psyringe
type RouteMap ¶
type RouteMap []routeEntry
RouteMap is a list of entries for routing
func (*RouteMap) BuildRouter ¶
BuildRouter builds a returns an http.Handler based on some constant configuration
type ServerListHandler ¶
ServerListHandler handles GET for /servers
func (*ServerListHandler) Exchange ¶
func (slh *ServerListHandler) Exchange() (interface{}, int)
Exchange implements Exchanger on ServerListHandler
type ServerListResource ¶
type ServerListResource struct{}
ServerListResource dispatches /servers
func (*ServerListResource) Get ¶
func (slr *ServerListResource) Get() Exchanger
Get implements Getable on ServerListResource
type StateDefGetHandler ¶
type StateDefGetHandler struct {
*sous.State
}
func (*StateDefGetHandler) Exchange ¶
func (sdg *StateDefGetHandler) Exchange() (interface{}, int)
type StateDefResource ¶
type StateDefResource struct{}
func (*StateDefResource) Get ¶
func (sdr *StateDefResource) Get() Exchanger
type StatusHandler ¶
type StatusHandler struct { GDM graph.CurrentGDM AutoResolver *sous.AutoResolver *sous.ResolveFilter }
StatusHandler handles requests for status.
func (*StatusHandler) Exchange ¶
func (h *StatusHandler) Exchange() (interface{}, int)
Exchange implements the Handler interface.
type StatusMiddleware ¶
type StatusMiddleware struct {
*sous.LogSet
}
A StatusMiddleware processes panics into 500s and other status codes.
func (*StatusMiddleware) HandlePanic ¶
func (ph *StatusMiddleware) HandlePanic(w http.ResponseWriter, r *http.Request, recovered interface{})
HandlePanic returns a 500 and logs the error. It uses the LogSet provided by the graph.
func (*StatusMiddleware) HandleResponse ¶
func (ph *StatusMiddleware) HandleResponse(status int, r *http.Request, w http.ResponseWriter, data interface{})
HandleResponse returns a 500 and logs the error. It uses the LogSet provided by the graph.
type StatusResource ¶
type StatusResource struct { }
StatusResource encapsulates a status response.
func (*StatusResource) Get ¶
func (*StatusResource) Get() Exchanger
Get implements Getable on StatusResource.