Documentation
¶
Index ¶
- func IDForAccount(alertID [32]byte, id rhpv3.Account) types.Hash256
- func IDForContract(alertID [32]byte, fcid types.FileContractID) types.Hash256
- func IDForHost(alertID [32]byte, hk types.PublicKey) types.Hash256
- func IDForSlab(alertID [32]byte, slabKey object.EncryptionKey) types.Hash256
- func RandomAlertID() types.Hash256
- type Alert
- type Alerter
- type AlertsOpts
- type AlertsResponse
- type Manager
- func (m *Manager) Alerts(_ context.Context, opts AlertsOpts) (AlertsResponse, error)
- func (m *Manager) DismissAlerts(ctx context.Context, ids ...types.Hash256) error
- func (m *Manager) RegisterAlert(ctx context.Context, alert Alert) error
- func (m *Manager) RegisterWebhookBroadcaster(b webhooks.Broadcaster)
- type Severity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IDForAccount ¶ added in v1.0.7
func IDForContract ¶ added in v1.0.7
func IDForContract(alertID [32]byte, fcid types.FileContractID) types.Hash256
func IDForSlab ¶ added in v1.0.7
func IDForSlab(alertID [32]byte, slabKey object.EncryptionKey) types.Hash256
func RandomAlertID ¶ added in v1.0.7
Types ¶
type Alert ¶
type Alert struct { // ID is a unique identifier for the alert. ID types.Hash256 `json:"id"` // Severity is the severity of the alert. Severity Severity `json:"severity"` // Message is a human-readable message describing the alert. Message string `json:"message"` // Data is a map of arbitrary data that can be used to provide // additional context to the alert. Data map[string]any `json:"data,omitempty"` Timestamp time.Time `json:"timestamp"` }
An Alert is a dismissible message that is displayed to the user.
type Alerter ¶
type Alerter interface { Alerts(_ context.Context, opts AlertsOpts) (resp AlertsResponse, err error) RegisterAlert(_ context.Context, a Alert) error DismissAlerts(_ context.Context, ids ...types.Hash256) error }
func WithOrigin ¶
WithOrigin wraps an Alerter in an originAlerter which always attaches the origin field to alerts.
type AlertsOpts ¶ added in v1.0.6
type AlertsResponse ¶ added in v1.0.6
type AlertsResponse struct { Alerts []Alert `json:"alerts"` HasMore bool `json:"hasMore"` Totals struct { Info int `json:"info"` Warning int `json:"warning"` Error int `json:"error"` Critical int `json:"critical"` } `json:"totals"` }
func (AlertsResponse) Total ¶ added in v1.0.6
func (ar AlertsResponse) Total() int
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
A Manager manages the host's alerts.
func (*Manager) Alerts ¶ added in v1.0.6
func (m *Manager) Alerts(_ context.Context, opts AlertsOpts) (AlertsResponse, error)
Alerts returns the host's active alerts.
func (*Manager) DismissAlerts ¶
DismissAlerts implements the Alerter interface.
func (*Manager) RegisterAlert ¶
RegisterAlert implements the Alerter interface.
func (*Manager) RegisterWebhookBroadcaster ¶
func (m *Manager) RegisterWebhookBroadcaster(b webhooks.Broadcaster)
type Severity ¶
type Severity uint8
Severity indicates the severity of an alert.
const ( // SeverityInfo indicates that the alert is informational. SeverityInfo Severity = iota + 1 // SeverityWarning indicates that the alert is a warning. SeverityWarning // SeverityError indicates that the alert is an error. SeverityError // SeverityCritical indicates that the alert is critical. SeverityCritical )
func (*Severity) LoadString ¶ added in v1.0.6
func (Severity) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (*Severity) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
Click to show internal directories.
Click to hide internal directories.