Documentation ¶
Index ¶
- Constants
- func ConfigHandler(w http.ResponseWriter, r *http.Request) (int, error)
- func CreateHTTPAPIHandler(client *clientK8s.Clientset, heapsterClient client.HeapsterClient, ...) (http.Handler, error)
- func FormatRequestLog(req *restful.Request) string
- func FormatResponseLog(resp *restful.Response, req *restful.Request) string
- func MakeGzipHandler(handler http.Handler) http.Handler
- func Monitor(verb, resource string, client, contentType string, httpCode int, ...)
- func RegisterMetrics()
- type APIHandler
- type AppConfig
- type AppHandler
- type CsrfToken
- type LocaleHandler
- type Localization
- type Translation
Constants ¶
const ( // RequestLogString is a template for request log message. RequestLogString = "[%s] Incoming %s %s %s request from %s" // ResponseLogString is a template for response log message. ResponseLogString = "[%s] Outcoming response to %s with %d status code" )
const ( // ConfigTemplateName is a name of config template ConfigTemplateName string = "appConfig" // ConfigTemplate is a template of a config ConfigTemplate string = "var appConfig_DO_NOT_USE_DIRECTLY = {{.}}" )
Variables ¶
This section is empty.
Functions ¶
func ConfigHandler ¶
func CreateHTTPAPIHandler ¶
func CreateHTTPAPIHandler(client *clientK8s.Clientset, heapsterClient client.HeapsterClient, clientConfig clientcmd.ClientConfig) (http.Handler, error)
CreateHTTPAPIHandler creates a new HTTP handler that handles all requests to the API of the backend.
func FormatRequestLog ¶
FormatRequestLog formats request log string. TODO(maciaszczykm): Display request body.
func FormatResponseLog ¶
FormatResponseLog formats response log string. TODO(maciaszczykm): Display response content.
func MakeGzipHandler ¶
MakeGzipHandler adds support for gzip compression for given handler
Types ¶
type APIHandler ¶
type APIHandler struct {
// contains filtered or unexported fields
}
APIHandler is a representation of API handler. Structure contains client, Heapster client and client configuration.
type AppConfig ¶
type AppConfig struct { // ServerTime is current server time (milliseconds elapsed since 1 January 1970 00:00:00 UTC). ServerTime int64 `json:"serverTime"` }
AppConfig is a global configuration of application.
type AppHandler ¶
AppHandler is an application handler.
func (AppHandler) ServeHTTP ¶
func (fn AppHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP serves HTTP endpoint with application configuration.
type LocaleHandler ¶
type LocaleHandler struct {
SupportedLocales []string
}
LocaleHandler serves different localized versions of the frontend application based on the Accept-Language header.
func CreateLocaleHandler ¶
func CreateLocaleHandler() *LocaleHandler
CreateLocaleHandler loads the localization configuration and constructs a LocaleHandler.
func (*LocaleHandler) ServeHTTP ¶
func (handler *LocaleHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
LocaleHandler serves different html versions based on the Accept-Language header.
type Localization ¶
type Localization struct {
Translations []Translation `json:"translations"`
}
Localization is a spec for the localization configuration of dashboard.
type Translation ¶
Translation is a single translation definition spec.