summaryrefslogtreecommitdiffstats
path: root/pkg/icingadb/v1/history/notification.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/icingadb/v1/history/notification.go')
-rw-r--r--pkg/icingadb/v1/history/notification.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/pkg/icingadb/v1/history/notification.go b/pkg/icingadb/v1/history/notification.go
new file mode 100644
index 0000000..17fd375
--- /dev/null
+++ b/pkg/icingadb/v1/history/notification.go
@@ -0,0 +1,50 @@
+package history
+
+import (
+ "github.com/icinga/icingadb/pkg/contracts"
+ v1 "github.com/icinga/icingadb/pkg/icingadb/v1"
+ "github.com/icinga/icingadb/pkg/types"
+)
+
+type NotificationHistory struct {
+ HistoryTableEntity `json:",inline"`
+ HistoryTableMeta `json:",inline"`
+ NotificationId types.Binary `json:"notification_id"`
+ Type types.NotificationType `json:"type"`
+ SendTime types.UnixMilli `json:"send_time"`
+ State uint8 `json:"state"`
+ PreviousHardState uint8 `json:"previous_hard_state"`
+ Author string `json:"author"`
+ Text types.String `json:"text"`
+ UsersNotified uint16 `json:"users_notified"`
+}
+
+type UserNotificationHistory struct {
+ v1.EntityWithoutChecksum `json:",inline"`
+ v1.EnvironmentMeta `json:",inline"`
+ NotificationHistoryId types.Binary `json:"notification_history_id"`
+ UserId types.Binary `json:"user_id"`
+}
+
+func (u *UserNotificationHistory) Upsert() interface{} {
+ return u
+}
+
+type HistoryNotification struct {
+ HistoryMeta `json:",inline"`
+ NotificationHistoryId types.Binary `json:"id"`
+ EventTime types.UnixMilli `json:"send_time"`
+}
+
+// TableName implements the contracts.TableNamer interface.
+func (*HistoryNotification) TableName() string {
+ return "history"
+}
+
+// Assert interface compliance.
+var (
+ _ UpserterEntity = (*NotificationHistory)(nil)
+ _ UpserterEntity = (*UserNotificationHistory)(nil)
+ _ contracts.TableNamer = (*HistoryNotification)(nil)
+ _ UpserterEntity = (*HistoryNotification)(nil)
+)