Documentation
¶
Index ¶
- type CampfireClient
- type CampfireRequest
- type Config
- type NotificationData
- type Notifier
- func (n *Notifier) RunDigest(ctx context.Context, pool db.PgxIface)
- func (n *Notifier) ScheduleImmediate(pool db.PgxIface, serviceID strfmt.UUID, ep *models.Endpoint)
- func (n *Notifier) SendNotification(ctx context.Context, projectID string, data NotificationData) error
- func (n *Notifier) Start(ctx context.Context) error
- func (n *Notifier) Stop() error
- type PendingGroup
- type ServiceInfo
- type Templates
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CampfireClient ¶
type CampfireClient struct {
// contains filtered or unexported fields
}
func NewCampfireClient ¶
func NewCampfireClient(url string, providerClient *gophercloud.ProviderClient) *CampfireClient
func (*CampfireClient) SendEmail ¶
func (c *CampfireClient) SendEmail(ctx context.Context, req *CampfireRequest) error
type CampfireRequest ¶
type Config ¶
type Config struct {
CampfireURL string
TemplatePath string
DigestCron string
ProviderClient *gophercloud.ProviderClient
}
type NotificationData ¶
type NotificationData struct {
Type string // "immediate" or "digest"
Services []ServiceInfo
}
func (NotificationData) TotalEndpoints ¶
func (n NotificationData) TotalEndpoints() int
type Notifier ¶
type Notifier struct {
// contains filtered or unexported fields
}
func (*Notifier) ScheduleImmediate ¶
ScheduleImmediate creates a one-shot job that sends an immediate notification for a new pending endpoint.
The job runs asynchronously after the calling HTTP handler returns. Rather than capturing the caller's request-scoped context (which net/http cancels on handler return), the task receives a job-scoped context from gocron. That context is independent of the caller's lifetime and is cancelled when the scheduler shuts down, so in-flight tasks short-circuit cleanly on shutdown. We re-attach a bounded timeout so the DB lookup and Campfire HTTP call cannot run unbounded.
The ctx parameter is intentionally unused: it exists for API symmetry with other notifier methods and to keep the call site in controller/endpoint.go natural.
func (*Notifier) SendNotification ¶
type PendingGroup ¶
type PendingGroup struct {
ProjectID string
Services []ServiceInfo
}
func QueryPendingEndpoints ¶
type Templates ¶
type Templates struct {
// contains filtered or unexported fields
}
func LoadTemplates ¶
func (*Templates) RenderBody ¶
func (t *Templates) RenderBody(data NotificationData) (string, error)
func (*Templates) RenderSubject ¶
func (t *Templates) RenderSubject(data NotificationData) (string, error)