{-# 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.Kinesis.Types.Record where
import qualified Amazonka.Core as Core
import Amazonka.Kinesis.Types.EncryptionType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Record = Record'
{
Record -> Maybe EncryptionType
encryptionType :: Prelude.Maybe EncryptionType,
Record -> Maybe POSIX
approximateArrivalTimestamp :: Prelude.Maybe Core.POSIX,
Record -> Text
sequenceNumber :: Prelude.Text,
Record -> Base64
data' :: Core.Base64,
Record -> Text
partitionKey :: 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 ::
Prelude.Text ->
Prelude.ByteString ->
Prelude.Text ->
Record
newRecord :: Text -> ByteString -> Text -> Record
newRecord Text
pSequenceNumber_ ByteString
pData_ Text
pPartitionKey_ =
Record' :: Maybe EncryptionType
-> Maybe POSIX -> Text -> Base64 -> Text -> Record
Record'
{ $sel:encryptionType:Record' :: Maybe EncryptionType
encryptionType = Maybe EncryptionType
forall a. Maybe a
Prelude.Nothing,
$sel:approximateArrivalTimestamp:Record' :: Maybe POSIX
approximateArrivalTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:sequenceNumber:Record' :: Text
sequenceNumber = Text
pSequenceNumber_,
$sel:data':Record' :: Base64
data' = Tagged ByteString (Identity ByteString)
-> Tagged Base64 (Identity Base64)
Iso' Base64 ByteString
Core._Base64 (Tagged ByteString (Identity ByteString)
-> Tagged Base64 (Identity Base64))
-> ByteString -> Base64
forall t b. AReview t b -> b -> t
Lens.# ByteString
pData_,
$sel:partitionKey:Record' :: Text
partitionKey = Text
pPartitionKey_
}
record_encryptionType :: Lens.Lens' Record (Prelude.Maybe EncryptionType)
record_encryptionType :: (Maybe EncryptionType -> f (Maybe EncryptionType))
-> Record -> f Record
record_encryptionType = (Record -> Maybe EncryptionType)
-> (Record -> Maybe EncryptionType -> Record)
-> Lens Record Record (Maybe EncryptionType) (Maybe EncryptionType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Record' {Maybe EncryptionType
encryptionType :: Maybe EncryptionType
$sel:encryptionType:Record' :: Record -> Maybe EncryptionType
encryptionType} -> Maybe EncryptionType
encryptionType) (\s :: Record
s@Record' {} Maybe EncryptionType
a -> Record
s {$sel:encryptionType:Record' :: Maybe EncryptionType
encryptionType = Maybe EncryptionType
a} :: Record)
record_approximateArrivalTimestamp :: Lens.Lens' Record (Prelude.Maybe Prelude.UTCTime)
record_approximateArrivalTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Record -> f Record
record_approximateArrivalTimestamp = (Record -> Maybe POSIX)
-> (Record -> Maybe POSIX -> Record)
-> Lens Record Record (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Record' {Maybe POSIX
approximateArrivalTimestamp :: Maybe POSIX
$sel:approximateArrivalTimestamp:Record' :: Record -> Maybe POSIX
approximateArrivalTimestamp} -> Maybe POSIX
approximateArrivalTimestamp) (\s :: Record
s@Record' {} Maybe POSIX
a -> Record
s {$sel:approximateArrivalTimestamp:Record' :: Maybe POSIX
approximateArrivalTimestamp = Maybe POSIX
a} :: Record) ((Maybe POSIX -> f (Maybe POSIX)) -> Record -> f Record)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Record
-> f Record
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
record_sequenceNumber :: Lens.Lens' Record Prelude.Text
record_sequenceNumber :: (Text -> f Text) -> Record -> f Record
record_sequenceNumber = (Record -> Text)
-> (Record -> Text -> Record) -> Lens Record Record Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Record' {Text
sequenceNumber :: Text
$sel:sequenceNumber:Record' :: Record -> Text
sequenceNumber} -> Text
sequenceNumber) (\s :: Record
s@Record' {} Text
a -> Record
s {$sel:sequenceNumber:Record' :: Text
sequenceNumber = Text
a} :: Record)
record_data :: Lens.Lens' Record Prelude.ByteString
record_data :: (ByteString -> f ByteString) -> Record -> f Record
record_data = (Record -> Base64)
-> (Record -> Base64 -> Record) -> Lens Record Record Base64 Base64
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Record' {Base64
data' :: Base64
$sel:data':Record' :: Record -> Base64
data'} -> Base64
data') (\s :: Record
s@Record' {} Base64
a -> Record
s {$sel:data':Record' :: Base64
data' = Base64
a} :: Record) ((Base64 -> f Base64) -> Record -> f Record)
-> ((ByteString -> f ByteString) -> Base64 -> f Base64)
-> (ByteString -> f ByteString)
-> Record
-> f Record
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ByteString -> f ByteString) -> Base64 -> f Base64
Iso' Base64 ByteString
Core._Base64
record_partitionKey :: Lens.Lens' Record Prelude.Text
record_partitionKey :: (Text -> f Text) -> Record -> f Record
record_partitionKey = (Record -> Text)
-> (Record -> Text -> Record) -> Lens Record Record Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Record' {Text
partitionKey :: Text
$sel:partitionKey:Record' :: Record -> Text
partitionKey} -> Text
partitionKey) (\s :: Record
s@Record' {} Text
a -> Record
s {$sel:partitionKey:Record' :: Text
partitionKey = 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 EncryptionType
-> Maybe POSIX -> Text -> Base64 -> Text -> Record
Record'
(Maybe EncryptionType
-> Maybe POSIX -> Text -> Base64 -> Text -> Record)
-> Parser (Maybe EncryptionType)
-> Parser (Maybe POSIX -> Text -> Base64 -> Text -> Record)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe EncryptionType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EncryptionType")
Parser (Maybe POSIX -> Text -> Base64 -> Text -> Record)
-> Parser (Maybe POSIX)
-> Parser (Text -> Base64 -> Text -> Record)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ApproximateArrivalTimestamp")
Parser (Text -> Base64 -> Text -> Record)
-> Parser Text -> Parser (Base64 -> Text -> Record)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SequenceNumber")
Parser (Base64 -> Text -> Record)
-> Parser Base64 -> Parser (Text -> Record)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Base64
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Data")
Parser (Text -> Record) -> Parser Text -> Parser Record
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"PartitionKey")
)
instance Prelude.Hashable Record
instance Prelude.NFData Record