common

package
v1.4.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOnCallProvider added in v1.3.0

func CreateOnCallProvider(cfg *config.Config, awsClient *ssmincidents.Client) (core.OnCallProvider, error)

CreateOnCallProvider is a helper function that creates an on-call provider This is used by the core package to create providers without directly importing the implementation details

func LoginAuth added in v1.1.3

func LoginAuth(username, password string) smtp.Auth

func NewAzBusListener

func NewAzBusListener() (core.QueueListener, error)

func NewPubSubListener

func NewPubSubListener() (core.QueueListener, error)

Types

type AlertProviderFactory added in v1.3.0

type AlertProviderFactory struct {
	// contains filtered or unexported fields
}

Alert Provider

func NewAlertProviderFactory added in v1.3.0

func NewAlertProviderFactory(cfg *config.Config) *AlertProviderFactory

func (*AlertProviderFactory) CreateProviders added in v1.3.0

func (f *AlertProviderFactory) CreateProviders() ([]core.AlertProvider, error)

type AwsIncidentManagerProvider added in v1.3.0

type AwsIncidentManagerProvider struct {
	// contains filtered or unexported fields
}

AwsIncidentManagerProvider implements the OnCallProvider interface for AWS Incident Manager

func NewAwsIncidentManagerProvider added in v1.3.0

func NewAwsIncidentManagerProvider(client *ssmincidents.Client, responsePlanArn string) *AwsIncidentManagerProvider

NewAwsIncidentManagerProvider creates a new AWS Incident Manager provider

func (*AwsIncidentManagerProvider) TriggerOnCall added in v1.3.0

func (p *AwsIncidentManagerProvider) TriggerOnCall(ctx context.Context, incidentID string, cfg *config.OnCallConfig) error

TriggerOnCall creates an incident in AWS Incident Manager

type AzBusListener

type AzBusListener struct{}

func (*AzBusListener) StartListening

func (l *AzBusListener) StartListening(handler func(content map[string]interface{}) error) error

type EmailProvider

type EmailProvider struct {
	// contains filtered or unexported fields
}

func NewEmailProvider

func NewEmailProvider(cfg config.EmailConfig) *EmailProvider

func (*EmailProvider) Name added in v1.4.0

func (e *EmailProvider) Name() string

Name implements core.AlertProvider.

func (*EmailProvider) SendAlert

func (e *EmailProvider) SendAlert(i *m.Incident) error

func (*EmailProvider) SendAttachment added in v1.4.8

func (e *EmailProvider) SendAttachment(i *m.Incident, att core.Attachment) error

SendAttachment implements core.AttachmentSender: it emails the report as a multipart/related MIME message with the PNG inline (referenced by a Content-ID) and the redacted caption as the text body.

type IncidentioAlertEvent added in v1.4.4

type IncidentioAlertEvent struct {
	Title            string            `json:"title"`
	Description      string            `json:"description,omitempty"`
	DeduplicationKey string            `json:"deduplication_key"`
	Status           string            `json:"status"`
	Metadata         map[string]string `json:"metadata,omitempty"`
}

IncidentioAlertEvent is the JSON payload posted to the incident.io HTTP alert events endpoint.

type IncidentioProvider added in v1.4.4

type IncidentioProvider struct {
	// contains filtered or unexported fields
}

IncidentioProvider implements the OnCallProvider interface for incident.io.

func NewIncidentioProvider added in v1.4.4

func NewIncidentioProvider(apiKey, alertSourceConfigID string) *IncidentioProvider

NewIncidentioProvider creates a new incident.io provider.

func (*IncidentioProvider) TriggerOnCall added in v1.4.4

func (p *IncidentioProvider) TriggerOnCall(ctx context.Context, incidentID string, cfg *config.OnCallConfig) error

TriggerOnCall creates an alert in incident.io using the HTTP alert events API.

type LarkProvider added in v1.3.1

type LarkProvider struct {
	// contains filtered or unexported fields
}

func NewLarkProvider added in v1.3.1

func NewLarkProvider(cfg config.LarkConfig, proxyConfig config.ProxyConfig) *LarkProvider

func (*LarkProvider) Name added in v1.4.0

func (l *LarkProvider) Name() string

Name implements core.AlertProvider.

func (*LarkProvider) SendAlert added in v1.3.1

func (l *LarkProvider) SendAlert(i *m.Incident) error

func (*LarkProvider) SendText added in v1.4.8

func (l *LarkProvider) SendText(i *m.Incident, text string) error

SendText implements core.TextSender: the image-fallback path for Lark, which cannot upload a binary over a custom-bot webhook. It posts the already-redacted report caption + note as an interactive text card. No raw incident content is referenced.

type ListenerFactory

type ListenerFactory struct {
	// contains filtered or unexported fields
}

Listener Factory

func NewListenerFactory

func NewListenerFactory(cfg *config.Config) *ListenerFactory

func (*ListenerFactory) CreateListeners

func (f *ListenerFactory) CreateListeners() ([]core.QueueListener, error)

type MSTeamsProvider

type MSTeamsProvider struct {
	// contains filtered or unexported fields
}

func NewMSTeamsProvider

func NewMSTeamsProvider(cfg config.MSTeamsConfig) *MSTeamsProvider

func (*MSTeamsProvider) Name added in v1.4.0

func (m *MSTeamsProvider) Name() string

Name implements core.AlertProvider.

func (*MSTeamsProvider) SendAlert

func (m *MSTeamsProvider) SendAlert(i *m.Incident) error

func (*MSTeamsProvider) SendText added in v1.4.8

func (m *MSTeamsProvider) SendText(i *m.Incident, text string) error

SendText implements core.TextSender: the image-fallback path for Teams, which cannot upload a binary over its Power Automate webhook. It posts the already-redacted text (report caption + note) as a Teams message. The incident carrier has no raw content, so nothing unredacted is passed through ConvertToTeamsPayload.

type OnCallProviderFactory added in v1.3.0

type OnCallProviderFactory struct {
	// contains filtered or unexported fields
}

OnCall Provider

func NewOnCallProviderFactory added in v1.3.0

func NewOnCallProviderFactory(cfg *config.Config, awsClient *ssmincidents.Client) *OnCallProviderFactory

func (*OnCallProviderFactory) CreateProvider added in v1.3.0

func (f *OnCallProviderFactory) CreateProvider() (core.OnCallProvider, error)

type PagerDutyEvent added in v1.3.0

type PagerDutyEvent struct {
	RoutingKey  string                `json:"routing_key"`
	EventAction string                `json:"event_action"`
	Payload     PagerDutyEventPayload `json:"payload"`
}

PagerDuty API v2 payload structures

type PagerDutyEventPayload added in v1.3.0

type PagerDutyEventPayload struct {
	Summary       string            `json:"summary"`
	Source        string            `json:"source"`
	Severity      string            `json:"severity"`
	CustomDetails map[string]string `json:"custom_details,omitempty"`
}

type PagerDutyProvider added in v1.3.0

type PagerDutyProvider struct {
	// contains filtered or unexported fields
}

PagerDutyProvider implements the OnCallProvider interface for PagerDuty

func NewPagerDutyProvider added in v1.3.0

func NewPagerDutyProvider(routingKey string) *PagerDutyProvider

NewPagerDutyProvider creates a new PagerDuty provider

func (*PagerDutyProvider) TriggerOnCall added in v1.3.0

func (p *PagerDutyProvider) TriggerOnCall(ctx context.Context, incidentID string, cfg *config.OnCallConfig) error

TriggerOnCall creates an incident in PagerDuty using Events API v2

type PubSubListener

type PubSubListener struct{}

func (*PubSubListener) StartListening

func (l *PubSubListener) StartListening(handler func(content map[string]interface{}) error) error

type SNSListener

type SNSListener struct {
	// contains filtered or unexported fields
}

func NewSNSListener

func NewSNSListener(cfg c.SNSConfig, endpointURL string, autoCreateSubscription bool) *SNSListener

func (*SNSListener) StartListening

func (l *SNSListener) StartListening(handler func(content *map[string]interface{}) error) error

type SQSListener

type SQSListener struct {
	QueueURL string
}

func NewSQSListener

func NewSQSListener(cfg config.SQSConfig) *SQSListener

func (*SQSListener) StartListening

func (s *SQSListener) StartListening(handler func(content *map[string]interface{}) error) error

type ServiceNowProvider added in v1.4.4

type ServiceNowProvider struct {
	// contains filtered or unexported fields
}

ServiceNowProvider implements the OnCallProvider interface for ServiceNow.

func NewServiceNowProvider added in v1.4.4

func NewServiceNowProvider(instanceURL, username, password, table string) *ServiceNowProvider

NewServiceNowProvider creates a new ServiceNow provider. An empty table defaults to "incident".

func (*ServiceNowProvider) TriggerOnCall added in v1.4.4

func (p *ServiceNowProvider) TriggerOnCall(ctx context.Context, incidentID string, cfg *config.OnCallConfig) error

TriggerOnCall creates a record in ServiceNow using the Table API.

type ServiceNowRecord added in v1.4.4

type ServiceNowRecord struct {
	ShortDescription string `json:"short_description"`
	CorrelationID    string `json:"correlation_id"`
}

ServiceNowRecord is the JSON payload posted to the ServiceNow Table API. incidentID is mapped onto both the human-readable short_description and the correlation_id used by ServiceNow to de-duplicate inbound events.

type SlackProvider

type SlackProvider struct {
	// contains filtered or unexported fields
}

func NewSlackProvider

func NewSlackProvider(cfg config.SlackConfig) *SlackProvider

func (*SlackProvider) Name added in v1.4.0

func (s *SlackProvider) Name() string

Name implements core.AlertProvider.

func (*SlackProvider) SendAlert

func (s *SlackProvider) SendAlert(i *m.Incident) error

SendAlert determines whether to process a resolved or unresolved incident

func (*SlackProvider) SendAttachment added in v1.4.8

func (s *SlackProvider) SendAttachment(i *m.Incident, att core.Attachment) error

SendAttachment implements core.AttachmentSender: it uploads the report PNG to the configured channel with the caption as the message. It uses the slack-go three-step external-upload flow (files.getUploadURLExternal → upload → files.completeUploadExternal), which is the modern replacement for the retired files.upload endpoint.

type TelegramMessage

type TelegramMessage struct {
	ChatID    string `json:"chat_id"`
	Text      string `json:"text"`
	ParseMode string `json:"parse_mode"`
}

type TelegramProvider

type TelegramProvider struct {
	// contains filtered or unexported fields
}

func NewTelegramProvider

func NewTelegramProvider(cfg config.TelegramConfig, proxyConfig config.ProxyConfig) *TelegramProvider

func (*TelegramProvider) Name added in v1.4.0

func (t *TelegramProvider) Name() string

Name implements core.AlertProvider.

func (*TelegramProvider) SendAlert

func (t *TelegramProvider) SendAlert(i *m.Incident) error

func (*TelegramProvider) SendAttachment added in v1.4.8

func (t *TelegramProvider) SendAttachment(i *m.Incident, att core.Attachment) error

SendAttachment implements core.AttachmentSender: it uploads the report PNG via the Bot API sendPhoto multipart endpoint with the caption.

type ViberBotMessage added in v1.3.7

type ViberBotMessage struct {
	Receiver string                 `json:"receiver"`
	Type     string                 `json:"type"`
	Text     string                 `json:"text"`
	Sender   map[string]interface{} `json:"sender"`
}

ViberBotMessage represents a message for Viber Bot API

type ViberChannelMessage added in v1.3.7

type ViberChannelMessage struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

ViberChannelMessage represents a message for Viber Channels Post API

type ViberProvider added in v1.3.7

type ViberProvider struct {
	// contains filtered or unexported fields
}

func NewViberProvider added in v1.3.7

func NewViberProvider(cfg config.ViberConfig, proxyConfig config.ProxyConfig) *ViberProvider

func (*ViberProvider) Name added in v1.4.0

func (v *ViberProvider) Name() string

Name implements core.AlertProvider.

func (*ViberProvider) SendAlert added in v1.3.7

func (v *ViberProvider) SendAlert(i *m.Incident) error

func (*ViberProvider) SendText added in v1.4.8

func (v *ViberProvider) SendText(i *m.Incident, text string) error

SendText implements core.TextSender: the image-fallback path for Viber, which posts the already-redacted report caption + note as a text message through the configured (bot or channel) API. No raw incident content is referenced.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL