Documentation ¶
Index ¶
- Variables
- func HTTPError(w http.ResponseWriter, httpErr int, msg string, err error)
- func JSONHandler(actual http.Handler) http.HandlerFunc
- type KaiServer
- func (ks *KaiServer) CreateJob(w http.ResponseWriter, r *http.Request)
- func (ks *KaiServer) DeleteJob(w http.ResponseWriter, r *http.Request)
- func (ks *KaiServer) GetJobDetails(w http.ResponseWriter, r *http.Request)
- func (ks *KaiServer) Handler() http.Handler
- func (ks *KaiServer) ListJobs(w http.ResponseWriter, r *http.Request)
- func (ks *KaiServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (ks *KaiServer) Start(keep bool) error
- func (ks *KaiServer) StartJob(w http.ResponseWriter, r *http.Request)
- func (ks *KaiServer) Stop() error
- type Route
- type Router
- type RouterArguments
Constants ¶
This section is empty.
Variables ¶
View Source
var Routes = map[Route]RouterArguments{ CreateJob: {Path: "/jobs", Method: http.MethodPost}, StartJob: {Path: "/jobs/{jobID}/start", Method: http.MethodPost}, ListJobs: {Path: "/jobs", Method: http.MethodGet}, GetJobDetails: {Path: "/jobs/{jobID}", Method: http.MethodGet}, DeleteJob: {Path: "/jobs/{jobID}", Method: http.MethodDelete}, }
Routes defines a map between the routes and the routes' argument
Functions ¶
func HTTPError ¶
func HTTPError(w http.ResponseWriter, httpErr int, msg string, err error)
HTTPError is a helper to return errors on handlers
func JSONHandler ¶
func JSONHandler(actual http.Handler) http.HandlerFunc
JSONHandler adds json headers
Types ¶
type KaiServer ¶
KaiServer represents the server for processing all job requests
func New ¶
func New(log *logging.Logger, config types.ServerConfig, listenNetwork string, listenAddr string, db db.Storage) *KaiServer
New creates a kai server
func (*KaiServer) CreateJob ¶
func (ks *KaiServer) CreateJob(w http.ResponseWriter, r *http.Request)
CreateJob creates a job
func (*KaiServer) DeleteJob ¶
func (ks *KaiServer) DeleteJob(w http.ResponseWriter, r *http.Request)
DeleteJob deletes a job
func (*KaiServer) GetJobDetails ¶
func (ks *KaiServer) GetJobDetails(w http.ResponseWriter, r *http.Request)
GetJobDetails returns the details of a given job
func (*KaiServer) ListJobs ¶
func (ks *KaiServer) ListJobs(w http.ResponseWriter, r *http.Request)
ListJobs lists all jobs
func (*KaiServer) ServeHTTP ¶
func (ks *KaiServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router represents the routers of mux
func (*Router) AddHandler ¶
func (router *Router) AddHandler(args RouterArguments)
AddHandler adds a handler for a router
type RouterArguments ¶
type RouterArguments struct { Handler http.HandlerFunc Path string Method string }
RouterArguments represents the mapping between path and method
Click to show internal directories.
Click to hide internal directories.