lql

package
v0.0.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2025 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const CtxKeyLQLClient = "lqlClient"

CtxKeyLQLClient is they key for the Client in the gin context.

Variables

View Source
var (
	// Logger is the Global logrus logger
	Logger *log.Logger
)

Functions

This section is empty.

Types

type Client

type Client interface {
	ClientCount() int
	IsAdmin(username string) bool
	SetLogger(logger *log.Logger)
	Close() error
	Request(context context.Context, request, authUser string, limit int) ([]gin.H, error)
	RequestRaw(context context.Context, request, outputFormat, authUser string, limit int) ([]byte, error)
}

func GinGetLqlClient

func GinGetLqlClient(c *gin.Context) (Client, error)

GinGetLqlClient gets the LQL Client from a gin context

func NewMultiClient

func NewMultiClient(minConn, maxConn int, localSocket, liveproxyDir string, multisiteUsersFile string) (Client, error)

func NewSingleClient

func NewSingleClient(minConn, maxConn int, network, address string) (Client, error)

type MultiClient

type MultiClient struct {
	// contains filtered or unexported fields
}

func (*MultiClient) ClientCount

func (c *MultiClient) ClientCount() int

func (*MultiClient) Close

func (c *MultiClient) Close() (result error)

func (*MultiClient) CreateClients

func (c *MultiClient) CreateClients() error

func (*MultiClient) IsAdmin

func (c *MultiClient) IsAdmin(username string) bool

func (*MultiClient) Request

func (c *MultiClient) Request(context context.Context, request, authUser string, limit int) ([]gin.H, error)

func (*MultiClient) RequestRaw

func (c *MultiClient) RequestRaw(context context.Context, request, outputFormat, authUser string, limit int) ([]byte, error)

func (*MultiClient) SetLogger

func (c *MultiClient) SetLogger(logger *log.Logger)

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(client Client, logger *log.Logger, htpasswdPath string) (*Server, error)

func (*Server) GetRouter

func (s *Server) GetRouter() *fizz.Fizz

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(address string)

type SingleClient

type SingleClient struct {
	// contains filtered or unexported fields
}

func (*SingleClient) ClientCount

func (c *SingleClient) ClientCount() int

func (*SingleClient) Close

func (c *SingleClient) Close() error

func (*SingleClient) IsAdmin

func (c *SingleClient) IsAdmin(username string) bool

func (*SingleClient) Request

func (c *SingleClient) Request(context context.Context, request, authUser string, limit int) ([]gin.H, error)

func (*SingleClient) RequestRaw

func (c *SingleClient) RequestRaw(context context.Context, request, outputFormat, authUser string, limit int) ([]byte, error)

func (*SingleClient) SetLogger

func (c *SingleClient) SetLogger(logger *log.Logger)

type UserData

type UserData struct {
	ForceAuthUserWebservice bool     `json:"force_authuser_webservice"`
	Looked                  bool     `json:"locked"`
	Roles                   []string `json:"roles"`
	ForceAuthUser           bool     `json:"force_authuser"`
	Alias                   string   `json:"alias"`
	StartUrl                string   `json:"start_url"`
}

type UsersWatcher

type UsersWatcher struct {
	// contains filtered or unexported fields
}

func NewUsersWatcher

func NewUsersWatcher(usersfile string) (*UsersWatcher, error)

func (*UsersWatcher) Close

func (uw *UsersWatcher) Close()

func (*UsersWatcher) FetchUsers

func (uw *UsersWatcher) FetchUsers() error

func (*UsersWatcher) IsAdmin

func (uw *UsersWatcher) IsAdmin(userName string) bool

func (*UsersWatcher) SetLogger

func (uw *UsersWatcher) SetLogger(logger *log.Logger)

func (*UsersWatcher) StartWatching

func (uw *UsersWatcher) StartWatching()

type V1RawRequestParams

type V1RawRequestParams struct {
	Method string `json:"method" validate:"required" description:"Either GET or COMMAND"`

	// COMMAND
	Command string `json:"command" description:"The command, required if method is COMMAND"`

	// GET
	Table   string     `json:"table" description:"The table to query, required if method is GET"`
	Columns []string   `json:"columns" description:"Columns to query, you should always provide this"`
	Query   [][]string `json:"query" description:"raw query Data"`

	// both
	Limit int `json:"limit" description:"Limit result count"`
}

V1RawRequestParams is a request for the RAW API

type V1StatsTacticalOverview

type V1StatsTacticalOverview struct {
	Hosts    *V1StatsTacticalOverviewEntry `json:"hosts" validate:"required" description:"Host stats"`
	Services *V1StatsTacticalOverviewEntry `json:"services" validate:"required" description:"Service stats"`
	Events   *V1StatsTacticalOverviewEntry `json:"events" validate:"required" description:"Event stats"`
}

type V1StatsTacticalOverviewEntry

type V1StatsTacticalOverviewEntry struct {
	All       float64 `json:"all" validate:"required" description:"all services/hosts"`
	Problems  float64 `json:"problems" validate:"require" description:"Num of problems"`
	Unhandled float64 `json:"unhandled" validate:"require" description:"Num of unhandled"`
	Stale     float64 `json:"stale" validate:"require" description:"Num of stale"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL