api

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2019 License: BSD-3-Clause Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server wraps the http handler that exposes a REST API to control the task orchestration engine

func NewServer

func NewServer() *Server

NewServer returns a new Server

func (*Server) Handler

func (s *Server) Handler(ctx context.Context) http.Handler

Handler returns the underlying http.Handler of a Server

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe launches an http server and stays blocked until the server is shut down by a system signal

func (*Server) WithAuth

func (s *Server) WithAuth(authProvider func(*http.Request) (string, error))

WithAuth configures the Server's auth middleware it receives an authProvider function capable of extracting a caller's identity from an *http.Request the authProvider function also has discretion to deny authorization for a request by returning an error

type StatsOut

type StatsOut struct {
	TaskStates map[string]float64 `json:"task_states"`
}

StatsOut aggregates different business stats: - a map of task states and their count

func Stats

func Stats(c *gin.Context) (*StatsOut, error)

Stats handles the http request to fetch µtask statistics common to all instances

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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