{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Evidently.Types.Event where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Evidently.Types.EventType
import qualified Amazonka.Prelude as Prelude
data Event = Event'
{
Event -> Text
data' :: Prelude.Text,
Event -> POSIX
timestamp :: Data.POSIX,
Event -> EventType
type' :: EventType
}
deriving (Event -> Event -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Event -> Event -> Bool
$c/= :: Event -> Event -> Bool
== :: Event -> Event -> Bool
$c== :: Event -> Event -> Bool
Prelude.Eq, ReadPrec [Event]
ReadPrec Event
Int -> ReadS Event
ReadS [Event]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Event]
$creadListPrec :: ReadPrec [Event]
readPrec :: ReadPrec Event
$creadPrec :: ReadPrec Event
readList :: ReadS [Event]
$creadList :: ReadS [Event]
readsPrec :: Int -> ReadS Event
$creadsPrec :: Int -> ReadS Event
Prelude.Read, Int -> Event -> ShowS
[Event] -> ShowS
Event -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Event] -> ShowS
$cshowList :: [Event] -> ShowS
show :: Event -> String
$cshow :: Event -> String
showsPrec :: Int -> Event -> ShowS
$cshowsPrec :: Int -> Event -> ShowS
Prelude.Show, forall x. Rep Event x -> Event
forall x. Event -> Rep Event x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Event x -> Event
$cfrom :: forall x. Event -> Rep Event x
Prelude.Generic)
newEvent ::
Prelude.Text ->
Prelude.UTCTime ->
EventType ->
Event
newEvent :: Text -> UTCTime -> EventType -> Event
newEvent Text
pData_ UTCTime
pTimestamp_ EventType
pType_ =
Event'
{ $sel:data':Event' :: Text
data' = Text
pData_,
$sel:timestamp:Event' :: POSIX
timestamp = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pTimestamp_,
$sel:type':Event' :: EventType
type' = EventType
pType_
}
event_data :: Lens.Lens' Event Prelude.Text
event_data :: Lens' Event Text
event_data = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {Text
data' :: Text
$sel:data':Event' :: Event -> Text
data'} -> Text
data') (\s :: Event
s@Event' {} Text
a -> Event
s {$sel:data':Event' :: Text
data' = Text
a} :: Event)
event_timestamp :: Lens.Lens' Event Prelude.UTCTime
event_timestamp :: Lens' Event UTCTime
event_timestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {POSIX
timestamp :: POSIX
$sel:timestamp:Event' :: Event -> POSIX
timestamp} -> POSIX
timestamp) (\s :: Event
s@Event' {} POSIX
a -> Event
s {$sel:timestamp:Event' :: POSIX
timestamp = POSIX
a} :: Event) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
event_type :: Lens.Lens' Event EventType
event_type :: Lens' Event EventType
event_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Event' {EventType
type' :: EventType
$sel:type':Event' :: Event -> EventType
type'} -> EventType
type') (\s :: Event
s@Event' {} EventType
a -> Event
s {$sel:type':Event' :: EventType
type' = EventType
a} :: Event)
instance Prelude.Hashable Event where
hashWithSalt :: Int -> Event -> Int
hashWithSalt Int
_salt Event' {Text
POSIX
EventType
type' :: EventType
timestamp :: POSIX
data' :: Text
$sel:type':Event' :: Event -> EventType
$sel:timestamp:Event' :: Event -> POSIX
$sel:data':Event' :: Event -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
data'
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
timestamp
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` EventType
type'
instance Prelude.NFData Event where
rnf :: Event -> ()
rnf Event' {Text
POSIX
EventType
type' :: EventType
timestamp :: POSIX
data' :: Text
$sel:type':Event' :: Event -> EventType
$sel:timestamp:Event' :: Event -> POSIX
$sel:data':Event' :: Event -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
data'
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
timestamp
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf EventType
type'
instance Data.ToJSON Event where
toJSON :: Event -> Value
toJSON Event' {Text
POSIX
EventType
type' :: EventType
timestamp :: POSIX
data' :: Text
$sel:type':Event' :: Event -> EventType
$sel:timestamp:Event' :: Event -> POSIX
$sel:data':Event' :: Event -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"data" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
data'),
forall a. a -> Maybe a
Prelude.Just (Key
"timestamp" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= POSIX
timestamp),
forall a. a -> Maybe a
Prelude.Just (Key
"type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= EventType
type')
]
)