Documentation
¶
Index ¶
- Variables
- func IsEventEnabled(settings *Settings, event eventstore.EventType) bool
- func IsRouteEventEnabled(routeSet *RouteSet, route Route, event eventstore.EventType) bool
- func IsSlackIncomingWebhookURL(value string) bool
- func IsSubscriptionEventEnabled(settings *Settings, subscription Subscription, event eventstore.EventType) bool
- func IsTargetEventEnabled(settings *Settings, target Target, event eventstore.EventType) bool
- func PreserveChannelSecrets(next, existing *Channel)
- func PreserveSecrets(next, existing *Settings)
- func PreserveWorkspaceSecrets(next, existing *WorkspaceSettings)
- func PreviewSecret(value string) string
- type Channel
- type EmailTarget
- type ProviderType
- type PublicChannel
- type PublicRoute
- type PublicRouteSet
- type PublicSMTPConfig
- type PublicSettings
- type PublicSlackTarget
- type PublicSubscription
- type PublicTarget
- type PublicTelegramTarget
- type PublicWebhookTarget
- type PublicWorkspaceSettings
- type Route
- type RouteScope
- type RouteSet
- type SMTPConfig
- type Settings
- type SlackTarget
- type Store
- type Subscription
- type Target
- type TelegramTarget
- type WebhookTarget
- type WorkspaceSettings
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrSettingsNotFound = errors.New("notification settings not found") ErrInvalidSettings = errors.New("invalid notification settings") ErrChannelNotFound = errors.New("notification channel not found") ErrChannelInUse = errors.New("notification channel is in use") ErrRouteSetNotFound = errors.New("notification route set not found") ErrTargetNotFound = errors.New("notification target not found") ErrUnsupportedEvent = errors.New("unsupported notification event") ErrUnsupportedTarget = errors.New("unsupported notification target provider") ErrSecretStoreMissing = errors.New("notification secret store is not configured") )
Functions ¶
func IsEventEnabled ¶
func IsEventEnabled(settings *Settings, event eventstore.EventType) bool
func IsRouteEventEnabled ¶
func IsRouteEventEnabled(routeSet *RouteSet, route Route, event eventstore.EventType) bool
func IsSubscriptionEventEnabled ¶
func IsSubscriptionEventEnabled(settings *Settings, subscription Subscription, event eventstore.EventType) bool
func IsTargetEventEnabled ¶
func IsTargetEventEnabled(settings *Settings, target Target, event eventstore.EventType) bool
func PreserveChannelSecrets ¶
func PreserveChannelSecrets(next, existing *Channel)
func PreserveSecrets ¶
func PreserveSecrets(next, existing *Settings)
func PreserveWorkspaceSecrets ¶
func PreserveWorkspaceSecrets(next, existing *WorkspaceSettings)
func PreviewSecret ¶
Types ¶
type Channel ¶
type Channel struct {
ID string `json:"id"`
Name string `json:"name"`
Type ProviderType `json:"type"`
Enabled bool `json:"enabled"`
Email *EmailTarget `json:"email,omitempty"`
Webhook *WebhookTarget `json:"webhook,omitempty"`
Slack *SlackTarget `json:"slack,omitempty"`
Telegram *TelegramTarget `json:"telegram,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
UpdatedBy string `json:"updatedBy,omitempty"`
}
func (Channel) ToPublic ¶
func (c Channel) ToPublic() PublicChannel
type EmailTarget ¶
type EmailTarget struct {
From string `json:"from,omitempty"`
To []string `json:"to,omitempty"`
Cc []string `json:"cc,omitempty"`
Bcc []string `json:"bcc,omitempty"`
SubjectPrefix string `json:"subjectPrefix,omitempty"`
SubjectTemplate string `json:"subjectTemplate,omitempty"`
BodyTemplate string `json:"bodyTemplate,omitempty"`
AttachLogs bool `json:"attachLogs,omitempty"`
}
type ProviderType ¶
type ProviderType string
const ( ProviderEmail ProviderType = "email" ProviderWebhook ProviderType = "webhook" ProviderSlack ProviderType = "slack" ProviderTelegram ProviderType = "telegram" )
type PublicChannel ¶
type PublicChannel struct {
ID string `json:"id"`
Name string `json:"name"`
Type ProviderType `json:"type"`
Enabled bool `json:"enabled"`
Email *EmailTarget `json:"email,omitempty"`
Webhook *PublicWebhookTarget `json:"webhook,omitempty"`
Slack *PublicSlackTarget `json:"slack,omitempty"`
Telegram *PublicTelegramTarget `json:"telegram,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
UpdatedBy string `json:"updatedBy,omitempty"`
}
type PublicRoute ¶
type PublicRouteSet ¶
type PublicRouteSet struct {
ID string `json:"id"`
Scope RouteScope `json:"scope"`
Workspace string `json:"workspace,omitempty"`
Enabled bool `json:"enabled"`
InheritGlobal bool `json:"inheritGlobal"`
Routes []PublicRoute `json:"routes"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
UpdatedBy string `json:"updatedBy,omitempty"`
}
type PublicSMTPConfig ¶
type PublicSettings ¶
type PublicSettings struct {
ID string `json:"id"`
DAGName string `json:"dagName"`
Enabled bool `json:"enabled"`
Events []string `json:"events"`
Targets []PublicTarget `json:"targets"`
Subscriptions []PublicSubscription `json:"subscriptions,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
UpdatedBy string `json:"updatedBy,omitempty"`
}
func ToPublic ¶
func ToPublic(settings *Settings) *PublicSettings
type PublicSlackTarget ¶
type PublicSubscription ¶
type PublicTarget ¶
type PublicTarget struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Type ProviderType `json:"type"`
Enabled bool `json:"enabled"`
Events []string `json:"events,omitempty"`
Email *EmailTarget `json:"email,omitempty"`
Webhook *PublicWebhookTarget `json:"webhook,omitempty"`
Slack *PublicSlackTarget `json:"slack,omitempty"`
Telegram *PublicTelegramTarget `json:"telegram,omitempty"`
}
type PublicTelegramTarget ¶
type PublicWebhookTarget ¶
type PublicWebhookTarget struct {
URLConfigured bool `json:"urlConfigured"`
URLPreview string `json:"urlPreview,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
HMACSecretConfigured bool `json:"hmacSecretConfigured"`
MessageTemplate string `json:"messageTemplate,omitempty"`
AllowInsecureHTTP bool `json:"allowInsecureHttp"`
AllowPrivateNetwork bool `json:"allowPrivateNetwork"`
}
type PublicWorkspaceSettings ¶
type Route ¶
type Route struct {
ID string `json:"id"`
ChannelID string `json:"channelId"`
Enabled bool `json:"enabled"`
Events []eventstore.EventType `json:"events,omitempty"`
}
func (Route) ToPublic ¶
func (r Route) ToPublic() PublicRoute
type RouteScope ¶
type RouteScope string
const ( RouteScopeGlobal RouteScope = "global" RouteScopeWorkspace RouteScope = "workspace" )
type RouteSet ¶
type RouteSet struct {
ID string `json:"id"`
Scope RouteScope `json:"scope"`
Workspace string `json:"workspace,omitempty"`
Enabled bool `json:"enabled"`
InheritGlobal bool `json:"inheritGlobal"`
Routes []Route `json:"routes"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
UpdatedBy string `json:"updatedBy,omitempty"`
}
func NormalizeRouteSet ¶
func (RouteSet) ToPublic ¶
func (s RouteSet) ToPublic() PublicRouteSet
type SMTPConfig ¶
type Settings ¶
type Settings struct {
ID string `json:"id"`
DAGName string `json:"dagName"`
Enabled bool `json:"enabled"`
Events []eventstore.EventType `json:"events"`
Targets []Target `json:"targets"`
Subscriptions []Subscription `json:"subscriptions,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
UpdatedBy string `json:"updatedBy,omitempty"`
}
func NewSettings ¶
type SlackTarget ¶
type Store ¶
type Store interface {
Save(ctx context.Context, settings *Settings) error
GetByDAGName(ctx context.Context, dagName string) (*Settings, error)
List(ctx context.Context) ([]*Settings, error)
DeleteByDAGName(ctx context.Context, dagName string) error
SaveWorkspaceSettings(ctx context.Context, settings *WorkspaceSettings) error
GetWorkspaceSettings(ctx context.Context) (*WorkspaceSettings, error)
SaveRouteSet(ctx context.Context, routeSet *RouteSet) error
GetRouteSet(ctx context.Context, scope RouteScope, workspace string) (*RouteSet, error)
ListRouteSets(ctx context.Context) ([]*RouteSet, error)
DeleteRouteSet(ctx context.Context, scope RouteScope, workspace string) error
SaveChannel(ctx context.Context, channel *Channel) error
GetChannel(ctx context.Context, channelID string) (*Channel, error)
ListChannels(ctx context.Context) ([]*Channel, error)
DeleteChannel(ctx context.Context, channelID string) error
}
type Subscription ¶
type Subscription struct {
ID string `json:"id"`
ChannelID string `json:"channelId"`
Enabled bool `json:"enabled"`
Events []eventstore.EventType `json:"events,omitempty"`
}
func (Subscription) ToPublic ¶
func (s Subscription) ToPublic() PublicSubscription
type Target ¶
type Target struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Type ProviderType `json:"type"`
Enabled bool `json:"enabled"`
Events []eventstore.EventType `json:"events,omitempty"`
Email *EmailTarget `json:"email,omitempty"`
Webhook *WebhookTarget `json:"webhook,omitempty"`
Slack *SlackTarget `json:"slack,omitempty"`
Telegram *TelegramTarget `json:"telegram,omitempty"`
}
func (Target) ToPublic ¶
func (t Target) ToPublic() PublicTarget
type TelegramTarget ¶
type WebhookTarget ¶
type WebhookTarget struct {
URL string `json:"url,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
HMACSecret string `json:"hmacSecret,omitempty"`
MessageTemplate string `json:"messageTemplate,omitempty"`
AllowInsecureHTTP bool `json:"allowInsecureHttp,omitempty"`
AllowPrivateNetwork bool `json:"allowPrivateNetwork,omitempty"`
ClearHeaders bool `json:"-"`
ClearHMACSecret bool `json:"-"`
}
type WorkspaceSettings ¶
type WorkspaceSettings struct {
SMTP *SMTPConfig `json:"smtp,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
UpdatedBy string `json:"updatedBy,omitempty"`
}
func NormalizeWorkspaceSettings ¶
func NormalizeWorkspaceSettings(settings *WorkspaceSettings, updatedBy string) (*WorkspaceSettings, error)
func (WorkspaceSettings) ToPublic ¶
func (s WorkspaceSettings) ToPublic() PublicWorkspaceSettings
Click to show internal directories.
Click to hide internal directories.