Documentation ¶
Index ¶
- Constants
- func RandStrings(n int) string
- type Builder
- func (nb *Builder) AddToEventQueue(neq *NoticeEventQueue)
- func (nb *Builder) WithFrom(from string) *Builder
- func (nb *Builder) WithLevel(Level v1.Type) *Builder
- func (nb *Builder) WithMessage(message string) *Builder
- func (nb *Builder) WithTitle(title string) *Builder
- func (nb *Builder) WithType(kind Kind) *Builder
- type Event
- type Kind
- type Manager
- type NoticeEventQueue
- type Pool
- type Receiver
Constants ¶
const (
GeneralPrefix = "ns-" // general notification prefix
)
Variables ¶
This section is empty.
Functions ¶
func RandStrings ¶
Types ¶
type Builder ¶
Builder is the struct that contains the notification information.
func (*Builder) AddToEventQueue ¶
func (nb *Builder) AddToEventQueue(neq *NoticeEventQueue)
AddToEvents adds the notification to the provided NoticeEventQueue.
func (*Builder) WithMessage ¶
type Event ¶
type Event struct { // ID is the unique ID of the notification. ID string Title string From string Message string Kind Kind Level v1.Type }
Event is the struct that contains the notification information.
func NewNotificationEvent ¶
func NewNotificationEvent(title string, message string, kind Kind, from string, level v1.Type) Event
NewNotificationEvent creates a new NotificationEvent with the provided title, message, kind, sender (from), and optional severity level.
Parameters: - title: The title of the notification. - message: The message content of the notification. - kind: The kind of the notification (e.g., General, Personal, Admin). - from: The sender of the notification. - level: The optional severity level of the notification. - target: An optional parameter specifying the intended recipient(s) of the notification. If provided, the notification will be directed towards these targets.
Return values: - A NotificationEvent struct populated with the provided values and a unique ID generated for this notification. - An error object if the provided level exceeds 1, in which case an error message "level parameter cannot exceed 1" will be returned.
The function also generates a unique ID for each NotificationEvent. If the generation of the ID fails, it uses the current Unix timestamp as the ID.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewNotificationManager ¶
type NoticeEventQueue ¶
type NoticeEventQueue struct {
Events []Event
}
NotificationPackage is the struct that contains the notification information.
type Receiver ¶
Receiver is the struct that contains the notification information.
func (*Receiver) AddReceiver ¶
func (*Receiver) AddReceivers ¶
Cache of the NamespaceCache caches the namespaces in the cluster categorized by filters.