Documentation
¶
Overview ¶
Package webserver serves the REST API and the web user interface.
Index ¶
- Constants
- type CmdOpts
- type EnsureAuth
- type ReadyChecker
- type WebUIServer
- func (s *WebUIServer) CreateMetric(params []byte) error
- func (s *WebUIServer) CreatePreset(params []byte) error
- func (s *WebUIServer) CreateSource(params []byte) error
- func (s *WebUIServer) DeleteMetric(name string) error
- func (s *WebUIServer) DeletePreset(name string) error
- func (s *WebUIServer) DeleteSource(database string) error
- func (s *WebUIServer) GetMetrics() (res string, err error)
- func (s *WebUIServer) GetPresets() (res string, err error)
- func (s *WebUIServer) GetSources() (res string, err error)
- func (s *WebUIServer) IsCorrectPassword(lr loginReq) bool
- func (s *WebUIServer) UpdateMetric(name string, params []byte) error
- func (s *WebUIServer) UpdatePreset(name string, params []byte) error
- func (s *WebUIServer) UpdateSource(params []byte) error
Constants ¶
const ( WebDisableAll string = "all" WebDisableUI string = "ui" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CmdOpts ¶
type CmdOpts struct {
WebDisable string `` /* 172-byte string literal not displayed */
WebAddr string `` /* 135-byte string literal not displayed */
WebBasePath string `` /* 166-byte string literal not displayed */
WebUser string `long:"web-user" mapstructure:"web-user" description:"Admin username" env:"PW_WEBUSER"`
WebPassword string `long:"web-password" mapstructure:"web-password" description:"Admin password" env:"PW_WEBPASSWORD"`
}
CmdOpts specifies the internal web UI server command-line options
type EnsureAuth ¶
type EnsureAuth struct {
// contains filtered or unexported fields
}
func NewEnsureAuth ¶
func NewEnsureAuth(handlerToWrap http.HandlerFunc) *EnsureAuth
func (*EnsureAuth) ServeHTTP ¶
func (ea *EnsureAuth) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ReadyChecker ¶
type ReadyChecker interface {
Ready() bool
}
type WebUIServer ¶
type WebUIServer struct {
CmdOpts
http.Server
log.Logger
// contains filtered or unexported fields
}
func Init ¶
func Init(ctx context.Context, opts CmdOpts, mrw metrics.ReaderWriter, srw sources.ReaderWriter, rc ReadyChecker) (_ *WebUIServer, err error)
func (*WebUIServer) CreateMetric ¶
func (s *WebUIServer) CreateMetric(params []byte) error
CreateMetric creates new metrics (for REST collection endpoint) Supports both single and bulk creation from a map of metric names to metric definitions
func (*WebUIServer) CreatePreset ¶
func (s *WebUIServer) CreatePreset(params []byte) error
CreatePreset creates new presets (for REST collection endpoint) Supports both single and bulk creation
func (*WebUIServer) CreateSource ¶
func (s *WebUIServer) CreateSource(params []byte) error
CreateSource creates a new source (for REST collection endpoint)
func (*WebUIServer) DeleteMetric ¶
func (s *WebUIServer) DeleteMetric(name string) error
DeleteMetric removes the metric from the configuration
func (*WebUIServer) DeletePreset ¶
func (s *WebUIServer) DeletePreset(name string) error
DeletePreset removes the preset from the configuration
func (*WebUIServer) DeleteSource ¶
func (s *WebUIServer) DeleteSource(database string) error
DeleteSource removes the source from the list of configured sources
func (*WebUIServer) GetMetrics ¶
func (s *WebUIServer) GetMetrics() (res string, err error)
GetMetrics returns the list of metrics
func (*WebUIServer) GetPresets ¶
func (s *WebUIServer) GetPresets() (res string, err error)
GetPresets returns the list of available presets
func (*WebUIServer) GetSources ¶
func (s *WebUIServer) GetSources() (res string, err error)
GetSources returns the list of sources fo find databases for monitoring
func (*WebUIServer) IsCorrectPassword ¶
func (s *WebUIServer) IsCorrectPassword(lr loginReq) bool
func (*WebUIServer) UpdateMetric ¶
func (s *WebUIServer) UpdateMetric(name string, params []byte) error
UpdateMetric updates the stored metric information
func (*WebUIServer) UpdatePreset ¶
func (s *WebUIServer) UpdatePreset(name string, params []byte) error
UpdatePreset updates the stored preset
func (*WebUIServer) UpdateSource ¶
func (s *WebUIServer) UpdateSource(params []byte) error
UpdateSource updates the configured source information