{-# 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.Rum.Types.RumEvent where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data RumEvent = RumEvent'
{
RumEvent -> Maybe Text
metadata :: Prelude.Maybe Prelude.Text,
RumEvent -> Text
details :: Prelude.Text,
RumEvent -> Text
id :: Prelude.Text,
RumEvent -> POSIX
timestamp :: Data.POSIX,
RumEvent -> Text
type' :: Prelude.Text
}
deriving (RumEvent -> RumEvent -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RumEvent -> RumEvent -> Bool
$c/= :: RumEvent -> RumEvent -> Bool
== :: RumEvent -> RumEvent -> Bool
$c== :: RumEvent -> RumEvent -> Bool
Prelude.Eq, ReadPrec [RumEvent]
ReadPrec RumEvent
Int -> ReadS RumEvent
ReadS [RumEvent]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RumEvent]
$creadListPrec :: ReadPrec [RumEvent]
readPrec :: ReadPrec RumEvent
$creadPrec :: ReadPrec RumEvent
readList :: ReadS [RumEvent]
$creadList :: ReadS [RumEvent]
readsPrec :: Int -> ReadS RumEvent
$creadsPrec :: Int -> ReadS RumEvent
Prelude.Read, Int -> RumEvent -> ShowS
[RumEvent] -> ShowS
RumEvent -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RumEvent] -> ShowS
$cshowList :: [RumEvent] -> ShowS
show :: RumEvent -> String
$cshow :: RumEvent -> String
showsPrec :: Int -> RumEvent -> ShowS
$cshowsPrec :: Int -> RumEvent -> ShowS
Prelude.Show, forall x. Rep RumEvent x -> RumEvent
forall x. RumEvent -> Rep RumEvent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RumEvent x -> RumEvent
$cfrom :: forall x. RumEvent -> Rep RumEvent x
Prelude.Generic)
newRumEvent ::
Prelude.Text ->
Prelude.Text ->
Prelude.UTCTime ->
Prelude.Text ->
RumEvent
newRumEvent :: Text -> Text -> UTCTime -> Text -> RumEvent
newRumEvent Text
pDetails_ Text
pId_ UTCTime
pTimestamp_ Text
pType_ =
RumEvent'
{ $sel:metadata:RumEvent' :: Maybe Text
metadata = forall a. Maybe a
Prelude.Nothing,
$sel:details:RumEvent' :: Text
details = Text
pDetails_,
$sel:id:RumEvent' :: Text
id = Text
pId_,
$sel:timestamp:RumEvent' :: POSIX
timestamp = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pTimestamp_,
$sel:type':RumEvent' :: Text
type' = Text
pType_
}
rumEvent_metadata :: Lens.Lens' RumEvent (Prelude.Maybe Prelude.Text)
rumEvent_metadata :: Lens' RumEvent (Maybe Text)
rumEvent_metadata = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RumEvent' {Maybe Text
metadata :: Maybe Text
$sel:metadata:RumEvent' :: RumEvent -> Maybe Text
metadata} -> Maybe Text
metadata) (\s :: RumEvent
s@RumEvent' {} Maybe Text
a -> RumEvent
s {$sel:metadata:RumEvent' :: Maybe Text
metadata = Maybe Text
a} :: RumEvent)
rumEvent_details :: Lens.Lens' RumEvent Prelude.Text
rumEvent_details :: Lens' RumEvent Text
rumEvent_details = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RumEvent' {Text
details :: Text
$sel:details:RumEvent' :: RumEvent -> Text
details} -> Text
details) (\s :: RumEvent
s@RumEvent' {} Text
a -> RumEvent
s {$sel:details:RumEvent' :: Text
details = Text
a} :: RumEvent)
rumEvent_id :: Lens.Lens' RumEvent Prelude.Text
rumEvent_id :: Lens' RumEvent Text
rumEvent_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RumEvent' {Text
id :: Text
$sel:id:RumEvent' :: RumEvent -> Text
id} -> Text
id) (\s :: RumEvent
s@RumEvent' {} Text
a -> RumEvent
s {$sel:id:RumEvent' :: Text
id = Text
a} :: RumEvent)
rumEvent_timestamp :: Lens.Lens' RumEvent Prelude.UTCTime
rumEvent_timestamp :: Lens' RumEvent UTCTime
rumEvent_timestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RumEvent' {POSIX
timestamp :: POSIX
$sel:timestamp:RumEvent' :: RumEvent -> POSIX
timestamp} -> POSIX
timestamp) (\s :: RumEvent
s@RumEvent' {} POSIX
a -> RumEvent
s {$sel:timestamp:RumEvent' :: POSIX
timestamp = POSIX
a} :: RumEvent) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
rumEvent_type :: Lens.Lens' RumEvent Prelude.Text
rumEvent_type :: Lens' RumEvent Text
rumEvent_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RumEvent' {Text
type' :: Text
$sel:type':RumEvent' :: RumEvent -> Text
type'} -> Text
type') (\s :: RumEvent
s@RumEvent' {} Text
a -> RumEvent
s {$sel:type':RumEvent' :: Text
type' = Text
a} :: RumEvent)
instance Prelude.Hashable RumEvent where
hashWithSalt :: Int -> RumEvent -> Int
hashWithSalt Int
_salt RumEvent' {Maybe Text
Text
POSIX
type' :: Text
timestamp :: POSIX
id :: Text
details :: Text
metadata :: Maybe Text
$sel:type':RumEvent' :: RumEvent -> Text
$sel:timestamp:RumEvent' :: RumEvent -> POSIX
$sel:id:RumEvent' :: RumEvent -> Text
$sel:details:RumEvent' :: RumEvent -> Text
$sel:metadata:RumEvent' :: RumEvent -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
metadata
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
details
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
timestamp
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
type'
instance Prelude.NFData RumEvent where
rnf :: RumEvent -> ()
rnf RumEvent' {Maybe Text
Text
POSIX
type' :: Text
timestamp :: POSIX
id :: Text
details :: Text
metadata :: Maybe Text
$sel:type':RumEvent' :: RumEvent -> Text
$sel:timestamp:RumEvent' :: RumEvent -> POSIX
$sel:id:RumEvent' :: RumEvent -> Text
$sel:details:RumEvent' :: RumEvent -> Text
$sel:metadata:RumEvent' :: RumEvent -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
metadata
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
details
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
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 Text
type'
instance Data.ToJSON RumEvent where
toJSON :: RumEvent -> Value
toJSON RumEvent' {Maybe Text
Text
POSIX
type' :: Text
timestamp :: POSIX
id :: Text
details :: Text
metadata :: Maybe Text
$sel:type':RumEvent' :: RumEvent -> Text
$sel:timestamp:RumEvent' :: RumEvent -> POSIX
$sel:id:RumEvent' :: RumEvent -> Text
$sel:details:RumEvent' :: RumEvent -> Text
$sel:metadata:RumEvent' :: RumEvent -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"metadata" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
metadata,
forall a. a -> Maybe a
Prelude.Just (Key
"details" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
details),
forall a. a -> Maybe a
Prelude.Just (Key
"id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
id),
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..= Text
type')
]
)