-
Notifications
You must be signed in to change notification settings - Fork 126
/
tenant_alerting.go
57 lines (38 loc) · 1.71 KB
/
tenant_alerting.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package repository
import (
"context"
"time"
"github.com/hatchet-dev/hatchet/internal/repository/prisma/db"
"github.com/hatchet-dev/hatchet/internal/repository/prisma/dbsqlc"
)
type UpsertTenantAlertingSettingsOpts struct {
MaxFrequency *string `validate:"omitnil,duration"`
}
type UpdateTenantAlertingSettingsOpts struct {
LastAlertedAt *time.Time
}
type CreateTenantAlertGroupOpts struct {
Emails []string `validate:"required,dive,email,max=255"`
}
type UpdateTenantAlertGroupOpts struct {
Emails []string `validate:"required,dive,email,max=255"`
}
type TenantAlertingAPIRepository interface {
UpsertTenantAlertingSettings(tenantId string, opts *UpsertTenantAlertingSettingsOpts) (*db.TenantAlertingSettingsModel, error)
GetTenantAlertingSettings(tenantId string) (*db.TenantAlertingSettingsModel, error)
CreateTenantAlertGroup(tenantId string, opts *CreateTenantAlertGroupOpts) (*db.TenantAlertEmailGroupModel, error)
UpdateTenantAlertGroup(id string, opts *UpdateTenantAlertGroupOpts) (*db.TenantAlertEmailGroupModel, error)
ListTenantAlertGroups(tenantId string) ([]db.TenantAlertEmailGroupModel, error)
GetTenantAlertGroupById(id string) (*db.TenantAlertEmailGroupModel, error)
DeleteTenantAlertGroup(tenantId string, id string) error
}
type GetTenantAlertingSettingsResponse struct {
Settings *dbsqlc.TenantAlertingSettings
SlackWebhooks []*dbsqlc.SlackAppWebhook
EmailGroups []*dbsqlc.TenantAlertEmailGroup
Tenant *dbsqlc.Tenant
}
type TenantAlertingEngineRepository interface {
GetTenantAlertingSettings(ctx context.Context, tenantId string) (*GetTenantAlertingSettingsResponse, error)
UpdateTenantAlertingSettings(ctx context.Context, tenantId string, opts *UpdateTenantAlertingSettingsOpts) error
}