api

package
v1.31.2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: BSD-3-Clause Imports: 37 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 PluginRoute added in v1.20.0

type PluginRoute struct {
	Secured     bool
	Maintenance bool
	Path        string
	Method      string
	Infos       []fizz.OperationOption
	Handlers    []gin.HandlerFunc
}

type PluginRouterGroup added in v1.20.0

type PluginRouterGroup struct {
	Path        string
	Name        string
	Description string
	Routes      []PluginRoute
}

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) RegisterPluginRoutes added in v1.20.0

func (s *Server) RegisterPluginRoutes(group PluginRouterGroup) error

RegisterPluginRoutes allows plugins to register custom routes

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) 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

func (*Server) WithGroupAuth added in v1.19.0

func (s *Server) WithGroupAuth(groupAuthProvider func(*http.Request) (string, []string, error))

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

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