service

package
v0.0.0-...-5327f33 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: AGPL-3.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// enum
	FIRST  = 1
	VALUE  = 2
	EQUALS = 3
	END    = 4
	RESET  = 10
)

Variables

This section is empty.

Functions

func ScriptPrintf

func ScriptPrintf(val interface{})

Types

type AdvancedService

type AdvancedService struct {
	ServiceConfig
}

func (*AdvancedService) AddAdvanced

func (as *AdvancedService) AddAdvanced(data model.TableGlobalSettings) (string, error)

this method gets all users from database

func (*AdvancedService) DeleteAdvancedAgainstGUID

func (as *AdvancedService) DeleteAdvancedAgainstGUID(guid string) (string, error)

this method delete the mapping from database

func (*AdvancedService) GetAdvancedAgainstGUID

func (as *AdvancedService) GetAdvancedAgainstGUID(guid string) (string, error)

this method gets all the mapping from database

func (*AdvancedService) GetAll

func (as *AdvancedService) GetAll() (string, error)

this method create new user in the database it doesn't check internally whether all the validation are applied or not

func (*AdvancedService) UpdateAdvancedAgainstGUID

func (as *AdvancedService) UpdateAdvancedAgainstGUID(guid string, data model.TableGlobalSettings) (string, error)

this method gets all users from database

type AgentsubService

type AgentsubService struct {
	ServiceConfig
}

func (*AgentsubService) AddAgentsub

func (hs *AgentsubService) AddAgentsub(data model.TableAgentLocationSession) (string, error)

AddAgentsub creates a new HEPSUB agent session

func (*AgentsubService) DeleteAgentsubAgainstGUID

func (hs *AgentsubService) DeleteAgentsubAgainstGUID(guid string) (string, error)

DeleteAgentsubAgainstGUID removes an existing HEPSUB agent session

func (*AgentsubService) DoSearchByPost

func (hs *AgentsubService) DoSearchByPost(agentObject model.TableAgentLocationSession, searchObject model.SearchObject, typeRequest string) ([]byte, error)

DoSearchByPost loads the subscriber mappings from the database and builds a HEPSUB search query using request data

func (*AgentsubService) GetAgentsub

func (hs *AgentsubService) GetAgentsub() (string, error)

GetAgentsub gets all active HEPSUB agent sessions from database

func (*AgentsubService) GetAgentsubAgainstGUID

func (hs *AgentsubService) GetAgentsubAgainstGUID(guid string) (string, error)

GetAgentsubAgainstGUID gets a specific active HEPSUB agent session from database identified by GUID

func (*AgentsubService) GetAgentsubAgainstGUIDAndType

func (hs *AgentsubService) GetAgentsubAgainstGUIDAndType(guid string, typeRequest string) (model.TableAgentLocationSession, error)

GetAgentsubAgainstGUIDAndType gets an active HEPSUB agent session by GUID for a given type (pattern matched)

func (*AgentsubService) GetAgentsubAgainstType

func (hs *AgentsubService) GetAgentsubAgainstType(typeRequest string) (string, error)

GetAgentsubAgainstType gets all active HEPSUB agent sessions from database for a given type (pattern matched)

func (*AgentsubService) GetAuthKeyByHeaderToken

func (hs *AgentsubService) GetAuthKeyByHeaderToken(token string) (string, error)

GetAuthKeyByHeaderToken gets user auth tokens from database

func (*AgentsubService) UpdateAgentsubAgainstGUID

func (hs *AgentsubService) UpdateAgentsubAgainstGUID(guid string, data model.TableAgentLocationSession) (string, error)

UpdateAgentsubAgainstGUID updates an existing HEPSUB agent session

type AliasService

type AliasService struct {
	ServiceConfig
}

func (*AliasService) Add

func (as *AliasService) Add(alias *model.TableAlias) (string, error)

this method create new user in the database it doesn't check internally whether all the validation are applied or not

func (*AliasService) Delete

func (as *AliasService) Delete(alias *model.TableAlias) error

this method create new user in the database it doesn't check internally whether all the validation are applied or not

func (*AliasService) Get

func (as *AliasService) Get(alias *model.TableAlias) (model.TableAlias, error)

this method create new user in the database it doesn't check internally whether all the validation are applied or not

func (*AliasService) GetAll

func (as *AliasService) GetAll() ([]model.TableAlias, error)

this method create new user in the database it doesn't check internally whether all the validation are applied or not

func (*AliasService) GetAllActive

func (as *AliasService) GetAllActive() ([]model.TableAlias, error)

this method create new user in the database it doesn't check internally whether all the validation are applied or not

func (*AliasService) Update

func (as *AliasService) Update(alias *model.TableAlias) error

this method create new user in the database it doesn't check internally whether all the validation are applied or not

type AuthtokenService

type AuthtokenService struct {
	ServiceConfig
}

func (*AuthtokenService) AddAuthtoken

func (hs *AuthtokenService) AddAuthtoken(data model.TableAuthToken) (string, error)

this method gets all users from database

func (*AuthtokenService) DeleteAuthtokenAgainstGUID

func (hs *AuthtokenService) DeleteAuthtokenAgainstGUID(guid string) (string, error)

this method gets all users from database

func (*AuthtokenService) GetAuthtoken

func (hs *AuthtokenService) GetAuthtoken() (string, error)

this method gets all users from database

func (*AuthtokenService) GetAuthtokenAgainstGUID

func (hs *AuthtokenService) GetAuthtokenAgainstGUID(guid string) (string, error)

this method gets all users from database

func (*AuthtokenService) UpdateAuthtokenAgainstGUID

func (hs *AuthtokenService) UpdateAuthtokenAgainstGUID(guid string, data model.TableAuthToken) (string, error)

this method gets all users from database

type DashBoardService

type DashBoardService struct {
	ServiceConfig
}

func (*DashBoardService) DeleteAllDashboards

func (us *DashBoardService) DeleteAllDashboards(username string) (string, error)

this method gets all users from database

func (*DashBoardService) DeleteDashboard

func (us *DashBoardService) DeleteDashboard(username, dashboardId string) (string, error)

this method gets all users from database

func (*DashBoardService) GetDashBoard

func (us *DashBoardService) GetDashBoard(username, param string) (string, error)

this method gets all users from database

func (*DashBoardService) GetDashBoardsLists

func (us *DashBoardService) GetDashBoardsLists(username string) (string, error)

this method gets all users from database

func (*DashBoardService) InsertDashboard

func (us *DashBoardService) InsertDashboard(username, dashboardId string, data json.RawMessage) (string, error)

this method gets all users from database

func (*DashBoardService) InsertDashboardByName

func (us *DashBoardService) InsertDashboardByName(username string, dashboardName string, data json.RawMessage) (string, error)

this method gets all users from database

func (*DashBoardService) UpdateDashboard

func (us *DashBoardService) UpdateDashboard(username, dashboardId string, data json.RawMessage) (string, error)

this method gets all users from database

type ExternalDecoder

type ExternalDecoder struct {
	Binary    string   `json:"binary"`
	Param     string   `json:"param"`
	Protocols []string `json:"protocols"`
	UID       uint32   `json:"uid"`
	GID       uint32   `json:"gid"`
	Active    bool     `json:"active"`
}

external decoder

type GrafanaService

type GrafanaService struct {
	ServiceConfig
	ServiceGrafana
}

StatisticService : here you tell us what Salutation is

func (*GrafanaService) GrafanaFolders

func (ps *GrafanaService) GrafanaFolders() (string, error)

This method returns all Grafana Folders

func (*GrafanaService) GrafanaGetDashboardByUUUID

func (ps *GrafanaService) GrafanaGetDashboardByUUUID(uuid string) (string, error)

This method perfroms search in Grafana for Dashboard by UUID

func (*GrafanaService) GrafanaGetDashboardRequest

func (ps *GrafanaService) GrafanaGetDashboardRequest(dashboard string, uuid string, query string) (string, error)

This method returns Grafana dashboard by UUID

func (*GrafanaService) GrafanaGetFoldersdByUUUID

func (ps *GrafanaService) GrafanaGetFoldersdByUUUID(uuid string) (string, error)

This method perfroms search in Grafana for Dashboard Folder by UUID

func (*GrafanaService) GrafanaORG

func (ps *GrafanaService) GrafanaORG() (string, error)

This method returns Grafana Organisation

func (*GrafanaService) GrafanaPath

func (ps *GrafanaService) GrafanaPath() (string, error)

This method will return sub-path from config to UI

func (*GrafanaService) GrafanaStatus

func (ps *GrafanaService) GrafanaStatus() (string, error)

This method returns if Grafana is enabled in the system

func (*GrafanaService) GrafanaURL

func (ps *GrafanaService) GrafanaURL() (string, error)

This method returns Grafana Host from config

func (*GrafanaService) SetGrafanaObject

func (ps *GrafanaService) SetGrafanaObject() error

This method sets values in service based on Config

type HepsubService

type HepsubService struct {
	ServiceConfig
}

func (*HepsubService) AddHepSub

func (hs *HepsubService) AddHepSub(data model.TableHepsubSchema) (string, error)

this method gets all users from database

func (*HepsubService) DeleteHepSubAgainstGUID

func (hs *HepsubService) DeleteHepSubAgainstGUID(guid string) (string, error)

this method gets all users from database

func (*HepsubService) GetHepSub

func (hs *HepsubService) GetHepSub() (string, error)

this method gets all users from database

func (*HepsubService) GetHepSubAgainstGUID

func (hs *HepsubService) GetHepSubAgainstGUID(guid string) (string, error)

this method gets all users from database

func (*HepsubService) GetHepSubFields

func (hs *HepsubService) GetHepSubFields(id, transaction string) (string, error)

this method gets all users from database

func (*HepsubService) UpdateHepSubAgainstGUID

func (hs *HepsubService) UpdateHepSubAgainstGUID(guid string, data model.TableHepsubSchema) (string, error)

this method gets all users from database

type HepsubsearchService

type HepsubsearchService struct {
	ServiceConfig
}

func (*HepsubsearchService) DoHepSubSearch

func (hss *HepsubsearchService) DoHepSubSearch(data model.SearchObject) (string, error)

this method gets all users from database

func (*HepsubsearchService) GetAgentsub

func (hss *HepsubsearchService) GetAgentsub() (string, error)

this method gets all users from database

type LabelData

type LabelData struct {
	Name     string `json:"__name__"`
	Instance string `json:"instance"`
	Job      string `json:"job"`
	Version  string `json:"version"`
}

swagger:model LabelData

type LabelRemoteData

type LabelRemoteData struct {
	Name     string `json:"__name__"`
	Instance string `json:"instance"`
	Job      string `json:"job"`
	Version  string `json:"version"`
}

swagger:model LabelData

type MappingService

type MappingService struct {
	ServiceConfig
}

func (*MappingService) AddMapping

func (hs *MappingService) AddMapping(data model.TableMappingSchema) (string, error)

this method gets all users from database

func (*MappingService) DeleteMappingAgainstGUID

func (mps *MappingService) DeleteMappingAgainstGUID(guid string) (string, error)

this method gets all the mapping from database

func (*MappingService) GetMapping

func (mps *MappingService) GetMapping() (string, error)

this method gets all users from database

func (*MappingService) GetMappingAgainstGUID

func (mps *MappingService) GetMappingAgainstGUID(guid string) (string, error)

this method gets all the mapping from database

func (*MappingService) GetMappingFields

func (mps *MappingService) GetMappingFields(id, transaction string) (string, error)

this method gets all the mapping from database

func (*MappingService) GetSmartSuggestionAginstProfile

func (mps *MappingService) GetSmartSuggestionAginstProfile(hepid string, profile string, queryString string) (string, error)

this method gets all the mapping from database

func (*MappingService) RecreateMapping

func (mps *MappingService) RecreateMapping() error

this method gets all the mapping from database

func (*MappingService) RecreateMappingByUUID

func (mps *MappingService) RecreateMappingByUUID(guid string) error

this method gets all the mapping from database

func (*MappingService) UpdateMappingAgainstGUID

func (mps *MappingService) UpdateMappingAgainstGUID(guid string, data model.TableMappingSchema) (string, error)

type ProfileService

type ProfileService struct {
	ServiceConfig
	DatabaseNodeMap *[]model.DatabasesMap
}

func (*ProfileService) GetDBNodeList

func (ps *ProfileService) GetDBNodeList() (string, error)

this method gets all users from database

func (*ProfileService) GetDashboardList

func (ps *ProfileService) GetDashboardList() (string, error)

this method gets all users from database

func (*ProfileService) GetProfile

func (ps *ProfileService) GetProfile() (string, error)

this method gets all users from database

type PrometheusLabelData

type PrometheusLabelData struct {
	Success string       `json:"success"`
	Data    []*LabelData `json:"data"`
}

type PrometheusLabels

type PrometheusLabels struct {
	Success string   `json:"success"`
	Data    []string `json:"data"`
}

Salutation : here you tell us what Salutation is Printer : what is this? Greet : describe what this function does PrometheusLabels : describe what this function does

type PrometheusService

type PrometheusService struct {
	ServicePrometheus
}

StatisticService : here you tell us what Salutation is

func (*PrometheusService) PrometheusData

func (ps *PrometheusService) PrometheusData(prometheusObject *model.PrometheusObject) (string, error)

StatisticData: this method create new user in the database

func (*PrometheusService) PrometheusLabelData

func (ps *PrometheusService) PrometheusLabelData(label string) (string, error)

LabelsData: this method get all prometheus labels from database

func (*PrometheusService) PrometheusLabels

func (ps *PrometheusService) PrometheusLabels() (string, error)

LabelsData: this method get all prometheus labels from database

func (*PrometheusService) PrometheusValue

func (ps *PrometheusService) PrometheusValue(prometheusObject *model.PrometheusObject) (string, error)

StatisticData: this method create new user in the database

type PrometheusValuesData

type PrometheusValuesData struct {
	Success string       `json:"success"`
	Data    *queryResult `json:"data"`
}

type RemoteLabelData

type RemoteLabelData struct {
	Success string             `json:"success"`
	Data    []*LabelRemoteData `json:"data"`
}

type RemoteLabels

type RemoteLabels struct {
	Success string   `json:"success"`
	Values  []string `json:"data"`
}

Salutation : here you tell us what Salutation is Printer : what is this? Greet : describe what this function does RemoteLabels : describe what this function does

type RemoteService

type RemoteService struct {
	ServiceLoki
}

StatisticService : here you tell us what Salutation is

func (*RemoteService) RemoteData

func (ps *RemoteService) RemoteData(remoteObject *model.RemoteObject) (string, error)

StatisticData: this method create new user in the database

func (*RemoteService) RemoteLabels

func (ps *RemoteService) RemoteLabels(serverName string) (string, error)

LabelsData: this method get all Remote labels from database

func (*RemoteService) RemoteValues

func (ps *RemoteService) RemoteValues(serverName string, label string) (string, error)

LabelsData: this method get all Remote labels from database

type RemoteValuesData

type RemoteValuesData struct {
	Streams []streamsResult `json:"streams"`
}

type RemoteValuesNewData

type RemoteValuesNewData struct {
	Success string            `json:"success"`
	Data    *StreamRemoteData `json:"data"`
}

type ResultArray

type ResultArray struct {
	Name     string `json:"__name__"`
	Instance string `json:"instance"`
	Job      string `json:"job"`
}

swagger:model LabelData

type SearchService

type SearchService struct {
	ServiceData
}

search Service

func (*SearchService) GetDBNodeList

func (ss *SearchService) GetDBNodeList(searchObject *model.SearchObject) (string, error)

this method create new user in the database it doesn't check internally whether all the validation are applied or not

func (*SearchService) GetDecodedMessageByID

func (ss *SearchService) GetDecodedMessageByID(searchObject *model.SearchObject) (string, error)

this method create new user in the database it doesn't check internally whether all the validation are applied or not

func (*SearchService) GetMessageByID

func (ss *SearchService) GetMessageByID(searchObject *model.SearchObject) (string, error)

this method create new user in the database it doesn't check internally whether all the validation are applied or not

func (*SearchService) GetTransaction

func (ss *SearchService) GetTransaction(table string, data []byte, correlationJSON []byte, doexp bool,
	aliasData map[string]string, typeReport int, nodes []string, settingService *UserSettingsService,
	userGroup string, whitelist []string) (string, error)

this method create new user in the database it doesn't check internally whether all the validation are applied or not

func (*SearchService) GetTransactionData

func (ss *SearchService) GetTransactionData(table string, fieldKey string, dataWhere []interface{}, timeFrom,
	timeTo time.Time, nodes []string, userGroup string, likeSearch bool, whitelist []string) ([]model.HepTable, error)

this method create new user in the database it doesn't check internally whether all the validation are applied or not

func (*SearchService) GetTransactionLog

func (ss *SearchService) GetTransactionLog(table string, data []byte, nodes []string) (string, error)

this method create new user in the database it doesn't check internally whether all the validation are applied or not

func (*SearchService) GetTransactionQos

func (ss *SearchService) GetTransactionQos(tables [2]string, data []byte, nodes []string) (string, error)

this method create new user in the database it doesn't check internally whether all the validation are applied or not

func (*SearchService) ImportPcapData

func (ss *SearchService) ImportPcapData(buf *bytes.Buffer, now bool) (int, int, error)

this method create new user in the database it doesn't check internally whether all the validation are applied or not

func (*SearchService) SearchData

func (ss *SearchService) SearchData(searchObject *model.SearchObject, aliasData map[string]string,
	userGroup string, mapsFieldsData map[string]json.RawMessage) (string, error)

this method create new user in the database it doesn't check internally whether all the validation are applied or not

type ServiceConfig

type ServiceConfig struct {
	Session *gorm.DB
}

ServiceConfig

type ServiceData

type ServiceData struct {
	Session map[string]*gorm.DB
	Decoder ExternalDecoder
}

Service : here you tell us what Salutation is

type ServiceGrafana

type ServiceGrafana struct {
	HttpClient *http.Client
	User       string
	Token      string
	Password   string
	Host       string
	Api        string
	Active     bool
}

ServiceGrafana : here you tell us what ServiceRemote is

type ServiceInfluxDB

type ServiceInfluxDB struct {
	InfluxClient client.Client
	Active       bool
}

ServiceInfluxDB : here you tell us what ServiceInfluxDB is

type ServiceLoki

type ServiceLoki struct {
	HttpClient *http.Client
	User       string
	Password   string
	Host       string
	Api        string
	ParamQuery string
	Active     bool
}

ServiceRemote : here you tell us what ServiceRemote is

type ServicePrometheus

type ServicePrometheus struct {
	HttpClient *http.Client
	User       string
	Password   string
	Host       string
	Api        string
	Active     bool
}

ServicePrometheus : here you tell us what ServicePrometheus is

type StatisticService

type StatisticService struct {
	ServiceInfluxDB
}

StatisticService : here you tell us what Salutation is

func (*StatisticService) StatisticData

func (ss *StatisticService) StatisticData(statisticObject *model.StatisticObject) (string, error)

StatisticData: this method create new user in the database

func (*StatisticService) StatisticDataBaseList

func (ss *StatisticService) StatisticDataBaseList() (string, error)

StatisticData: this method create new user in the database

func (*StatisticService) StatisticMeasurementsList

func (ss *StatisticService) StatisticMeasurementsList(dbId string) (string, error)

StatisticData: this method create new user in the database

func (*StatisticService) StatisticMetricsList

func (ss *StatisticService) StatisticMetricsList(statisticObject *model.StatisticObject) (string, error)

StatisticData: this method create new user in the database

func (*StatisticService) StatisticRetentionsList

func (ss *StatisticService) StatisticRetentionsList(statisticObject *model.StatisticSearchObject) (string, error)

StatisticData: this method create new user in the database

func (*StatisticService) StatisticTagsList

func (ss *StatisticService) StatisticTagsList(statisticObject *model.StatisticObject) (string, error)

StatisticData: this method create new user in the database

type StreamRemoteData

type StreamRemoteData struct {
	Streams    []streamsNewResult `json:"result"`
	ResultType string             `json:"resultType"`
}

swagger:model LabelData

type UserService

type UserService struct {
	ServiceConfig
	LdapClient *ldap.LDAPClient
	HttpAuth   *httpauth.Client
}

func (*UserService) CreateNewUser

func (us *UserService) CreateNewUser(user *model.TableUser) error

this method create new user in the database it doesn't check internally whether all the validation are applied or not

func (*UserService) DeleteUser

func (us *UserService) DeleteUser(user *model.TableUser) error

this method deletes user in the database it doesn't check internally whether all the validation are applied or not

func (*UserService) GetAuthTypeList

func (us *UserService) GetAuthTypeList() ([]byte, error)

this method gets all users from database

func (*UserService) GetGroups

func (us *UserService) GetGroups() (string, error)

get all

func (*UserService) GetUser

func (us *UserService) GetUser(UserName string, isAdmin bool) ([]*model.TableUser, int, error)

this method gets all users from database

func (*UserService) GetUserByUUID

func (us *UserService) GetUserByUUID(GUID, UserName string) ([]*model.TableUser, int, error)

this method gets all users from database

func (*UserService) GetUserProfileFromToken

func (us *UserService) GetUserProfileFromToken(userTokenProfile *auth.JwtUserClaim) (string, error)

get all

func (*UserService) IsAdmin

func (us *UserService) IsAdmin(email string) (bool, error)

this method checks if a user is admin using the email address

func (*UserService) LoginUser

func (us *UserService) LoginUser(username, password string) (string, model.TableUser, error)

this method is used to login the user it doesn't check internally whether all the validation are applied or not

func (*UserService) LoginUserUsingOauthToken

func (us *UserService) LoginUserUsingOauthToken(oAuth2Object model.OAuth2MapToken) (string, model.TableUser, error)

this method is used to login the user it doesn't check internally whether all the validation are applied or not

func (*UserService) UpdateUser

func (us *UserService) UpdateUser(user *model.TableUser, UserName string, isAdmin bool) error

this method update user info in the database it doesn't check internally whether all the validation are applied or not

type UserSettingsService

type UserSettingsService struct {
	ServiceConfig
}

func (*UserSettingsService) Add

func (ss *UserSettingsService) Add(userObject *model.TableUserSettings) (string, error)

this method create new userSetting in the database it doesn't check internally whether all the validation are applied or not

func (*UserSettingsService) Delete

func (ss *UserSettingsService) Delete(userObject *model.TableUserSettings, UserName string, isAdmin bool) error

this method create new user in the database it doesn't check internally whether all the validation are applied or not

func (*UserSettingsService) Get

func (ss *UserSettingsService) Get(userObject *model.TableUserSettings, UserName string, isAdmin bool) (model.TableUserSettings, error)

this method create new user in the database it doesn't check internally whether all the validation are applied or not

func (*UserSettingsService) GetAll

func (ss *UserSettingsService) GetAll(UserName string, isAdmin bool) (string, error)

get all

func (*UserSettingsService) GetAllMapping

func (ss *UserSettingsService) GetAllMapping() (map[string]json.RawMessage, error)

get all mapping from database

func (*UserSettingsService) GetCategory

func (ss *UserSettingsService) GetCategory(UserName string, UserCategory string) (string, error)

get only for this user and category

func (*UserSettingsService) GetCorrelationMap

func (ss *UserSettingsService) GetCorrelationMap(data *model.SearchObject) ([]byte, error)

func (*UserSettingsService) GetScriptByParam

func (as *UserSettingsService) GetScriptByParam(category string, scriptName string) (string, error)

get Category by param

func (*UserSettingsService) Update

func (ss *UserSettingsService) Update(userObject *model.TableUserSettings, UserName string, isAdmin bool) error

this method create new user in the database it doesn't check internally whether all the validation are applied or not

type ValuesArray

type ValuesArray struct {
	Name     string `json:"__name__"`
	Instance string `json:"instance"`
	Job      string `json:"job"`
}

swagger:model LabelData

Jump to

Keyboard shortcuts

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