{-# 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.Shard where
import qualified Amazonka.Core as Core
import Amazonka.Kinesis.Types.HashKeyRange
import Amazonka.Kinesis.Types.SequenceNumberRange
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Shard = Shard'
{
Shard -> Maybe Text
adjacentParentShardId :: Prelude.Maybe Prelude.Text,
Shard -> Maybe Text
parentShardId :: Prelude.Maybe Prelude.Text,
Shard -> Text
shardId :: Prelude.Text,
Shard -> HashKeyRange
hashKeyRange :: HashKeyRange,
Shard -> SequenceNumberRange
sequenceNumberRange :: SequenceNumberRange
}
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 ::
Prelude.Text ->
HashKeyRange ->
SequenceNumberRange ->
Shard
newShard :: Text -> HashKeyRange -> SequenceNumberRange -> Shard
newShard
Text
pShardId_
HashKeyRange
pHashKeyRange_
SequenceNumberRange
pSequenceNumberRange_ =
Shard' :: Maybe Text
-> Maybe Text
-> Text
-> HashKeyRange
-> SequenceNumberRange
-> Shard
Shard'
{ $sel:adjacentParentShardId:Shard' :: Maybe Text
adjacentParentShardId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:parentShardId:Shard' :: Maybe Text
parentShardId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:shardId:Shard' :: Text
shardId = Text
pShardId_,
$sel:hashKeyRange:Shard' :: HashKeyRange
hashKeyRange = HashKeyRange
pHashKeyRange_,
$sel:sequenceNumberRange:Shard' :: SequenceNumberRange
sequenceNumberRange = SequenceNumberRange
pSequenceNumberRange_
}
shard_adjacentParentShardId :: Lens.Lens' Shard (Prelude.Maybe Prelude.Text)
shard_adjacentParentShardId :: (Maybe Text -> f (Maybe Text)) -> Shard -> f Shard
shard_adjacentParentShardId = (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
adjacentParentShardId :: Maybe Text
$sel:adjacentParentShardId:Shard' :: Shard -> Maybe Text
adjacentParentShardId} -> Maybe Text
adjacentParentShardId) (\s :: Shard
s@Shard' {} Maybe Text
a -> Shard
s {$sel:adjacentParentShardId:Shard' :: Maybe Text
adjacentParentShardId = Maybe Text
a} :: Shard)
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_shardId :: Lens.Lens' Shard Prelude.Text
shard_shardId :: (Text -> f Text) -> Shard -> f Shard
shard_shardId = (Shard -> Text)
-> (Shard -> Text -> Shard) -> Lens Shard Shard Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Shard' {Text
shardId :: Text
$sel:shardId:Shard' :: Shard -> Text
shardId} -> Text
shardId) (\s :: Shard
s@Shard' {} Text
a -> Shard
s {$sel:shardId:Shard' :: Text
shardId = Text
a} :: Shard)
shard_hashKeyRange :: Lens.Lens' Shard HashKeyRange
shard_hashKeyRange :: (HashKeyRange -> f HashKeyRange) -> Shard -> f Shard
shard_hashKeyRange = (Shard -> HashKeyRange)
-> (Shard -> HashKeyRange -> Shard)
-> Lens Shard Shard HashKeyRange HashKeyRange
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Shard' {HashKeyRange
hashKeyRange :: HashKeyRange
$sel:hashKeyRange:Shard' :: Shard -> HashKeyRange
hashKeyRange} -> HashKeyRange
hashKeyRange) (\s :: Shard
s@Shard' {} HashKeyRange
a -> Shard
s {$sel:hashKeyRange:Shard' :: HashKeyRange
hashKeyRange = HashKeyRange
a} :: Shard)
shard_sequenceNumberRange :: Lens.Lens' Shard SequenceNumberRange
shard_sequenceNumberRange :: (SequenceNumberRange -> f SequenceNumberRange) -> Shard -> f Shard
shard_sequenceNumberRange = (Shard -> SequenceNumberRange)
-> (Shard -> SequenceNumberRange -> Shard)
-> Lens Shard Shard SequenceNumberRange SequenceNumberRange
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Shard' {SequenceNumberRange
sequenceNumberRange :: SequenceNumberRange
$sel:sequenceNumberRange:Shard' :: Shard -> SequenceNumberRange
sequenceNumberRange} -> SequenceNumberRange
sequenceNumberRange) (\s :: Shard
s@Shard' {} SequenceNumberRange
a -> Shard
s {$sel:sequenceNumberRange:Shard' :: SequenceNumberRange
sequenceNumberRange = SequenceNumberRange
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 Text
-> Text
-> HashKeyRange
-> SequenceNumberRange
-> Shard
Shard'
(Maybe Text
-> Maybe Text
-> Text
-> HashKeyRange
-> SequenceNumberRange
-> Shard)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Text -> HashKeyRange -> SequenceNumberRange -> 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
"AdjacentParentShardId")
Parser
(Maybe Text
-> Text -> HashKeyRange -> SequenceNumberRange -> Shard)
-> Parser (Maybe Text)
-> Parser (Text -> HashKeyRange -> SequenceNumberRange -> 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
"ParentShardId")
Parser (Text -> HashKeyRange -> SequenceNumberRange -> Shard)
-> Parser Text
-> Parser (HashKeyRange -> SequenceNumberRange -> Shard)
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
"ShardId")
Parser (HashKeyRange -> SequenceNumberRange -> Shard)
-> Parser HashKeyRange -> Parser (SequenceNumberRange -> Shard)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser HashKeyRange
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"HashKeyRange")
Parser (SequenceNumberRange -> Shard)
-> Parser SequenceNumberRange -> Parser Shard
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser SequenceNumberRange
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SequenceNumberRange")
)
instance Prelude.Hashable Shard
instance Prelude.NFData Shard