Documentation
¶
Index ¶
- func StaticFilePatternReplaceMiddleware(oldnew ...string) func(c *gin.Context)
- type PluginRoute
- type PluginRouterGroup
- type Server
- func (s *Server) Handler(ctx context.Context) http.Handler
- func (s *Server) ListenAndServe() error
- func (s *Server) RegisterPluginRoutes(group PluginRouterGroup) error
- func (s *Server) SetDashboardAPIPathPrefix(dashboardAPIPathPrefix string)
- func (s *Server) SetDashboardPathPrefix(dashboardPathPrefix string)
- func (s *Server) SetDashboardSentryDSN(dashboardSentryDSN string)
- func (s *Server) SetMaxBodyBytes(max int64)
- func (s *Server) WithAuth(authProvider func(*http.Request) (string, error))
- func (s *Server) WithCustomMiddlewares(customMiddlewares ...gin.HandlerFunc)
- func (s *Server) WithGroupAuth(groupAuthProvider func(*http.Request) (string, []string, error))
- type StatsIn
- type StatsOut
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StaticFilePatternReplaceMiddleware ¶
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 ¶
type PluginRoute struct {
Secured bool
Maintenance bool
Path string
Method string
Infos []fizz.OperationOption
Handlers []gin.HandlerFunc
}
type PluginRouterGroup ¶
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 (*Server) ListenAndServe ¶
ListenAndServe launches an http server and stays blocked until the server is shut down by a system signal
func (*Server) RegisterPluginRoutes ¶
func (s *Server) RegisterPluginRoutes(group PluginRouterGroup) error
RegisterPluginRoutes allows plugins to register custom routes
func (*Server) SetDashboardAPIPathPrefix ¶
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 ¶
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 ¶
SetDashboardSentryDSN configures a Sentry DSN URI to send UI exceptions and failures to.
func (*Server) WithAuth ¶
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 ¶
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 ¶
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