{-# 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.Shard where
import qualified Amazonka.Core as Core
import Amazonka.DynamoDBStreams.Types.SequenceNumberRange
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Shard = Shard'
{
Shard -> Maybe Text
parentShardId :: Prelude.Maybe Prelude.Text,
Shard -> Maybe SequenceNumberRange
sequenceNumberRange :: Prelude.Maybe SequenceNumberRange,
Shard -> Maybe Text
shardId :: Prelude.Maybe Prelude.Text
}
deriving (Shard -> Shard -> Bool
(Shard -> Shard -> Bool) -> (Shard -> Shard -> Bool) -> Eq Shard
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Shard -> Shard -> Bool
$c/= :: Shard -> Shard -> Bool
== :: Shard -> Shard -> Bool
$c== :: Shard -> Shard -> Bool
Prelude.Eq, ReadPrec [Shard]
ReadPrec Shard
Int -> ReadS Shard
ReadS [Shard]
(Int -> ReadS Shard)
-> ReadS [Shard]
-> ReadPrec Shard
-> ReadPrec [Shard]
-> Read Shard
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Shard]
$creadListPrec :: ReadPrec [Shard]
readPrec :: ReadPrec Shard
$creadPrec :: ReadPrec Shard
readList :: ReadS [Shard]
$creadList :: ReadS [Shard]
readsPrec :: Int -> ReadS Shard
$creadsPrec :: Int -> ReadS Shard
Prelude.Read, Int -> Shard -> ShowS
[Shard] -> ShowS
Shard -> String
(Int -> Shard -> ShowS)
-> (Shard -> String) -> ([Shard] -> ShowS) -> Show Shard
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Shard] -> ShowS
$cshowList :: [Shard] -> ShowS
show :: Shard -> String
$cshow :: Shard -> String
showsPrec :: Int -> Shard -> ShowS
$cshowsPrec :: Int -> Shard -> ShowS
Prelude.Show, (forall x. Shard -> Rep Shard x)
-> (forall x. Rep Shard x -> Shard) -> Generic Shard
forall x. Rep Shard x -> Shard
forall x. Shard -> Rep Shard x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Shard x -> Shard
$cfrom :: forall x. Shard -> Rep Shard x
Prelude.Generic)
newShard ::
Shard
newShard :: Shard
newShard =
Shard' :: Maybe Text -> Maybe SequenceNumberRange -> Maybe Text -> Shard
Shard'
{ $sel:parentShardId:Shard' :: Maybe Text
parentShardId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:sequenceNumberRange:Shard' :: Maybe SequenceNumberRange
sequenceNumberRange = Maybe SequenceNumberRange
forall a. Maybe a
Prelude.Nothing,
$sel:shardId:Shard' :: Maybe Text
shardId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
shard_parentShardId :: Lens.Lens' Shard (Prelude.Maybe Prelude.Text)
shard_parentShardId :: (Maybe Text -> f (Maybe Text)) -> Shard -> f Shard
shard_parentShardId = (Shard -> Maybe Text)
-> (Shard -> Maybe Text -> Shard)
-> Lens Shard Shard (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Shard' {Maybe Text
parentShardId :: Maybe Text
$sel:parentShardId:Shard' :: Shard -> Maybe Text
parentShardId} -> Maybe Text
parentShardId) (\s :: Shard
s@Shard' {} Maybe Text
a -> Shard
s {$sel:parentShardId:Shard' :: Maybe Text
parentShardId = Maybe Text
a} :: Shard)
shard_sequenceNumberRange :: Lens.Lens' Shard (Prelude.Maybe SequenceNumberRange)
shard_sequenceNumberRange :: (Maybe SequenceNumberRange -> f (Maybe SequenceNumberRange))
-> Shard -> f Shard
shard_sequenceNumberRange = (Shard -> Maybe SequenceNumberRange)
-> (Shard -> Maybe SequenceNumberRange -> Shard)
-> Lens
Shard Shard (Maybe SequenceNumberRange) (Maybe SequenceNumberRange)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Shard' {Maybe SequenceNumberRange
sequenceNumberRange :: Maybe SequenceNumberRange
$sel:sequenceNumberRange:Shard' :: Shard -> Maybe SequenceNumberRange
sequenceNumberRange} -> Maybe SequenceNumberRange
sequenceNumberRange) (\s :: Shard
s@Shard' {} Maybe SequenceNumberRange
a -> Shard
s {$sel:sequenceNumberRange:Shard' :: Maybe SequenceNumberRange
sequenceNumberRange = Maybe SequenceNumberRange
a} :: Shard)
shard_shardId :: Lens.Lens' Shard (Prelude.Maybe Prelude.Text)
shard_shardId :: (Maybe Text -> f (Maybe Text)) -> Shard -> f Shard
shard_shardId = (Shard -> Maybe Text)
-> (Shard -> Maybe Text -> Shard)
-> Lens Shard Shard (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Shard' {Maybe Text
shardId :: Maybe Text
$sel:shardId:Shard' :: Shard -> Maybe Text
shardId} -> Maybe Text
shardId) (\s :: Shard
s@Shard' {} Maybe Text
a -> Shard
s {$sel:shardId:Shard' :: Maybe Text
shardId = Maybe Text
a} :: Shard)
instance Core.FromJSON Shard where
parseJSON :: Value -> Parser Shard
parseJSON =
String -> (Object -> Parser Shard) -> Value -> Parser Shard
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Shard"
( \Object
x ->
Maybe Text -> Maybe SequenceNumberRange -> Maybe Text -> Shard
Shard'
(Maybe Text -> Maybe SequenceNumberRange -> Maybe Text -> Shard)
-> Parser (Maybe Text)
-> Parser (Maybe SequenceNumberRange -> Maybe Text -> Shard)
forall (f :: * -> *) a b. Functor 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
"ParentShardId")
Parser (Maybe SequenceNumberRange -> Maybe Text -> Shard)
-> Parser (Maybe SequenceNumberRange)
-> Parser (Maybe Text -> Shard)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SequenceNumberRange)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SequenceNumberRange")
Parser (Maybe Text -> Shard) -> Parser (Maybe Text) -> Parser Shard
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
"ShardId")
)
instance Prelude.Hashable Shard
instance Prelude.NFData Shard