Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶ added in v0.13.0
type Action struct {
Channel ChannelReference `json:"channel" validate:"required"`
Recipient string `json:"recipient,omitempty"` // specific recipient if supported/required by the channel, e.g. for mail a comma separated list of mail adresses
}
Action determines to which channel the event is forwarded. Some channels (e.g. mail) require the explicit recipient(s).
type ChannelReference ¶ added in v0.13.0
type ChannelType ¶ added in v0.12.0
type ChannelType string
const ( ChannelTypeMail ChannelType = "mail" ChannelTypeMattermost ChannelType = "mattermost" ChannelTypeTeams ChannelType = "teams" )
type Notification ¶
type Notification struct {
Id string `json:"id" readonly:"true"`
Origin string `json:"origin" binding:"required"` // name of the origin, e.g. `SBOM - React`
OriginClass string `json:"originClass"` // unique identifier for the class of origins, e.g. `/vi/SBOM`, for now optional for backwards compatibility, will be required in future
OriginResourceID string `json:"originResourceID,omitempty"` // together with class it can be used to provide a link to the origin, e.g. `<id of react sbom object>`
Timestamp string `json:"timestamp" binding:"required" format:"date-time"`
Title string `json:"title" binding:"required"`
Detail string `json:"detail" binding:"required"`
Level string `json:"level" binding:"required" enums:"info,warning,error,urgent"`
CustomFields map[string]any `json:"customFields,omitempty"` // can contain arbitrary structured information about the event
}
Notification is sent by a backend service. It will always be stored by the notification service and it will possibly also trigger actions like sending mails, depending on the cofigured rules.
type NotificationChannel ¶ added in v0.12.0
type NotificationChannel struct {
Id *string `json:"id" readonly:"true"`
CreatedAt string `json:"createdAt" readonly:"true"`
UpdatedAt *string `json:"updatedAt,omitempty"`
ChannelType string `json:"channelType" binding:"required"`
ChannelName *string `json:"channelName,omitempty"`
WebhookUrl *string `json:"webhookUrl,omitempty"`
Description *string `json:"description,omitempty"`
Domain *string `json:"domain,omitempty"`
Port *int `json:"port,omitempty"`
IsAuthenticationRequired *bool `json:"isAuthenticationRequired,omitempty"`
IsTlsEnforced *bool `json:"isTlsEnforced,omitempty"`
Username *string `json:"username,omitempty"`
Password *string `json:"password,omitempty"`
MaxEmailAttachmentSizeMb *int `json:"maxEmailAttachmentSizeMb,omitempty"`
MaxEmailIncludeSizeMb *int `json:"maxEmailIncludeSizeMb,omitempty"`
SenderEmailAddress *string `json:"senderEmailAddress,omitempty"`
}
type Origin ¶ added in v0.12.0
type Origin struct {
Name string `json:"name" validate:"required"` // human readable name representation
Class string `json:"class" validate:"required"` // unique identifier
ServiceID string `json:"serviceID" readonly:"true"` // service in which this origin is defined
}
Origin of an event/notification.
type OriginList ¶ added in v0.12.0
type OriginList []Origin
func (OriginList) Validate ¶ added in v0.12.0
func (o OriginList) Validate() ValidationErrors
type OriginReference ¶ added in v0.13.0
type Rule ¶ added in v0.13.0
type Rule struct {
ID string `json:"id" readonly:"true"`
Name string `json:"name" validate:"required"`
Trigger Trigger `json:"trigger" validate:"required"`
Action Action `json:"action" validate:"required"`
Active bool `json:"active"`
Errors ValidationErrors `json:"errors,omitempty" readonly:"true"` // populated if the rule is invalid, this can be useful to highlight rules which need action from the user.
}
A rule determines which events cause which action. Each incoming event is matched with the trigger conditions. If the condition is fulfilled, the provided action is triggered.
func (*Rule) Validate ¶ added in v0.13.0
func (r *Rule) Validate() ValidationErrors
Validate checks if the rule is valid and returns validation errors if not. Furthermore it populates the `Errors` field with these validation errors.
type Trigger ¶ added in v0.13.0
type Trigger struct {
Origins []OriginReference `json:"origins" validate:"required"`
Levels []string `json:"levels" validate:"required"`
}
Trigger condition, fulfilled if both one of `origins` and `levels` match the ones from the incoming event.
type ValidationErrors ¶ added in v0.12.0
func (ValidationErrors) Error ¶ added in v0.12.0
func (v ValidationErrors) Error() string