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