{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.MemoryDb.Types.ShardConfigurationRequest
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MemoryDb.Types.ShardConfigurationRequest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A request to configure the sharding properties of a cluster
--
-- /See:/ 'newShardConfigurationRequest' smart constructor.
data ShardConfigurationRequest = ShardConfigurationRequest'
  { -- | The number of shards in the cluster
    ShardConfigurationRequest -> Maybe Int
shardCount :: Prelude.Maybe Prelude.Int
  }
  deriving (ShardConfigurationRequest -> ShardConfigurationRequest -> Bool
(ShardConfigurationRequest -> ShardConfigurationRequest -> Bool)
-> (ShardConfigurationRequest -> ShardConfigurationRequest -> Bool)
-> Eq ShardConfigurationRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ShardConfigurationRequest -> ShardConfigurationRequest -> Bool
$c/= :: ShardConfigurationRequest -> ShardConfigurationRequest -> Bool
== :: ShardConfigurationRequest -> ShardConfigurationRequest -> Bool
$c== :: ShardConfigurationRequest -> ShardConfigurationRequest -> Bool
Prelude.Eq, ReadPrec [ShardConfigurationRequest]
ReadPrec ShardConfigurationRequest
Int -> ReadS ShardConfigurationRequest
ReadS [ShardConfigurationRequest]
(Int -> ReadS ShardConfigurationRequest)
-> ReadS [ShardConfigurationRequest]
-> ReadPrec ShardConfigurationRequest
-> ReadPrec [ShardConfigurationRequest]
-> Read ShardConfigurationRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ShardConfigurationRequest]
$creadListPrec :: ReadPrec [ShardConfigurationRequest]
readPrec :: ReadPrec ShardConfigurationRequest
$creadPrec :: ReadPrec ShardConfigurationRequest
readList :: ReadS [ShardConfigurationRequest]
$creadList :: ReadS [ShardConfigurationRequest]
readsPrec :: Int -> ReadS ShardConfigurationRequest
$creadsPrec :: Int -> ReadS ShardConfigurationRequest
Prelude.Read, Int -> ShardConfigurationRequest -> ShowS
[ShardConfigurationRequest] -> ShowS
ShardConfigurationRequest -> String
(Int -> ShardConfigurationRequest -> ShowS)
-> (ShardConfigurationRequest -> String)
-> ([ShardConfigurationRequest] -> ShowS)
-> Show ShardConfigurationRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ShardConfigurationRequest] -> ShowS
$cshowList :: [ShardConfigurationRequest] -> ShowS
show :: ShardConfigurationRequest -> String
$cshow :: ShardConfigurationRequest -> String
showsPrec :: Int -> ShardConfigurationRequest -> ShowS
$cshowsPrec :: Int -> ShardConfigurationRequest -> ShowS
Prelude.Show, (forall x.
 ShardConfigurationRequest -> Rep ShardConfigurationRequest x)
-> (forall x.
    Rep ShardConfigurationRequest x -> ShardConfigurationRequest)
-> Generic ShardConfigurationRequest
forall x.
Rep ShardConfigurationRequest x -> ShardConfigurationRequest
forall x.
ShardConfigurationRequest -> Rep ShardConfigurationRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ShardConfigurationRequest x -> ShardConfigurationRequest
$cfrom :: forall x.
ShardConfigurationRequest -> Rep ShardConfigurationRequest x
Prelude.Generic)

-- |
-- Create a value of 'ShardConfigurationRequest' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'shardCount', 'shardConfigurationRequest_shardCount' - The number of shards in the cluster
newShardConfigurationRequest ::
  ShardConfigurationRequest
newShardConfigurationRequest :: ShardConfigurationRequest
newShardConfigurationRequest =
  ShardConfigurationRequest' :: Maybe Int -> ShardConfigurationRequest
ShardConfigurationRequest'
    { $sel:shardCount:ShardConfigurationRequest' :: Maybe Int
shardCount =
        Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of shards in the cluster
shardConfigurationRequest_shardCount :: Lens.Lens' ShardConfigurationRequest (Prelude.Maybe Prelude.Int)
shardConfigurationRequest_shardCount :: (Maybe Int -> f (Maybe Int))
-> ShardConfigurationRequest -> f ShardConfigurationRequest
shardConfigurationRequest_shardCount = (ShardConfigurationRequest -> Maybe Int)
-> (ShardConfigurationRequest
    -> Maybe Int -> ShardConfigurationRequest)
-> Lens
     ShardConfigurationRequest
     ShardConfigurationRequest
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ShardConfigurationRequest' {Maybe Int
shardCount :: Maybe Int
$sel:shardCount:ShardConfigurationRequest' :: ShardConfigurationRequest -> Maybe Int
shardCount} -> Maybe Int
shardCount) (\s :: ShardConfigurationRequest
s@ShardConfigurationRequest' {} Maybe Int
a -> ShardConfigurationRequest
s {$sel:shardCount:ShardConfigurationRequest' :: Maybe Int
shardCount = Maybe Int
a} :: ShardConfigurationRequest)

instance Prelude.Hashable ShardConfigurationRequest

instance Prelude.NFData ShardConfigurationRequest

instance Core.ToJSON ShardConfigurationRequest where
  toJSON :: ShardConfigurationRequest -> Value
toJSON ShardConfigurationRequest' {Maybe Int
shardCount :: Maybe Int
$sel:shardCount:ShardConfigurationRequest' :: ShardConfigurationRequest -> Maybe Int
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"ShardCount" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
shardCount]
      )