Documentation ¶
Index ¶
- Constants
- func Error(w http.ResponseWriter, err error, code int, logger *log.Logger)
- type AuthHandler
- type DockerHandler
- type EndpointHandler
- type FileHandler
- type Handler
- type ProxyFactory
- type SSOClient
- type SSOLoginParams
- type Server
- type SettingsHandler
- type TemplatesHandler
- type UploadHandler
- type UserHandler
- type WebSocketHandler
Constants ¶
const ( // ErrInvalidCredentialsFormat is an error raised when credentials format is not valid ErrInvalidCredentialsFormat = whale.Error("Invalid credentials format") // ErrInvalidCredentials is an error raised when credentials for a user are invalid ErrInvalidCredentials = whale.Error("Invalid credentials") // ErrAuthDisabled is an error raised when trying to access the authentication endpoints // when the server has been started with the --no-auth flag ErrAuthDisabled = whale.Error("Authentication is disabled") )
const ( // ErrInvalidJSON defines an error raised the app is unable to parse request data ErrInvalidJSON = whale.Error("Invalid JSON") // ErrInvalidRequestFormat defines an error raised when the format of the data sent in a request is not valid ErrInvalidRequestFormat = whale.Error("Invalid request data format") // ErrInvalidQueryFormat defines an error raised when the data sent in the query or the URL is invalid ErrInvalidQueryFormat = whale.Error("Invalid query format") // ErrEmptyResponseBody defines an error raised when whale excepts to parse the body of a HTTP response and there is nothing to parse ErrEmptyResponseBody = whale.Error("Empty response body") )
const API_ROOT string = "https://sparcssso.kaist.ac.kr/api/v2/"
const ( // ErrEndpointManagementDisabled is an error raised when trying to access the endpoints management endpoints // when the server has been started with the --external-endpoints flag ErrEndpointManagementDisabled = whale.Error("Endpoint management is disabled") )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthHandler ¶
type AuthHandler struct { *mux.Router Logger *log.Logger UserService whale.UserService CryptoService whale.CryptoService JWTService whale.JWTService EndpointService whale.EndpointService // contains filtered or unexported fields }
AuthHandler represents an HTTP API handler for managing authentication.
func NewAuthHandler ¶
func NewAuthHandler(mw *middleWareService) *AuthHandler
NewAuthHandler returns a new instance of AuthHandler.
type DockerHandler ¶
type DockerHandler struct { *mux.Router Logger *log.Logger EndpointService whale.EndpointService ProxyFactory ProxyFactory // contains filtered or unexported fields }
DockerHandler represents an HTTP API handler for proxying requests to the Docker API.
func NewDockerHandler ¶
func NewDockerHandler(mw *middleWareService, resourceControlService whale.ResourceControlService) *DockerHandler
NewDockerHandler returns a new instance of DockerHandler.
type EndpointHandler ¶
type EndpointHandler struct { *mux.Router Logger *log.Logger EndpointService whale.EndpointService FileService whale.FileService // contains filtered or unexported fields }
EndpointHandler represents an HTTP API handler for managing Docker endpoints.
func NewEndpointHandler ¶
func NewEndpointHandler(mw *middleWareService) *EndpointHandler
NewEndpointHandler returns a new instance of EndpointHandler.
type FileHandler ¶
FileHandler represents an HTTP API handler for managing static files.
func (*FileHandler) ServeHTTP ¶
func (fileHandler *FileHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Handler ¶
type Handler struct { AuthHandler *AuthHandler UserHandler *UserHandler EndpointHandler *EndpointHandler SettingsHandler *SettingsHandler TemplatesHandler *TemplatesHandler DockerHandler *DockerHandler WebSocketHandler *WebSocketHandler UploadHandler *UploadHandler FileHandler *FileHandler }
Handler is a collection of all the service handlers.
type ProxyFactory ¶
type ProxyFactory struct {
ResourceControlService whale.ResourceControlService
}
ProxyFactory is a factory to create reverse proxies to Docker endpoints
type SSOClient ¶
func NewSSOClient ¶
func (SSOClient) GetLoginParams ¶
func (s SSOClient) GetLoginParams() (*SSOLoginParams, error)
func (SSOClient) GetLogoutURI ¶
type SSOLoginParams ¶
type Server ¶
type Server struct { BindAddress string AssetsPath string AuthDisabled bool SSOID string SSOKey string EndpointManagement bool UserService whale.UserService EndpointService whale.EndpointService ResourceControlService whale.ResourceControlService CryptoService whale.CryptoService JWTService whale.JWTService FileService whale.FileService Settings *whale.Settings TemplatesURL string Handler *Handler }
Server implements the whale.Server interface
type SettingsHandler ¶
type SettingsHandler struct { *mux.Router Logger *log.Logger // contains filtered or unexported fields }
SettingsHandler represents an HTTP API handler for managing settings.
func NewSettingsHandler ¶
func NewSettingsHandler(mw *middleWareService) *SettingsHandler
NewSettingsHandler returns a new instance of SettingsHandler.
type TemplatesHandler ¶
type TemplatesHandler struct { *mux.Router Logger *log.Logger // contains filtered or unexported fields }
TemplatesHandler represents an HTTP API handler for managing templates.
func NewTemplatesHandler ¶
func NewTemplatesHandler(mw *middleWareService) *TemplatesHandler
NewTemplatesHandler returns a new instance of TemplatesHandler.
type UploadHandler ¶
UploadHandler represents an HTTP API handler for managing file uploads.
func NewUploadHandler ¶
func NewUploadHandler(mw *middleWareService) *UploadHandler
NewUploadHandler returns a new instance of UploadHandler.
type UserHandler ¶
type UserHandler struct { *mux.Router Logger *log.Logger UserService whale.UserService ResourceControlService whale.ResourceControlService CryptoService whale.CryptoService }
UserHandler represents an HTTP API handler for managing users.
func NewUserHandler ¶
func NewUserHandler(mw *middleWareService) *UserHandler
NewUserHandler returns a new instance of UserHandler.
type WebSocketHandler ¶
type WebSocketHandler struct { *mux.Router Logger *log.Logger EndpointService whale.EndpointService }
WebSocketHandler represents an HTTP API handler for proxying requests to a web socket.
func NewWebSocketHandler ¶
func NewWebSocketHandler() *WebSocketHandler
NewWebSocketHandler returns a new instance of WebSocketHandler.