Documentation
¶
Index ¶
- type Authenticator
- type BaseRouter
- type DefaultHandler
- func (dh *DefaultHandler) HandleCheckStatusReq(w http.ResponseWriter, req *http.Request)
- func (dh *DefaultHandler) HandleGetJobReq(w http.ResponseWriter, req *http.Request)
- func (dh *DefaultHandler) HandleGetJobsReq(w http.ResponseWriter, req *http.Request)
- func (dh *DefaultHandler) HandleJobActionReq(w http.ResponseWriter, req *http.Request)
- func (dh *DefaultHandler) HandleJobLogReq(w http.ResponseWriter, req *http.Request)
- func (dh *DefaultHandler) HandleLaunchJobReq(w http.ResponseWriter, req *http.Request)
- func (dh *DefaultHandler) HandlePeriodicExecutions(w http.ResponseWriter, req *http.Request)
- type Handler
- type Router
- type SecretAuthenticator
- type Server
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶ added in v1.5.0
type Authenticator interface {
// Auth incoming request
//
// req *http.Request: the incoming request
//
// Returns:
// nil returned if successfully done
// otherwise an error returned
DoAuth(req *http.Request) error
}
Authenticator defined behaviors of doing auth checking.
type BaseRouter ¶ added in v1.5.0
type BaseRouter struct {
// contains filtered or unexported fields
}
BaseRouter provides the basic routes for the job service based on the golang http server mux.
func (*BaseRouter) ServeHTTP ¶ added in v1.5.0
func (br *BaseRouter) ServeHTTP(w http.ResponseWriter, req *http.Request)
ServeHTTP is the implementation of Router interface.
type DefaultHandler ¶ added in v1.5.0
type DefaultHandler struct {
// contains filtered or unexported fields
}
DefaultHandler is the default request handler which implements the Handler interface.
func NewDefaultHandler ¶ added in v1.5.0
func NewDefaultHandler(ctl core.Interface) *DefaultHandler
NewDefaultHandler is constructor of DefaultHandler.
func (*DefaultHandler) HandleCheckStatusReq ¶ added in v1.5.0
func (dh *DefaultHandler) HandleCheckStatusReq(w http.ResponseWriter, req *http.Request)
HandleCheckStatusReq is implementation of method defined in interface 'Handler'
func (*DefaultHandler) HandleGetJobReq ¶ added in v1.5.0
func (dh *DefaultHandler) HandleGetJobReq(w http.ResponseWriter, req *http.Request)
HandleGetJobReq is implementation of method defined in interface 'Handler'
func (*DefaultHandler) HandleGetJobsReq ¶ added in v1.8.0
func (dh *DefaultHandler) HandleGetJobsReq(w http.ResponseWriter, req *http.Request)
HandleGetJobsReq is implementation of method defined in interface 'Handler'
func (*DefaultHandler) HandleJobActionReq ¶ added in v1.5.0
func (dh *DefaultHandler) HandleJobActionReq(w http.ResponseWriter, req *http.Request)
HandleJobActionReq is implementation of method defined in interface 'Handler'
func (*DefaultHandler) HandleJobLogReq ¶ added in v1.5.0
func (dh *DefaultHandler) HandleJobLogReq(w http.ResponseWriter, req *http.Request)
HandleJobLogReq is implementation of method defined in interface 'Handler'
func (*DefaultHandler) HandleLaunchJobReq ¶ added in v1.5.0
func (dh *DefaultHandler) HandleLaunchJobReq(w http.ResponseWriter, req *http.Request)
HandleLaunchJobReq is implementation of method defined in interface 'Handler'
func (*DefaultHandler) HandlePeriodicExecutions ¶ added in v1.8.0
func (dh *DefaultHandler) HandlePeriodicExecutions(w http.ResponseWriter, req *http.Request)
HandlePeriodicExecutions is implementation of method defined in interface 'Handler'
type Handler ¶ added in v1.5.0
type Handler interface {
// HandleLaunchJobReq is used to handle the job submission request.
HandleLaunchJobReq(w http.ResponseWriter, req *http.Request)
// HandleGetJobReq is used to handle the job stats query request.
HandleGetJobReq(w http.ResponseWriter, req *http.Request)
// HandleJobActionReq is used to handle the job action requests (stop/retry).
HandleJobActionReq(w http.ResponseWriter, req *http.Request)
// HandleCheckStatusReq is used to handle the job service healthy status checking request.
HandleCheckStatusReq(w http.ResponseWriter, req *http.Request)
// HandleJobLogReq is used to handle the request of getting job logs
HandleJobLogReq(w http.ResponseWriter, req *http.Request)
// HandleJobLogReq is used to handle the request of getting periodic executions
HandlePeriodicExecutions(w http.ResponseWriter, req *http.Request)
// HandleGetJobsReq is used to handle the request of getting jobs
HandleGetJobsReq(w http.ResponseWriter, req *http.Request)
}
Handler defines approaches to handle the http requests.
type Router ¶ added in v1.5.0
type Router interface {
// ServeHTTP used to handle the http requests
ServeHTTP(w http.ResponseWriter, req *http.Request)
}
Router defines the related routes for the job service and directs the request to the right handler method.
func NewBaseRouter ¶ added in v1.5.0
func NewBaseRouter(handler Handler, authenticator Authenticator) Router
NewBaseRouter is the constructor of BaseRouter.
type SecretAuthenticator ¶ added in v1.5.0
type SecretAuthenticator struct{}
SecretAuthenticator implements interface 'Authenticator' based on simple secret.
type Server ¶ added in v1.5.0
type Server struct {
// contains filtered or unexported fields
}
Server serves the http requests.
func NewServer ¶ added in v1.5.0
func NewServer(ctx context.Context, router Router, cfg ServerConfig) *Server
NewServer is constructor of Server.