Documentation ¶
Overview ¶
Package Notifications provides a client to communicate with the OpenSight Notification Service github.com/greenbone/opensight-notification-service
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client can be used to send notifications
func NewClient ¶
NewClient returns a new Client with the notification service address (host:port) set. As httpClient you can use e.g. http.DefaultClient.
func (*Client) CreateNotification ¶
func (c *Client) CreateNotification(ctx context.Context, notification Notification) error
CreateNotification sends a notification to the notification service. The request is retried up to the configured number of retries with an exponential backoff. So it can take some time until the functions returns.
type Config ¶
type Config struct { Address string MaxRetries int RetryWaitMin time.Duration RetryWaitMax time.Duration }
Config configures the notification service client
type Notification ¶
type Notification struct { // omit property `Id` here, as it is read only Origin string OriginUri string // can be used to provide a link to the origin Timestamp time.Time Title string // can also be seen as the 'type' Detail string Level Level CustomFields map[string]any // can contain arbitrary structured information about the notification }
Click to show internal directories.
Click to hide internal directories.