notification

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type        EventType         `json:"type"`
	Project     string            `json:"project"`
	Environment string            `json:"environment"`
	Service     string            `json:"service,omitempty"`
	Message     string            `json:"message"`
	Details     map[string]string `json:"details,omitempty"`
	Timestamp   time.Time         `json:"timestamp"`
	Duration    time.Duration     `json:"duration,omitempty"`
	Error       string            `json:"error,omitempty"`
}

Event represents a notification event

func ContainerCrashLoopEvent

func ContainerCrashLoopEvent(project, env, service string, restartCount int, lastError string) Event

ContainerCrashLoopEvent creates a crash loop event

func ContainerOOMEvent

func ContainerOOMEvent(project, env, service string, containerID string) Event

ContainerOOMEvent creates an out of memory event

func DeployFailedEvent

func DeployFailedEvent(project, env, service string, err error) Event

DeployFailedEvent creates a deploy failed event

func DeployStartedEvent

func DeployStartedEvent(project, env, service string) Event

DeployStartedEvent creates a deploy started event

func DeploySucceededEvent

func DeploySucceededEvent(project, env, service string, duration time.Duration) Event

DeploySucceededEvent creates a deploy succeeded event

func DriftDetectedEvent

func DriftDetectedEvent(project, env, service, description string) Event

DriftDetectedEvent creates a drift detected event

func HealthCheckFailedEvent

func HealthCheckFailedEvent(project, env, service string, endpoint string, statusCode int, err error) Event

HealthCheckFailedEvent creates a health check failure event

func HealthCheckRecoveredEvent

func HealthCheckRecoveredEvent(project, env, service string, endpoint string, downtime time.Duration) Event

HealthCheckRecoveredEvent creates a health check recovery event

func HighCPUEvent

func HighCPUEvent(project, env, service string, cpuPercent float64, threshold float64) Event

HighCPUEvent creates a high CPU usage alert event

func HighDiskEvent

func HighDiskEvent(project, env string, diskPercent float64, threshold float64, usedGB, totalGB int64) Event

HighDiskEvent creates a high disk usage alert event

func HighMemoryEvent

func HighMemoryEvent(project, env, service string, memPercent float64, threshold float64, usedMB, totalMB int64) Event

HighMemoryEvent creates a high memory usage alert event

func SSLExpiringSoonEvent

func SSLExpiringSoonEvent(project, env string, domain string, expiresAt time.Time, daysUntilExpiry int) Event

SSLExpiringSoonEvent creates an SSL expiring soon event

func SSLFailedEvent added in v0.1.3

func SSLFailedEvent(project, env string, domain string, err error) Event

SSLFailedEvent creates an SSL certificate failed event

func SSLIssuedEvent added in v0.1.3

func SSLIssuedEvent(project, env string, domain string, waitTime time.Duration) Event

SSLIssuedEvent creates an SSL certificate issued event

func SSLPendingEvent added in v0.1.3

func SSLPendingEvent(project, env string, domain string, cnameTarget string) Event

SSLPendingEvent creates an SSL certificate pending event

func ScaleEvent

func ScaleEvent(project, env, service string, fromReplicas, toReplicas int) Event

ScaleEvent creates a scale up/down event

func ServiceDownEvent

func ServiceDownEvent(project, env, service string, err error) Event

ServiceDownEvent creates a service down event

func ServiceUpEvent

func ServiceUpEvent(project, env, service string, downtime time.Duration) Event

ServiceUpEvent creates a service up/recovered event

type EventType

type EventType string

EventType represents the type of deployment event

const (
	EventDeployStarted    EventType = "deploy_started"
	EventDeploySucceeded  EventType = "deploy_succeeded"
	EventDeployFailed     EventType = "deploy_failed"
	EventRollbackStarted  EventType = "rollback_started"
	EventRollbackDone     EventType = "rollback_done"
	EventServiceDown      EventType = "service_down"
	EventServiceUp        EventType = "service_up"
	EventServiceRestarted EventType = "service_restarted"
	EventDriftDetected    EventType = "drift_detected"
	EventBackupCompleted  EventType = "backup_completed"
	EventBackupFailed     EventType = "backup_failed"
	// Resource alerts
	EventHighCPU        EventType = "high_cpu"
	EventHighMemory     EventType = "high_memory"
	EventHighDisk       EventType = "high_disk"
	EventResourceNormal EventType = "resource_normal"
	// Health alerts
	EventHealthCheckFailed    EventType = "health_check_failed"
	EventHealthCheckRecovered EventType = "health_check_recovered"
	EventContainerOOM         EventType = "container_oom"
	EventContainerCrashLoop   EventType = "container_crash_loop"
	// SSL alerts
	EventSSLExpiringSoon EventType = "ssl_expiring_soon"
	EventSSLExpired      EventType = "ssl_expired"
	EventSSLRenewed      EventType = "ssl_renewed"
	EventSSLPending      EventType = "ssl_pending"
	EventSSLIssued       EventType = "ssl_issued"
	EventSSLFailed       EventType = "ssl_failed"
	// Scaling events
	EventScaleUp   EventType = "scale_up"
	EventScaleDown EventType = "scale_down"
)

type Notifier

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

Notifier handles sending notifications

func NewNotifier

func NewNotifier(config NotifierConfig, verbose bool) *Notifier

NewNotifier creates a new notifier

func (*Notifier) Notify

func (n *Notifier) Notify(event Event) error

Notify sends a notification to all configured channels

type NotifierConfig

type NotifierConfig struct {
	SlackWebhook   string `yaml:"slackWebhook,omitempty"`
	DiscordWebhook string `yaml:"discordWebhook,omitempty"`
	Webhook        string `yaml:"webhook,omitempty"` // Generic webhook
	Email          string `yaml:"email,omitempty"`   // Future: email notifications
}

NotifierConfig holds configuration for notifications

Jump to

Keyboard shortcuts

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