Documentation
¶
Index ¶
Constants ¶
const ( // PartnershipRequestEventType fires when a partner organization receives a request to establish a partnership. PartnershipRequestEventType = "partnership-request" // PartnershipResponseEventType fires when a partner organization responds to a partnership request. PartnershipResponseEventType = "partnership-response" AssessmentSharedEventType = "assessment-shared" // AssessmentCreatedEventType fires when a new assessment is created on behalf of a customer by a partner organization. AssessmentCreatedEventType = "assessment-created" )
const (
SeverityImportant = "IMPORTANT"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HTTPWriter ¶
type HTTPWriter struct {
// contains filtered or unexported fields
}
HTTPWriter sends notification payloads to the notification service over an mTLS-authenticated HTTPS connection.
func NewHTTPWriter ¶
func NewHTTPWriter(notificationURL string, certPEM, keyPEM []byte) (*HTTPWriter, error)
NewHTTPWriter builds an HTTPWriter that authenticates with the notification service using the given PEM-encoded client certificate and private key.
type NoopWriter ¶
type NoopWriter struct{}
NoopWriter discards notifications. It is used when notifications are disabled via configuration.
func NewNoopWriter ¶
func NewNoopWriter() *NoopWriter
type Notification ¶
type Notification struct {
ID string `json:"id"`
Version string `json:"version"`
Bundle string `json:"bundle"`
Application string `json:"application"`
EventType string `json:"event_type"`
Timestamp string `json:"timestamp"`
OrgID string `json:"org_id"`
Severity string `json:"severity"`
Context map[string]string `json:"context,omitempty"`
Events []Event `json:"events"`
Recipients []Recipient `json:"recipients,omitempty"`
}
Notification matches the Console Notifications service message schema.
func New ¶
func New(eventType, orgID, severity string, context map[string]string, payload any, recipients ...Recipient) Notification
New builds a Notification for eventType, stamping the fields fixed by the application's registration with the notification service (id, version, bundle, application, timestamp).
type StdoutWriter ¶
type StdoutWriter struct{}
StdoutWriter prints notifications to stdout. It is used as a fallback when the notification service's mTLS client certificate is not configured.
func NewStdoutWriter ¶
func NewStdoutWriter() *StdoutWriter