Documentation ¶
Index ¶
- Constants
- type Alert
- type AlertType
- type Alerter
- type Dispatcher
- type DispatcherFunc
- type Dispatchers
- type Manager
- type NotFoundError
- type Payload
- func (p Payload) Float64(key string) (float64, error)
- func (p Payload) GroupVersionKind() (schema.GroupVersionKind, error)
- func (p Payload) OptionalString(key string) (string, error)
- func (p Payload) String(key string) (string, error)
- func (p Payload) StringSlice(key string) ([]string, error)
- func (p Payload) Uint16(key string) (uint16, error)
Constants ¶
View Source
const ( // DefaultAlertExpiration is the default expiration for alerts. DefaultAlertExpiration = 10 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct { // Type is the type of alert. Type AlertType `json:"type"` // Message is the message for the alert. Message string `json:"message"` // Expiration is the time the alert expires. Expiration *time.Time `json:"expiration,omitempty"` }
Alert is an alert message.
type Dispatcher ¶
type Dispatcher interface { ActionName() string Handle(ctx context.Context, alerter Alerter, payload Payload) error }
Dispatcher handles actions.
type DispatcherFunc ¶
DispatcherFunc is a function that will be dispatched to handle a payload.
type Dispatchers ¶
type Dispatchers []Dispatcher
Dispatchers is a slice of Dispatcher.
func (Dispatchers) ToActionPaths ¶
func (d Dispatchers) ToActionPaths() map[string]DispatcherFunc
ToActionPaths converts Dispatchers to a map.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages actions.
func NewManager ¶
NewManager creates an instance of Manager.
type NotFoundError ¶
type NotFoundError struct {
Path string
}
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
type Payload ¶
type Payload map[string]interface{}
Payload is an action payload.
func CreatePayload ¶
CreatePayload creates a payload with an action name and fields.
func (Payload) GroupVersionKind ¶
func (p Payload) GroupVersionKind() (schema.GroupVersionKind, error)
GroupVersionKind extracts a GroupVersionKind from a payload.
func (Payload) OptionalString ¶
OptionalString returns a string from the payload. If the string does not exist, it returns an empty string.
func (Payload) StringSlice ¶
StringSlice returns a string slice from the payload.
Click to show internal directories.
Click to hide internal directories.