api

package
v1.14.2 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: BSD-3-Clause Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StaticFilePatternReplaceMiddleware added in v1.2.1

func StaticFilePatternReplaceMiddleware(oldnew ...string) func(c *gin.Context)

StaticFilePatternReplaceMiddleware is a middleware that modifies the response body with a given replace pattern Used inside utask to change response body of static files at flight, to customize path prefixes.

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) SetDashboardAPIPathPrefix added in v1.2.1

func (s *Server) SetDashboardAPIPathPrefix(dashboardAPIPathPrefix string)

SetDashboardAPIPathPrefix configures a custom path prefix that UI should use when calling utask API. Required when utask API is exposed behind a ProxyPass and UI need to know the absolute URI to call.

func (*Server) SetDashboardPathPrefix added in v1.2.1

func (s *Server) SetDashboardPathPrefix(dashboardPathPrefix string)

SetDashboardPathPrefix configures the custom path prefix for dashboard static files hosting. It doesn't change the path used by utask API to serve the files, it's only used inside UI files in order that dashboard can be aware of a ProxyPass configuration.

func (*Server) SetDashboardSentryDSN added in v1.5.0

func (s *Server) SetDashboardSentryDSN(dashboardSentryDSN string)

SetDashboardSentryDSN configures a Sentry DSN URI to send UI exceptions and failures to.

func (*Server) SetEditorPathPrefix added in v1.2.1

func (s *Server) SetEditorPathPrefix(editorPathPrefix string)

SetEditorPathPrefix configures a custom path prefix for editor static files hosting. It doesn't change the path used by utask API to serve the files, it's only used inside UI files in order that editor can be aware of a ProxyPass configuration.

func (*Server) SetMaxBodyBytes added in v1.5.1

func (s *Server) SetMaxBodyBytes(max int64)

SetMaxBodyBytes

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

func (*Server) WithCustomMiddlewares added in v1.8.3

func (s *Server) WithCustomMiddlewares(customMiddlewares ...gin.HandlerFunc)

WithCustomMiddlewares sets an array of customized gin middlewares. It helps for init plugins to include these customized middlewares in the api server

type StatsIn added in v1.14.0

type StatsIn struct {
	Tags []string `query:"tag" explode:"true"`
}

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, in *StatsIn) (*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