{-# 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.DynamoDBStreams.Types.Record where
import qualified Amazonka.Core as Core
import Amazonka.DynamoDBStreams.Types.Identity
import Amazonka.DynamoDBStreams.Types.OperationType
import Amazonka.DynamoDBStreams.Types.StreamRecord
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Record = Record'
{
Record -> Maybe Identity
userIdentity :: Prelude.Maybe Identity,
Record -> Maybe Text
eventVersion :: Prelude.Maybe Prelude.Text,
Record -> Maybe StreamRecord
dynamodb :: Prelude.Maybe StreamRecord,
Record -> Maybe Text
awsRegion :: Prelude.Maybe Prelude.Text,
Record -> Maybe OperationType
eventName :: Prelude.Maybe OperationType,
Record -> Maybe Text
eventSource :: Prelude.Maybe Prelude.Text,
Record -> Maybe Text
eventID :: Prelude.Maybe Prelude.Text
}
deriving (Record -> Record -> Bool
(Record -> Record -> Bool)
-> (Record -> Record -> Bool) -> Eq Record
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Record -> Record -> Bool
$c/= :: Record -> Record -> Bool
== :: Record -> Record -> Bool
$c== :: Record -> Record -> Bool
Prelude.Eq, ReadPrec [Record]
ReadPrec Record
Int -> ReadS Record
ReadS [Record]
(Int -> ReadS Record)
-> ReadS [Record]
-> ReadPrec Record
-> ReadPrec [Record]
-> Read Record
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Record]
$creadListPrec :: ReadPrec [Record]
readPrec :: ReadPrec Record
$creadPrec :: ReadPrec Record
readList :: ReadS [Record]
$creadList :: ReadS [Record]
readsPrec :: Int -> ReadS Record
$creadsPrec :: Int -> ReadS Record
Prelude.Read, Int -> Record -> ShowS
[Record] -> ShowS
Record -> String
(Int -> Record -> ShowS)
-> (Record -> String) -> ([Record] -> ShowS) -> Show Record
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Record] -> ShowS
$cshowList :: [Record] -> ShowS
show :: Record -> String
$cshow :: Record -> String
showsPrec :: Int -> Record -> ShowS
$cshowsPrec :: Int -> Record -> ShowS
Prelude.Show, (forall x. Record -> Rep Record x)
-> (forall x. Rep Record x -> Record) -> Generic Record
forall x. Rep Record x -> Record
forall x. Record -> Rep Record x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Record x -> Record
$cfrom :: forall x. Record -> Rep Record x
Prelude.Generic)
newRecord ::
Record
newRecord :: Record
newRecord =
Record' :: Maybe Identity
-> Maybe Text
-> Maybe StreamRecord
-> Maybe Text
-> Maybe OperationType
-> Maybe Text
-> Maybe Text
-> Record
Record'
{ $sel:userIdentity:Record' :: Maybe Identity
userIdentity = Maybe Identity
forall a. Maybe a
Prelude.Nothing,
$sel:eventVersion:Record' :: Maybe Text
eventVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:dynamodb:Record' :: Maybe StreamRecord
dynamodb = Maybe StreamRecord
forall a. Maybe a
Prelude.Nothing,
$sel:awsRegion:Record' :: Maybe Text
awsRegion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:eventName:Record' :: Maybe OperationType
eventName = Maybe OperationType
forall a. Maybe a
Prelude.Nothing,
$sel:eventSource:Record' :: Maybe Text
eventSource = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:eventID:Record' :: Maybe Text
eventID = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
record_userIdentity :: Lens.Lens' Record (Prelude.Maybe Identity)
record_userIdentity :: (Maybe Identity -> f (Maybe Identity)) -> Record -> f Record
record_userIdentity = (Record -> Maybe Identity)
-> (Record -> Maybe Identity -> Record)
-> Lens Record Record (Maybe Identity) (Maybe Identity)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Record' {Maybe Identity
userIdentity :: Maybe Identity
$sel:userIdentity:Record' :: Record -> Maybe Identity
userIdentity} -> Maybe Identity
userIdentity) (\s :: Record
s@Record' {} Maybe Identity
a -> Record
s {$sel:userIdentity:Record' :: Maybe Identity
userIdentity = Maybe Identity
a} :: Record)
record_eventVersion :: Lens.Lens' Record (Prelude.Maybe Prelude.Text)
record_eventVersion :: (Maybe Text -> f (Maybe Text)) -> Record -> f Record
record_eventVersion = (Record -> Maybe Text)
-> (Record -> Maybe Text -> Record)
-> Lens Record Record (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Record' {Maybe Text
eventVersion :: Maybe Text
$sel:eventVersion:Record' :: Record -> Maybe Text
eventVersion} -> Maybe Text
eventVersion) (\s :: Record
s@Record' {} Maybe Text
a -> Record
s {$sel:eventVersion:Record' :: Maybe Text
eventVersion = Maybe Text
a} :: Record)
record_dynamodb :: Lens.Lens' Record (Prelude.Maybe StreamRecord)
record_dynamodb :: (Maybe StreamRecord -> f (Maybe StreamRecord))
-> Record -> f Record
record_dynamodb = (Record -> Maybe StreamRecord)
-> (Record -> Maybe StreamRecord -> Record)
-> Lens Record Record (Maybe StreamRecord) (Maybe StreamRecord)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Record' {Maybe StreamRecord
dynamodb :: Maybe StreamRecord
$sel:dynamodb:Record' :: Record -> Maybe StreamRecord
dynamodb} -> Maybe StreamRecord
dynamodb) (\s :: Record
s@Record' {} Maybe StreamRecord
a -> Record
s {$sel:dynamodb:Record' :: Maybe StreamRecord
dynamodb = Maybe StreamRecord
a} :: Record)
record_awsRegion :: Lens.Lens' Record (Prelude.Maybe Prelude.Text)
record_awsRegion :: (Maybe Text -> f (Maybe Text)) -> Record -> f Record
record_awsRegion = (Record -> Maybe Text)
-> (Record -> Maybe Text -> Record)
-> Lens Record Record (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Record' {Maybe Text
awsRegion :: Maybe Text
$sel:awsRegion:Record' :: Record -> Maybe Text
awsRegion} -> Maybe Text
awsRegion) (\s :: Record
s@Record' {} Maybe Text
a -> Record
s {$sel:awsRegion:Record' :: Maybe Text
awsRegion = Maybe Text
a} :: Record)
record_eventName :: Lens.Lens' Record (Prelude.Maybe OperationType)
record_eventName :: (Maybe OperationType -> f (Maybe OperationType))
-> Record -> f Record
record_eventName = (Record -> Maybe OperationType)
-> (Record -> Maybe OperationType -> Record)
-> Lens Record Record (Maybe OperationType) (Maybe OperationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Record' {Maybe OperationType
eventName :: Maybe OperationType
$sel:eventName:Record' :: Record -> Maybe OperationType
eventName} -> Maybe OperationType
eventName) (\s :: Record
s@Record' {} Maybe OperationType
a -> Record
s {$sel:eventName:Record' :: Maybe OperationType
eventName = Maybe OperationType
a} :: Record)
record_eventSource :: Lens.Lens' Record (Prelude.Maybe Prelude.Text)
record_eventSource :: (Maybe Text -> f (Maybe Text)) -> Record -> f Record
record_eventSource = (Record -> Maybe Text)
-> (Record -> Maybe Text -> Record)
-> Lens Record Record (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Record' {Maybe Text
eventSource :: Maybe Text
$sel:eventSource:Record' :: Record -> Maybe Text
eventSource} -> Maybe Text
eventSource) (\s :: Record
s@Record' {} Maybe Text
a -> Record
s {$sel:eventSource:Record' :: Maybe Text
eventSource = Maybe Text
a} :: Record)
record_eventID :: Lens.Lens' Record (Prelude.Maybe Prelude.Text)
record_eventID :: (Maybe Text -> f (Maybe Text)) -> Record -> f Record
record_eventID = (Record -> Maybe Text)
-> (Record -> Maybe Text -> Record)
-> Lens Record Record (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Record' {Maybe Text
eventID :: Maybe Text
$sel:eventID:Record' :: Record -> Maybe Text
eventID} -> Maybe Text
eventID) (\s :: Record
s@Record' {} Maybe Text
a -> Record
s {$sel:eventID:Record' :: Maybe Text
eventID = Maybe Text
a} :: Record)
instance Core.FromJSON Record where
parseJSON :: Value -> Parser Record
parseJSON =
String -> (Object -> Parser Record) -> Value -> Parser Record
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Record"
( \Object
x ->
Maybe Identity
-> Maybe Text
-> Maybe StreamRecord
-> Maybe Text
-> Maybe OperationType
-> Maybe Text
-> Maybe Text
-> Record
Record'
(Maybe Identity
-> Maybe Text
-> Maybe StreamRecord
-> Maybe Text
-> Maybe OperationType
-> Maybe Text
-> Maybe Text
-> Record)
-> Parser (Maybe Identity)
-> Parser
(Maybe Text
-> Maybe StreamRecord
-> Maybe Text
-> Maybe OperationType
-> Maybe Text
-> Maybe Text
-> Record)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Identity)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"userIdentity")
Parser
(Maybe Text
-> Maybe StreamRecord
-> Maybe Text
-> Maybe OperationType
-> Maybe Text
-> Maybe Text
-> Record)
-> Parser (Maybe Text)
-> Parser
(Maybe StreamRecord
-> Maybe Text
-> Maybe OperationType
-> Maybe Text
-> Maybe Text
-> Record)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"eventVersion")
Parser
(Maybe StreamRecord
-> Maybe Text
-> Maybe OperationType
-> Maybe Text
-> Maybe Text
-> Record)
-> Parser (Maybe StreamRecord)
-> Parser
(Maybe Text
-> Maybe OperationType -> Maybe Text -> Maybe Text -> Record)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe StreamRecord)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"dynamodb")
Parser
(Maybe Text
-> Maybe OperationType -> Maybe Text -> Maybe Text -> Record)
-> Parser (Maybe Text)
-> Parser
(Maybe OperationType -> Maybe Text -> Maybe Text -> Record)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"awsRegion")
Parser (Maybe OperationType -> Maybe Text -> Maybe Text -> Record)
-> Parser (Maybe OperationType)
-> Parser (Maybe Text -> Maybe Text -> Record)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe OperationType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"eventName")
Parser (Maybe Text -> Maybe Text -> Record)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Record)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"eventSource")
Parser (Maybe Text -> Record)
-> Parser (Maybe Text) -> Parser Record
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"eventID")
)
instance Prelude.Hashable Record
instance Prelude.NFData Record