auth

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthTypeUsernamePassword = 1
	AuthTypeXAuthToken       = 2
	AuthTypeBearerToken      = 3
	ReadTimeout              = 5
)
View Source
const (
	STARTING     = "Starting"
	RUNNING      = "Running"
	RUNNINGWOTEL = "Running Only Alerts"
	TELNOTFOUND  = "Telemetry Service Not Found"
	CONNFAILED   = "Connection Failed"
	LEAKED       = "Leak Detected"
	MONITORING   = "Monitoring"
)

Service states

View Source
const (
	SHUTDOWNRECEIVED = "Shutdown Received"
	SHUTDOWNFAILED   = "Shutdown Failed"
	POWERSTATEON     = "Power Status On"
	POWERSTATEOFF    = "Power Status Off"
)

ServiceItem states

View Source
const (
	UNKNOWN = disc.UNKNOWN
	MSM     = disc.MSM
	EC      = disc.EC
	IDRAC   = disc.IDRAC
	IRC     = disc.IRC
	NVLINK  = disc.NVLINK
)
View Source
const (
	RESEND        = "resend"
	ADDSERVICE    = "addservice"
	DELETESERVICE = "deleteservice"
	UPDATESERVICE = "updateservice"
	GETSERVICE    = "getservice"
	UPDATELOGIN   = "updatelogin"
	TERMINATE     = "terminate"
	SPLUNKADDHEC  = "splunkaddhec"
	GETHECCONFIG  = "gethecconfig"

	GETALLSERVICES    = "getallservices"
	ADDSERVICEITEM    = "addserviceitem"
	DELETESERVICEITEM = "deleteserviceitem"
	GETSERVICEITEMS   = "getserviceitems"
	GETSERVICEITEM    = "getserviceitem"
	UPDATESERVICEITEM = "updateserviceitem"
	UPDATEVALVESTATE  = "updatevalvestate"
	GETVALVESTATE     = "getvalvestatus"
	ADDSYSTEMTYPE     = "addsystemtype"
	GETSYSTEMTYPES    = "getsystemtypes"
	GETLOGIN          = "getlogin"

	UPDATESERVICEX = "updateservicex"

	// Message type for services
	SERVICE = "service"
)
View Source
const (
	CommandQueue = "/queue/authorization/command"
	EventQueue   = "/queue/authorization"
	ReplyPrefix  = "/queue/authorization/reply."
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthClientInterface

type AuthClientInterface interface {
	AddService(service Service) error
	AddServiceItem(si ServiceItem) error
	DeleteService(service Service) error
	DeleteServiceItem(si ServiceItem) error
	GetHECConfig()
	GetAllServices() []Service
	GetService(ctx context.Context, services chan<- *Service)
	GetServiceItems(sip string) []ServiceItem
	GetServiceWithIP(ip string) Service
	GetServiceItemWithIP(siip string) ServiceItem
	ResendAll()
	SplunkAddHEC(SplunkHttp SplunkConfig) error
	UpdateServiceX(s Service) error
	UpdateService(s Service) error
	UpdateServiceItem(si ServiceItem) error
	UpdateServiceItemState(state string, siip string) error
	UpdateServiceState(state string, sip string) error
	UpdateServiceXState(state string, ip string) error
	UpdateValveState(ip string, state1 string, state2 string) error
	UpdateLogin(l Login) error
	AddSystemType(sysType string) error
	GetAllSystemTypes() []SystemType
	GetLogin() Login
}

type AuthorizationClient

type AuthorizationClient struct {
	*service.BaseClient
}

func NewAuthorizationClient

func NewAuthorizationClient(bus messagebus.Messagebus, clientName string) *AuthorizationClient

NewAuthorizationClient creates a new AuthorizationClient with the given message bus

func (*AuthorizationClient) AddService

func (ac *AuthorizationClient) AddService(service Service) error

AddService sends a fire-and-forget request to add a service

func (*AuthorizationClient) AddServiceItem

func (ac *AuthorizationClient) AddServiceItem(si ServiceItem) error

AddServiceItem sends a fire-and-forget request to add a service item

func (*AuthorizationClient) AddSystemType

func (ac *AuthorizationClient) AddSystemType(sysType string) error

AddSystemType sends a fire-and-forget request to add a system type

func (*AuthorizationClient) DeleteService

func (ac *AuthorizationClient) DeleteService(service Service) error

DeleteService sends a fire-and-forget request to delete a service

func (*AuthorizationClient) DeleteServiceItem

func (ac *AuthorizationClient) DeleteServiceItem(si ServiceItem) error

DeleteServiceItem sends a fire-and-forget request to delete a service item

func (*AuthorizationClient) GetAllServices

func (ac *AuthorizationClient) GetAllServices() []Service

GetAllServices retrieves all configured services using request/reply.

func (*AuthorizationClient) GetAllSystemTypes

func (ac *AuthorizationClient) GetAllSystemTypes() []SystemType

GetAllSystemTypes retrieves all configured system types using request/reply.

func (*AuthorizationClient) GetHECConfig

func (ac *AuthorizationClient) GetHECConfig()

GetHECConfig sends a fire-and-forget request to get HEC config

func (*AuthorizationClient) GetLogin

func (ac *AuthorizationClient) GetLogin() Login

func (*AuthorizationClient) GetService

func (ac *AuthorizationClient) GetService(ctx context.Context, services chan<- *Service)

GetService listens for Service broadcasts on EventQueue. The ctx parameter allows cancellation of the listener.

func (*AuthorizationClient) GetServiceItemWithIP

func (ac *AuthorizationClient) GetServiceItemWithIP(siip string) ServiceItem

GetServiceItemWithIP retrieves exactly one service item by IP using request/reply.

func (*AuthorizationClient) GetServiceItems

func (ac *AuthorizationClient) GetServiceItems(sip string) []ServiceItem

GetServiceItems retrieves the associated systems for a service IP using request/reply.

func (*AuthorizationClient) GetServiceWithIP

func (ac *AuthorizationClient) GetServiceWithIP(ip string) Service

GetServiceWithIP retrieves one service by IP using request/reply.

func (*AuthorizationClient) GetValveStatus

func (ac *AuthorizationClient) GetValveStatus() []ValveState

GetValveStatus retrieves the current valve status using request/reply.

func (*AuthorizationClient) ResendAll

func (ac *AuthorizationClient) ResendAll()

ResendAll sends a fire-and-forget request to resend all services

func (*AuthorizationClient) SplunkAddHEC

func (ac *AuthorizationClient) SplunkAddHEC(splunkHttp SplunkConfig) error

SplunkAddHEC sends a fire-and-forget request to add Splunk HEC config

func (*AuthorizationClient) UpdateLogin

func (ac *AuthorizationClient) UpdateLogin(l Login) error

UpdateLogin sends a fire-and-forget request to update login credentials

func (*AuthorizationClient) UpdateService

func (ac *AuthorizationClient) UpdateService(s Service) error

UpdateService sends a fire-and-forget request to update a service

func (*AuthorizationClient) UpdateServiceItem

func (ac *AuthorizationClient) UpdateServiceItem(si ServiceItem) error

UpdateServiceItem sends a fire-and-forget request to update a service item

func (*AuthorizationClient) UpdateServiceItemState

func (ac *AuthorizationClient) UpdateServiceItemState(state string, siip string) error

func (*AuthorizationClient) UpdateServiceState

func (ac *AuthorizationClient) UpdateServiceState(state string, sip string) error

func (*AuthorizationClient) UpdateServiceX

func (ac *AuthorizationClient) UpdateServiceX(s Service) error

UpdateServiceX sends a fire-and-forget request to update a service (extended)

func (*AuthorizationClient) UpdateServiceXState

func (ac *AuthorizationClient) UpdateServiceXState(state string, ip string) error

func (*AuthorizationClient) UpdateValveState

func (ac *AuthorizationClient) UpdateValveState(ip string, state1 string, state2 string) error

UpdateValveState sends a fire-and-forget request to update valve state

type AuthorizationService

type AuthorizationService struct {
	*service.BaseService
}

func NewAuthorizationService

func NewAuthorizationService(bus messagebus.Messagebus) *AuthorizationService

NewAuthorizationService creates a new AuthorizationService with the given message bus

func (*AuthorizationService) BroadcastService

func (as *AuthorizationService) BroadcastService(svc Service) error

BroadcastService broadcasts a service update to EventQueue using envelope format

type Command

type Command struct {
	Command      string       `json:"command"`
	SplunkConfig SplunkConfig `json:"Splunkconfig,omitempty"`
	Service      Service      `json:"service,omitempty"`
	ServiceItem  ServiceItem  `json:"serviceitem,omitempty"`
	ReceiveQueue string       `json:"receivequeue,omitempty"`
	SystemType   SystemType   `json:"systemtype,omitempty"`
	ValveState   ValveState   `json:"valvestate,omitempty"`
	Login        Login        `json:"login,omitempty"`
}

type Login

type Login struct {
	Username   string `json:"username"`
	Password   string `json:"password"`
	JwtVersion int    `json:"jwtVersion"`
}

type Service

type Service struct {
	ServiceType int               `json:"serviceType"`
	Ip          string            `json:"ip"`
	AuthType    int               `json:"authType"`
	Auth        map[string]string `json:"auth"`
	State       string            `json:"state"`
}

func (Service) String

func (s Service) String() string

type ServiceItem

type ServiceItem struct {
	Service
	ServiceIP          string `json:"serviceIp"`
	Systemtypedesc     string `json:"systemtypedesc"`
	IsForcefulshutdown bool   `json:"isforcefulshutdown"`
	Timeout            int    `json:"timeout"`
}

func (ServiceItem) String

func (si ServiceItem) String() string

type SplunkConfig

type SplunkConfig struct {
	Url   string `json:"url,omitempty"`
	Key   string `json:"key,omitempty"`
	Index string `json:"index,omitempty"`
}

type SystemType

type SystemType string

type ValveState

type ValveState struct {
	Ip      string `json:"ip"`
	VState1 string `json:"state1"`
	VState2 string `json:"state2"`
}

Jump to

Keyboard shortcuts

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