Documentation
¶
Index ¶
- Constants
- func AllEvents() []string
- func IsValidEvent(event string) bool
- func ParseEvents(eventsJSON string) []string
- type Alert
- type Delivery
- type Error
- type Event
- func (e *Event) WithAlert(alertType, message, severity string) *Event
- func (e *Event) WithDelivery(id, name string) *Event
- func (e *Event) WithError(code, message string) *Event
- func (e *Event) WithFile(id, name string, size int64, checksum, path string) *Event
- func (e *Event) WithProduct(id, name string) *Event
- type File
- type Manager
- func (m *Manager) CreateWebhook(name, url string, events []string) (*database.Webhook, error)
- func (m *Manager) DeleteWebhook(id uint) error
- func (m *Manager) Emit(ctx context.Context, event *Event)
- func (m *Manager) GetWebhook(id uint) (*database.Webhook, error)
- func (m *Manager) ListWebhooks() ([]database.Webhook, error)
- func (m *Manager) UpdateWebhook(id uint, name, url string, events []string, enabled bool) error
- type Product
Constants ¶
View Source
const ( EventFileAvailable = "file.available" EventDownloadStarted = "download.started" EventDownloadCompleted = "download.completed" EventDownloadFailed = "download.failed" EventDownloadCancelled = "download.cancelled" EventChecksumMismatch = "checksum.mismatch" EventSyncCompleted = "sync.completed" EventSyncFailed = "sync.failed" )
Variables ¶
This section is empty.
Functions ¶
func IsValidEvent ¶
func ParseEvents ¶
Types ¶
type Alert ¶
type Alert struct {
Type string `json:"type"`
Message string `json:"message"`
Severity string `json:"severity"` // "info", "warning", "error"
}
Alert represents an alert in the event payload
type Event ¶
type Event struct {
Type string `json:"event"`
Timestamp time.Time `json:"timestamp"`
Source string `json:"source"`
Product *Product `json:"product,omitempty"`
Delivery *Delivery `json:"delivery,omitempty"`
File *File `json:"file,omitempty"`
Alerts []Alert `json:"alerts,omitempty"`
Error *Error `json:"error,omitempty"`
}
Event represents a hook event
func (*Event) WithDelivery ¶
WithDelivery sets the delivery info
func (*Event) WithProduct ¶
WithProduct sets the product info
type File ¶
type File struct {
ID string `json:"id"`
Name string `json:"name"`
Size int64 `json:"size"`
Checksum string `json:"checksum,omitempty"`
Path string `json:"path,omitempty"`
}
File info for event payload
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) CreateWebhook ¶
func (*Manager) DeleteWebhook ¶
Click to show internal directories.
Click to hide internal directories.