Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
This module provides types for defining notification events.
Synopsis
- data Event result = MkEvent {
- name :: !Text
- serviceType :: !(ServiceType result)
- pollInterval :: !PollInterval
- raiseAlert :: result -> Maybe NaviNote
- repeatEvent :: !(RepeatEvent result)
- errorNote :: !ErrorNote
- data AnyEvent where
- MkAnyEvent :: (Eq result, Show result) => Event result -> AnyEvent
- data RepeatEvent a
- = NoRepeats !(IORef (Maybe a))
- | AllowRepeats
- _NoRepeats :: forall a a. Prism (RepeatEvent a) (RepeatEvent a) (IORef (Maybe a)) (IORef (Maybe a))
- _AllowRepeats :: forall a. Prism' (RepeatEvent a) ()
- data ErrorNote
- = NoErrNote
- | AllowErrNote !(RepeatEvent ())
- _NoErrNote :: Prism' ErrorNote ()
- _AllowErrNote :: Prism' ErrorNote (RepeatEvent ())
- data EventError = MkEventError {}
- data EventSuccess result = MkEventSuccess {
- result :: result
- repeatEvent :: RepeatEvent result
- raiseAlert :: result -> Maybe NaviNote
Documentation
Event
represents sending notifications. An event will:
- Query for information (i.e. run a shell command).
- Parse the result.
- Raise an alert if the result matches some condition.
MkEvent | |
|
Instances
(k ~ A_Lens, a ~ ErrorNote, b ~ ErrorNote) => LabelOptic "errorNote" k (Event result) (Event result) a b Source # | |
Defined in Navi.Event.Types | |
(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "name" k (Event result) (Event result) a b Source # | |
Defined in Navi.Event.Types | |
(k ~ A_Lens, a ~ PollInterval, b ~ PollInterval) => LabelOptic "pollInterval" k (Event result) (Event result) a b Source # | |
Defined in Navi.Event.Types | |
(k ~ A_Lens, a ~ (result -> Maybe NaviNote), b ~ (result -> Maybe NaviNote)) => LabelOptic "raiseAlert" k (Event result) (Event result) a b Source # | |
Defined in Navi.Event.Types | |
(k ~ A_Lens, a ~ RepeatEvent result, b ~ RepeatEvent result) => LabelOptic "repeatEvent" k (Event result) (Event result) a b Source # | |
Defined in Navi.Event.Types | |
(k ~ A_Lens, a ~ ServiceType result, b ~ ServiceType result) => LabelOptic "serviceType" k (Event result) (Event result) a b Source # | |
Defined in Navi.Event.Types | |
Show (Event result) Source # | |
Existentially quantifies result type on an Event
. Used so that we can
store different events in the same list.
MkAnyEvent :: (Eq result, Show result) => Event result -> AnyEvent |
data RepeatEvent a Source #
Determines if we are allowed to send off duplicate notifications
simultaneously. If we are not, then NoRepeats
holds the last trigger
so that we can detect duplicates.
NoRepeats !(IORef (Maybe a)) | |
AllowRepeats |
Instances
Show (RepeatEvent a) Source # | |
Defined in Navi.Event.Types |
_NoRepeats :: forall a a. Prism (RepeatEvent a) (RepeatEvent a) (IORef (Maybe a)) (IORef (Maybe a)) Source #
_AllowRepeats :: forall a. Prism' (RepeatEvent a) () Source #
Determines if we should send notifications for errors and, if so, if we allow repeats.
NoErrNote | |
AllowErrNote !(RepeatEvent ()) |
_NoErrNote :: Prism' ErrorNote () Source #
_AllowErrNote :: Prism' ErrorNote (RepeatEvent ()) Source #
data EventError Source #
Represents an error when querying an Event
.
Instances
Exception EventError Source # | |
Defined in Navi.Event.Types | |
Show EventError Source # | |
Defined in Navi.Event.Types | |
Eq EventError Source # | |
Defined in Navi.Event.Types (==) :: EventError -> EventError -> Bool Source # (/=) :: EventError -> EventError -> Bool Source # | |
(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "long" k EventError EventError a b Source # | |
Defined in Navi.Event.Types labelOptic :: Optic k NoIx EventError EventError a b Source # | |
(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "name" k EventError EventError a b Source # | |
Defined in Navi.Event.Types labelOptic :: Optic k NoIx EventError EventError a b Source # | |
(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "short" k EventError EventError a b Source # | |
Defined in Navi.Event.Types labelOptic :: Optic k NoIx EventError EventError a b Source # |
data EventSuccess result Source #
Holds the Event
data used after an event is successfully run.
Since: 0.1
MkEventSuccess | |
|
Instances
(k ~ A_Lens, a ~ (result -> Maybe NaviNote), b ~ (result -> Maybe NaviNote)) => LabelOptic "raiseAlert" k (EventSuccess result) (EventSuccess result) a b Source # | |
Defined in Navi.Event.Types labelOptic :: Optic k NoIx (EventSuccess result) (EventSuccess result) a b Source # | |
(k ~ A_Lens, a ~ RepeatEvent result, b ~ RepeatEvent result) => LabelOptic "repeatEvent" k (EventSuccess result) (EventSuccess result) a b Source # | |
Defined in Navi.Event.Types labelOptic :: Optic k NoIx (EventSuccess result) (EventSuccess result) a b Source # | |
(k ~ A_Lens, a ~ result, b ~ result) => LabelOptic "result" k (EventSuccess result) (EventSuccess result) a b Source # | |
Defined in Navi.Event.Types labelOptic :: Optic k NoIx (EventSuccess result) (EventSuccess result) a b Source # |