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 CommandTarget
- type EmailTarget
- type ProviderType
- type PublicChannel
- type PublicRoute
- type PublicRouteSet
- type PublicSMTPConfig
- type PublicSMTPOAuthConfig
- type PublicSettings
- type PublicSlackTarget
- type PublicSubscription
- type PublicTarget
- type PublicTeamsTarget
- 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 TeamsTarget
- 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"`
Teams *TeamsTarget `json:"teams,omitempty"`
Command *CommandTarget `json:"command,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 CommandTarget ¶
type CommandTarget struct {
Command string `json:"command,omitempty"`
}
CommandTarget is a shell command the notification server runs locally. The command string is stored as written. It is not a secret.
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" ProviderTeams ProviderType = "teams" ProviderCommand ProviderType = "command" )
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"`
Teams *PublicTeamsTarget `json:"teams,omitempty"`
Command *CommandTarget `json:"command,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 PublicSMTPOAuthConfig ¶ added in v2.13.0
type PublicSMTPOAuthConfig struct {
Provider oauthconfig.Provider `json:"provider"`
TenantID string `json:"tenantId,omitempty"`
ClientID string `json:"clientId,omitempty"`
ClientSecretConfigured bool `json:"clientSecretConfigured"`
RefreshTokenConfigured bool `json:"refreshTokenConfigured"`
ServiceAccountJSONConfigured bool `json:"serviceAccountJsonConfigured"`
}
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"`
Teams *PublicTeamsTarget `json:"teams,omitempty"`
Command *CommandTarget `json:"command,omitempty"`
}
type PublicTeamsTarget ¶ added in v2.13.0
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"`
BodyTemplate string `json:"bodyTemplate,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 SMTPConfig struct {
Host string `json:"host,omitempty"`
Port string `json:"port,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
OAuth *oauthconfig.Config `json:"oauth,omitempty"`
From string `json:"from,omitempty"`
ClearPassword bool `json:"-"`
}
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"`
Teams *TeamsTarget `json:"teams,omitempty"`
Command *CommandTarget `json:"command,omitempty"`
}
func (Target) ToPublic ¶
func (t Target) ToPublic() PublicTarget
type TeamsTarget ¶ added in v2.13.0
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"`
BodyTemplate string `json:"bodyTemplate,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.