{-# 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.StartingPosition where
import qualified Amazonka.Core as Core
import Amazonka.Kinesis.Types.ShardIteratorType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data StartingPosition = StartingPosition'
{
StartingPosition -> Maybe Text
sequenceNumber :: Prelude.Maybe Prelude.Text,
StartingPosition -> Maybe POSIX
timestamp :: Prelude.Maybe Core.POSIX,
StartingPosition -> ShardIteratorType
type' :: ShardIteratorType
}
deriving (StartingPosition -> StartingPosition -> Bool
(StartingPosition -> StartingPosition -> Bool)
-> (StartingPosition -> StartingPosition -> Bool)
-> Eq StartingPosition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartingPosition -> StartingPosition -> Bool
$c/= :: StartingPosition -> StartingPosition -> Bool
== :: StartingPosition -> StartingPosition -> Bool
$c== :: StartingPosition -> StartingPosition -> Bool
Prelude.Eq, ReadPrec [StartingPosition]
ReadPrec StartingPosition
Int -> ReadS StartingPosition
ReadS [StartingPosition]
(Int -> ReadS StartingPosition)
-> ReadS [StartingPosition]
-> ReadPrec StartingPosition
-> ReadPrec [StartingPosition]
-> Read StartingPosition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartingPosition]
$creadListPrec :: ReadPrec [StartingPosition]
readPrec :: ReadPrec StartingPosition
$creadPrec :: ReadPrec StartingPosition
readList :: ReadS [StartingPosition]
$creadList :: ReadS [StartingPosition]
readsPrec :: Int -> ReadS StartingPosition
$creadsPrec :: Int -> ReadS StartingPosition
Prelude.Read, Int -> StartingPosition -> ShowS
[StartingPosition] -> ShowS
StartingPosition -> String
(Int -> StartingPosition -> ShowS)
-> (StartingPosition -> String)
-> ([StartingPosition] -> ShowS)
-> Show StartingPosition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartingPosition] -> ShowS
$cshowList :: [StartingPosition] -> ShowS
show :: StartingPosition -> String
$cshow :: StartingPosition -> String
showsPrec :: Int -> StartingPosition -> ShowS
$cshowsPrec :: Int -> StartingPosition -> ShowS
Prelude.Show, (forall x. StartingPosition -> Rep StartingPosition x)
-> (forall x. Rep StartingPosition x -> StartingPosition)
-> Generic StartingPosition
forall x. Rep StartingPosition x -> StartingPosition
forall x. StartingPosition -> Rep StartingPosition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartingPosition x -> StartingPosition
$cfrom :: forall x. StartingPosition -> Rep StartingPosition x
Prelude.Generic)
newStartingPosition ::
ShardIteratorType ->
StartingPosition
newStartingPosition :: ShardIteratorType -> StartingPosition
newStartingPosition ShardIteratorType
pType_ =
StartingPosition' :: Maybe Text -> Maybe POSIX -> ShardIteratorType -> StartingPosition
StartingPosition'
{ $sel:sequenceNumber:StartingPosition' :: Maybe Text
sequenceNumber = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:timestamp:StartingPosition' :: Maybe POSIX
timestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:type':StartingPosition' :: ShardIteratorType
type' = ShardIteratorType
pType_
}
startingPosition_sequenceNumber :: Lens.Lens' StartingPosition (Prelude.Maybe Prelude.Text)
startingPosition_sequenceNumber :: (Maybe Text -> f (Maybe Text))
-> StartingPosition -> f StartingPosition
startingPosition_sequenceNumber = (StartingPosition -> Maybe Text)
-> (StartingPosition -> Maybe Text -> StartingPosition)
-> Lens StartingPosition StartingPosition (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartingPosition' {Maybe Text
sequenceNumber :: Maybe Text
$sel:sequenceNumber:StartingPosition' :: StartingPosition -> Maybe Text
sequenceNumber} -> Maybe Text
sequenceNumber) (\s :: StartingPosition
s@StartingPosition' {} Maybe Text
a -> StartingPosition
s {$sel:sequenceNumber:StartingPosition' :: Maybe Text
sequenceNumber = Maybe Text
a} :: StartingPosition)
startingPosition_timestamp :: Lens.Lens' StartingPosition (Prelude.Maybe Prelude.UTCTime)
startingPosition_timestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> StartingPosition -> f StartingPosition
startingPosition_timestamp = (StartingPosition -> Maybe POSIX)
-> (StartingPosition -> Maybe POSIX -> StartingPosition)
-> Lens
StartingPosition StartingPosition (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartingPosition' {Maybe POSIX
timestamp :: Maybe POSIX
$sel:timestamp:StartingPosition' :: StartingPosition -> Maybe POSIX
timestamp} -> Maybe POSIX
timestamp) (\s :: StartingPosition
s@StartingPosition' {} Maybe POSIX
a -> StartingPosition
s {$sel:timestamp:StartingPosition' :: Maybe POSIX
timestamp = Maybe POSIX
a} :: StartingPosition) ((Maybe POSIX -> f (Maybe POSIX))
-> StartingPosition -> f StartingPosition)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> StartingPosition
-> f StartingPosition
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
startingPosition_type :: Lens.Lens' StartingPosition ShardIteratorType
startingPosition_type :: (ShardIteratorType -> f ShardIteratorType)
-> StartingPosition -> f StartingPosition
startingPosition_type = (StartingPosition -> ShardIteratorType)
-> (StartingPosition -> ShardIteratorType -> StartingPosition)
-> Lens
StartingPosition
StartingPosition
ShardIteratorType
ShardIteratorType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartingPosition' {ShardIteratorType
type' :: ShardIteratorType
$sel:type':StartingPosition' :: StartingPosition -> ShardIteratorType
type'} -> ShardIteratorType
type') (\s :: StartingPosition
s@StartingPosition' {} ShardIteratorType
a -> StartingPosition
s {$sel:type':StartingPosition' :: ShardIteratorType
type' = ShardIteratorType
a} :: StartingPosition)
instance Prelude.Hashable StartingPosition
instance Prelude.NFData StartingPosition
instance Core.ToJSON StartingPosition where
toJSON :: StartingPosition -> Value
toJSON StartingPosition' {Maybe Text
Maybe POSIX
ShardIteratorType
type' :: ShardIteratorType
timestamp :: Maybe POSIX
sequenceNumber :: Maybe Text
$sel:type':StartingPosition' :: StartingPosition -> ShardIteratorType
$sel:timestamp:StartingPosition' :: StartingPosition -> Maybe POSIX
$sel:sequenceNumber:StartingPosition' :: StartingPosition -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"SequenceNumber" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sequenceNumber,
(Text
"Timestamp" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
timestamp,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> ShardIteratorType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ShardIteratorType
type')
]
)