{-# 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.ChildShard where
import qualified Amazonka.Core as Core
import Amazonka.Kinesis.Types.HashKeyRange
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ChildShard = ChildShard'
{ ChildShard -> Text
shardId :: Prelude.Text,
ChildShard -> [Text]
parentShards :: [Prelude.Text],
ChildShard -> HashKeyRange
hashKeyRange :: HashKeyRange
}
deriving (ChildShard -> ChildShard -> Bool
(ChildShard -> ChildShard -> Bool)
-> (ChildShard -> ChildShard -> Bool) -> Eq ChildShard
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChildShard -> ChildShard -> Bool
$c/= :: ChildShard -> ChildShard -> Bool
== :: ChildShard -> ChildShard -> Bool
$c== :: ChildShard -> ChildShard -> Bool
Prelude.Eq, ReadPrec [ChildShard]
ReadPrec ChildShard
Int -> ReadS ChildShard
ReadS [ChildShard]
(Int -> ReadS ChildShard)
-> ReadS [ChildShard]
-> ReadPrec ChildShard
-> ReadPrec [ChildShard]
-> Read ChildShard
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChildShard]
$creadListPrec :: ReadPrec [ChildShard]
readPrec :: ReadPrec ChildShard
$creadPrec :: ReadPrec ChildShard
readList :: ReadS [ChildShard]
$creadList :: ReadS [ChildShard]
readsPrec :: Int -> ReadS ChildShard
$creadsPrec :: Int -> ReadS ChildShard
Prelude.Read, Int -> ChildShard -> ShowS
[ChildShard] -> ShowS
ChildShard -> String
(Int -> ChildShard -> ShowS)
-> (ChildShard -> String)
-> ([ChildShard] -> ShowS)
-> Show ChildShard
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChildShard] -> ShowS
$cshowList :: [ChildShard] -> ShowS
show :: ChildShard -> String
$cshow :: ChildShard -> String
showsPrec :: Int -> ChildShard -> ShowS
$cshowsPrec :: Int -> ChildShard -> ShowS
Prelude.Show, (forall x. ChildShard -> Rep ChildShard x)
-> (forall x. Rep ChildShard x -> ChildShard) -> Generic ChildShard
forall x. Rep ChildShard x -> ChildShard
forall x. ChildShard -> Rep ChildShard x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChildShard x -> ChildShard
$cfrom :: forall x. ChildShard -> Rep ChildShard x
Prelude.Generic)
newChildShard ::
Prelude.Text ->
HashKeyRange ->
ChildShard
newChildShard :: Text -> HashKeyRange -> ChildShard
newChildShard Text
pShardId_ HashKeyRange
pHashKeyRange_ =
ChildShard' :: Text -> [Text] -> HashKeyRange -> ChildShard
ChildShard'
{ $sel:shardId:ChildShard' :: Text
shardId = Text
pShardId_,
$sel:parentShards:ChildShard' :: [Text]
parentShards = [Text]
forall a. Monoid a => a
Prelude.mempty,
$sel:hashKeyRange:ChildShard' :: HashKeyRange
hashKeyRange = HashKeyRange
pHashKeyRange_
}
childShard_shardId :: Lens.Lens' ChildShard Prelude.Text
childShard_shardId :: (Text -> f Text) -> ChildShard -> f ChildShard
childShard_shardId = (ChildShard -> Text)
-> (ChildShard -> Text -> ChildShard)
-> Lens ChildShard ChildShard Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChildShard' {Text
shardId :: Text
$sel:shardId:ChildShard' :: ChildShard -> Text
shardId} -> Text
shardId) (\s :: ChildShard
s@ChildShard' {} Text
a -> ChildShard
s {$sel:shardId:ChildShard' :: Text
shardId = Text
a} :: ChildShard)
childShard_parentShards :: Lens.Lens' ChildShard [Prelude.Text]
childShard_parentShards :: ([Text] -> f [Text]) -> ChildShard -> f ChildShard
childShard_parentShards = (ChildShard -> [Text])
-> (ChildShard -> [Text] -> ChildShard)
-> Lens ChildShard ChildShard [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChildShard' {[Text]
parentShards :: [Text]
$sel:parentShards:ChildShard' :: ChildShard -> [Text]
parentShards} -> [Text]
parentShards) (\s :: ChildShard
s@ChildShard' {} [Text]
a -> ChildShard
s {$sel:parentShards:ChildShard' :: [Text]
parentShards = [Text]
a} :: ChildShard) (([Text] -> f [Text]) -> ChildShard -> f ChildShard)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> ChildShard
-> f ChildShard
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
childShard_hashKeyRange :: Lens.Lens' ChildShard HashKeyRange
childShard_hashKeyRange :: (HashKeyRange -> f HashKeyRange) -> ChildShard -> f ChildShard
childShard_hashKeyRange = (ChildShard -> HashKeyRange)
-> (ChildShard -> HashKeyRange -> ChildShard)
-> Lens ChildShard ChildShard HashKeyRange HashKeyRange
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChildShard' {HashKeyRange
hashKeyRange :: HashKeyRange
$sel:hashKeyRange:ChildShard' :: ChildShard -> HashKeyRange
hashKeyRange} -> HashKeyRange
hashKeyRange) (\s :: ChildShard
s@ChildShard' {} HashKeyRange
a -> ChildShard
s {$sel:hashKeyRange:ChildShard' :: HashKeyRange
hashKeyRange = HashKeyRange
a} :: ChildShard)
instance Core.FromJSON ChildShard where
parseJSON :: Value -> Parser ChildShard
parseJSON =
String
-> (Object -> Parser ChildShard) -> Value -> Parser ChildShard
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ChildShard"
( \Object
x ->
Text -> [Text] -> HashKeyRange -> ChildShard
ChildShard'
(Text -> [Text] -> HashKeyRange -> ChildShard)
-> Parser Text -> Parser ([Text] -> HashKeyRange -> ChildShard)
forall (f :: * -> *) a b. Functor 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 ([Text] -> HashKeyRange -> ChildShard)
-> Parser [Text] -> Parser (HashKeyRange -> ChildShard)
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
"ParentShards" Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty)
Parser (HashKeyRange -> ChildShard)
-> Parser HashKeyRange -> Parser ChildShard
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")
)
instance Prelude.Hashable ChildShard
instance Prelude.NFData ChildShard