{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

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

-- |
-- Module      : Amazonka.ElastiCache.ModifyReplicationGroupShardConfiguration
-- 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)
--
-- Modifies a replication group\'s shards (node groups) by allowing you to
-- add shards, remove shards, or rebalance the keyspaces among existing
-- shards.
module Amazonka.ElastiCache.ModifyReplicationGroupShardConfiguration
  ( -- * Creating a Request
    ModifyReplicationGroupShardConfiguration (..),
    newModifyReplicationGroupShardConfiguration,

    -- * Request Lenses
    modifyReplicationGroupShardConfiguration_nodeGroupsToRetain,
    modifyReplicationGroupShardConfiguration_reshardingConfiguration,
    modifyReplicationGroupShardConfiguration_nodeGroupsToRemove,
    modifyReplicationGroupShardConfiguration_replicationGroupId,
    modifyReplicationGroupShardConfiguration_nodeGroupCount,
    modifyReplicationGroupShardConfiguration_applyImmediately,

    -- * Destructuring the Response
    ModifyReplicationGroupShardConfigurationResponse (..),
    newModifyReplicationGroupShardConfigurationResponse,

    -- * Response Lenses
    modifyReplicationGroupShardConfigurationResponse_replicationGroup,
    modifyReplicationGroupShardConfigurationResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ElastiCache.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Represents the input for a @ModifyReplicationGroupShardConfiguration@
-- operation.
--
-- /See:/ 'newModifyReplicationGroupShardConfiguration' smart constructor.
data ModifyReplicationGroupShardConfiguration = ModifyReplicationGroupShardConfiguration'
  { -- | If the value of @NodeGroupCount@ is less than the current number of node
    -- groups (shards), then either @NodeGroupsToRemove@ or
    -- @NodeGroupsToRetain@ is required. @NodeGroupsToRetain@ is a list of
    -- @NodeGroupId@s to retain in the cluster.
    --
    -- ElastiCache for Redis will attempt to remove all node groups except
    -- those listed by @NodeGroupsToRetain@ from the cluster.
    ModifyReplicationGroupShardConfiguration -> Maybe [Text]
nodeGroupsToRetain :: Prelude.Maybe [Prelude.Text],
    -- | Specifies the preferred availability zones for each node group in the
    -- cluster. If the value of @NodeGroupCount@ is greater than the current
    -- number of node groups (shards), you can use this parameter to specify
    -- the preferred availability zones of the cluster\'s shards. If you omit
    -- this parameter ElastiCache selects availability zones for you.
    --
    -- You can specify this parameter only if the value of @NodeGroupCount@ is
    -- greater than the current number of node groups (shards).
    ModifyReplicationGroupShardConfiguration
-> Maybe [ReshardingConfiguration]
reshardingConfiguration :: Prelude.Maybe [ReshardingConfiguration],
    -- | If the value of @NodeGroupCount@ is less than the current number of node
    -- groups (shards), then either @NodeGroupsToRemove@ or
    -- @NodeGroupsToRetain@ is required. @NodeGroupsToRemove@ is a list of
    -- @NodeGroupId@s to remove from the cluster.
    --
    -- ElastiCache for Redis will attempt to remove all node groups listed by
    -- @NodeGroupsToRemove@ from the cluster.
    ModifyReplicationGroupShardConfiguration -> Maybe [Text]
nodeGroupsToRemove :: Prelude.Maybe [Prelude.Text],
    -- | The name of the Redis (cluster mode enabled) cluster (replication group)
    -- on which the shards are to be configured.
    ModifyReplicationGroupShardConfiguration -> Text
replicationGroupId :: Prelude.Text,
    -- | The number of node groups (shards) that results from the modification of
    -- the shard configuration.
    ModifyReplicationGroupShardConfiguration -> Int
nodeGroupCount :: Prelude.Int,
    -- | Indicates that the shard reconfiguration process begins immediately. At
    -- present, the only permitted value for this parameter is @true@.
    --
    -- Value: true
    ModifyReplicationGroupShardConfiguration -> Bool
applyImmediately :: Prelude.Bool
  }
  deriving (ModifyReplicationGroupShardConfiguration
-> ModifyReplicationGroupShardConfiguration -> Bool
(ModifyReplicationGroupShardConfiguration
 -> ModifyReplicationGroupShardConfiguration -> Bool)
-> (ModifyReplicationGroupShardConfiguration
    -> ModifyReplicationGroupShardConfiguration -> Bool)
-> Eq ModifyReplicationGroupShardConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyReplicationGroupShardConfiguration
-> ModifyReplicationGroupShardConfiguration -> Bool
$c/= :: ModifyReplicationGroupShardConfiguration
-> ModifyReplicationGroupShardConfiguration -> Bool
== :: ModifyReplicationGroupShardConfiguration
-> ModifyReplicationGroupShardConfiguration -> Bool
$c== :: ModifyReplicationGroupShardConfiguration
-> ModifyReplicationGroupShardConfiguration -> Bool
Prelude.Eq, ReadPrec [ModifyReplicationGroupShardConfiguration]
ReadPrec ModifyReplicationGroupShardConfiguration
Int -> ReadS ModifyReplicationGroupShardConfiguration
ReadS [ModifyReplicationGroupShardConfiguration]
(Int -> ReadS ModifyReplicationGroupShardConfiguration)
-> ReadS [ModifyReplicationGroupShardConfiguration]
-> ReadPrec ModifyReplicationGroupShardConfiguration
-> ReadPrec [ModifyReplicationGroupShardConfiguration]
-> Read ModifyReplicationGroupShardConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyReplicationGroupShardConfiguration]
$creadListPrec :: ReadPrec [ModifyReplicationGroupShardConfiguration]
readPrec :: ReadPrec ModifyReplicationGroupShardConfiguration
$creadPrec :: ReadPrec ModifyReplicationGroupShardConfiguration
readList :: ReadS [ModifyReplicationGroupShardConfiguration]
$creadList :: ReadS [ModifyReplicationGroupShardConfiguration]
readsPrec :: Int -> ReadS ModifyReplicationGroupShardConfiguration
$creadsPrec :: Int -> ReadS ModifyReplicationGroupShardConfiguration
Prelude.Read, Int -> ModifyReplicationGroupShardConfiguration -> ShowS
[ModifyReplicationGroupShardConfiguration] -> ShowS
ModifyReplicationGroupShardConfiguration -> String
(Int -> ModifyReplicationGroupShardConfiguration -> ShowS)
-> (ModifyReplicationGroupShardConfiguration -> String)
-> ([ModifyReplicationGroupShardConfiguration] -> ShowS)
-> Show ModifyReplicationGroupShardConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyReplicationGroupShardConfiguration] -> ShowS
$cshowList :: [ModifyReplicationGroupShardConfiguration] -> ShowS
show :: ModifyReplicationGroupShardConfiguration -> String
$cshow :: ModifyReplicationGroupShardConfiguration -> String
showsPrec :: Int -> ModifyReplicationGroupShardConfiguration -> ShowS
$cshowsPrec :: Int -> ModifyReplicationGroupShardConfiguration -> ShowS
Prelude.Show, (forall x.
 ModifyReplicationGroupShardConfiguration
 -> Rep ModifyReplicationGroupShardConfiguration x)
-> (forall x.
    Rep ModifyReplicationGroupShardConfiguration x
    -> ModifyReplicationGroupShardConfiguration)
-> Generic ModifyReplicationGroupShardConfiguration
forall x.
Rep ModifyReplicationGroupShardConfiguration x
-> ModifyReplicationGroupShardConfiguration
forall x.
ModifyReplicationGroupShardConfiguration
-> Rep ModifyReplicationGroupShardConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ModifyReplicationGroupShardConfiguration x
-> ModifyReplicationGroupShardConfiguration
$cfrom :: forall x.
ModifyReplicationGroupShardConfiguration
-> Rep ModifyReplicationGroupShardConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ModifyReplicationGroupShardConfiguration' 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:
--
-- 'nodeGroupsToRetain', 'modifyReplicationGroupShardConfiguration_nodeGroupsToRetain' - If the value of @NodeGroupCount@ is less than the current number of node
-- groups (shards), then either @NodeGroupsToRemove@ or
-- @NodeGroupsToRetain@ is required. @NodeGroupsToRetain@ is a list of
-- @NodeGroupId@s to retain in the cluster.
--
-- ElastiCache for Redis will attempt to remove all node groups except
-- those listed by @NodeGroupsToRetain@ from the cluster.
--
-- 'reshardingConfiguration', 'modifyReplicationGroupShardConfiguration_reshardingConfiguration' - Specifies the preferred availability zones for each node group in the
-- cluster. If the value of @NodeGroupCount@ is greater than the current
-- number of node groups (shards), you can use this parameter to specify
-- the preferred availability zones of the cluster\'s shards. If you omit
-- this parameter ElastiCache selects availability zones for you.
--
-- You can specify this parameter only if the value of @NodeGroupCount@ is
-- greater than the current number of node groups (shards).
--
-- 'nodeGroupsToRemove', 'modifyReplicationGroupShardConfiguration_nodeGroupsToRemove' - If the value of @NodeGroupCount@ is less than the current number of node
-- groups (shards), then either @NodeGroupsToRemove@ or
-- @NodeGroupsToRetain@ is required. @NodeGroupsToRemove@ is a list of
-- @NodeGroupId@s to remove from the cluster.
--
-- ElastiCache for Redis will attempt to remove all node groups listed by
-- @NodeGroupsToRemove@ from the cluster.
--
-- 'replicationGroupId', 'modifyReplicationGroupShardConfiguration_replicationGroupId' - The name of the Redis (cluster mode enabled) cluster (replication group)
-- on which the shards are to be configured.
--
-- 'nodeGroupCount', 'modifyReplicationGroupShardConfiguration_nodeGroupCount' - The number of node groups (shards) that results from the modification of
-- the shard configuration.
--
-- 'applyImmediately', 'modifyReplicationGroupShardConfiguration_applyImmediately' - Indicates that the shard reconfiguration process begins immediately. At
-- present, the only permitted value for this parameter is @true@.
--
-- Value: true
newModifyReplicationGroupShardConfiguration ::
  -- | 'replicationGroupId'
  Prelude.Text ->
  -- | 'nodeGroupCount'
  Prelude.Int ->
  -- | 'applyImmediately'
  Prelude.Bool ->
  ModifyReplicationGroupShardConfiguration
newModifyReplicationGroupShardConfiguration :: Text -> Int -> Bool -> ModifyReplicationGroupShardConfiguration
newModifyReplicationGroupShardConfiguration
  Text
pReplicationGroupId_
  Int
pNodeGroupCount_
  Bool
pApplyImmediately_ =
    ModifyReplicationGroupShardConfiguration' :: Maybe [Text]
-> Maybe [ReshardingConfiguration]
-> Maybe [Text]
-> Text
-> Int
-> Bool
-> ModifyReplicationGroupShardConfiguration
ModifyReplicationGroupShardConfiguration'
      { $sel:nodeGroupsToRetain:ModifyReplicationGroupShardConfiguration' :: Maybe [Text]
nodeGroupsToRetain =
          Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:reshardingConfiguration:ModifyReplicationGroupShardConfiguration' :: Maybe [ReshardingConfiguration]
reshardingConfiguration =
          Maybe [ReshardingConfiguration]
forall a. Maybe a
Prelude.Nothing,
        $sel:nodeGroupsToRemove:ModifyReplicationGroupShardConfiguration' :: Maybe [Text]
nodeGroupsToRemove =
          Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:replicationGroupId:ModifyReplicationGroupShardConfiguration' :: Text
replicationGroupId =
          Text
pReplicationGroupId_,
        $sel:nodeGroupCount:ModifyReplicationGroupShardConfiguration' :: Int
nodeGroupCount = Int
pNodeGroupCount_,
        $sel:applyImmediately:ModifyReplicationGroupShardConfiguration' :: Bool
applyImmediately =
          Bool
pApplyImmediately_
      }

-- | If the value of @NodeGroupCount@ is less than the current number of node
-- groups (shards), then either @NodeGroupsToRemove@ or
-- @NodeGroupsToRetain@ is required. @NodeGroupsToRetain@ is a list of
-- @NodeGroupId@s to retain in the cluster.
--
-- ElastiCache for Redis will attempt to remove all node groups except
-- those listed by @NodeGroupsToRetain@ from the cluster.
modifyReplicationGroupShardConfiguration_nodeGroupsToRetain :: Lens.Lens' ModifyReplicationGroupShardConfiguration (Prelude.Maybe [Prelude.Text])
modifyReplicationGroupShardConfiguration_nodeGroupsToRetain :: (Maybe [Text] -> f (Maybe [Text]))
-> ModifyReplicationGroupShardConfiguration
-> f ModifyReplicationGroupShardConfiguration
modifyReplicationGroupShardConfiguration_nodeGroupsToRetain = (ModifyReplicationGroupShardConfiguration -> Maybe [Text])
-> (ModifyReplicationGroupShardConfiguration
    -> Maybe [Text] -> ModifyReplicationGroupShardConfiguration)
-> Lens
     ModifyReplicationGroupShardConfiguration
     ModifyReplicationGroupShardConfiguration
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyReplicationGroupShardConfiguration' {Maybe [Text]
nodeGroupsToRetain :: Maybe [Text]
$sel:nodeGroupsToRetain:ModifyReplicationGroupShardConfiguration' :: ModifyReplicationGroupShardConfiguration -> Maybe [Text]
nodeGroupsToRetain} -> Maybe [Text]
nodeGroupsToRetain) (\s :: ModifyReplicationGroupShardConfiguration
s@ModifyReplicationGroupShardConfiguration' {} Maybe [Text]
a -> ModifyReplicationGroupShardConfiguration
s {$sel:nodeGroupsToRetain:ModifyReplicationGroupShardConfiguration' :: Maybe [Text]
nodeGroupsToRetain = Maybe [Text]
a} :: ModifyReplicationGroupShardConfiguration) ((Maybe [Text] -> f (Maybe [Text]))
 -> ModifyReplicationGroupShardConfiguration
 -> f ModifyReplicationGroupShardConfiguration)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ModifyReplicationGroupShardConfiguration
-> f ModifyReplicationGroupShardConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies the preferred availability zones for each node group in the
-- cluster. If the value of @NodeGroupCount@ is greater than the current
-- number of node groups (shards), you can use this parameter to specify
-- the preferred availability zones of the cluster\'s shards. If you omit
-- this parameter ElastiCache selects availability zones for you.
--
-- You can specify this parameter only if the value of @NodeGroupCount@ is
-- greater than the current number of node groups (shards).
modifyReplicationGroupShardConfiguration_reshardingConfiguration :: Lens.Lens' ModifyReplicationGroupShardConfiguration (Prelude.Maybe [ReshardingConfiguration])
modifyReplicationGroupShardConfiguration_reshardingConfiguration :: (Maybe [ReshardingConfiguration]
 -> f (Maybe [ReshardingConfiguration]))
-> ModifyReplicationGroupShardConfiguration
-> f ModifyReplicationGroupShardConfiguration
modifyReplicationGroupShardConfiguration_reshardingConfiguration = (ModifyReplicationGroupShardConfiguration
 -> Maybe [ReshardingConfiguration])
-> (ModifyReplicationGroupShardConfiguration
    -> Maybe [ReshardingConfiguration]
    -> ModifyReplicationGroupShardConfiguration)
-> Lens
     ModifyReplicationGroupShardConfiguration
     ModifyReplicationGroupShardConfiguration
     (Maybe [ReshardingConfiguration])
     (Maybe [ReshardingConfiguration])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyReplicationGroupShardConfiguration' {Maybe [ReshardingConfiguration]
reshardingConfiguration :: Maybe [ReshardingConfiguration]
$sel:reshardingConfiguration:ModifyReplicationGroupShardConfiguration' :: ModifyReplicationGroupShardConfiguration
-> Maybe [ReshardingConfiguration]
reshardingConfiguration} -> Maybe [ReshardingConfiguration]
reshardingConfiguration) (\s :: ModifyReplicationGroupShardConfiguration
s@ModifyReplicationGroupShardConfiguration' {} Maybe [ReshardingConfiguration]
a -> ModifyReplicationGroupShardConfiguration
s {$sel:reshardingConfiguration:ModifyReplicationGroupShardConfiguration' :: Maybe [ReshardingConfiguration]
reshardingConfiguration = Maybe [ReshardingConfiguration]
a} :: ModifyReplicationGroupShardConfiguration) ((Maybe [ReshardingConfiguration]
  -> f (Maybe [ReshardingConfiguration]))
 -> ModifyReplicationGroupShardConfiguration
 -> f ModifyReplicationGroupShardConfiguration)
-> ((Maybe [ReshardingConfiguration]
     -> f (Maybe [ReshardingConfiguration]))
    -> Maybe [ReshardingConfiguration]
    -> f (Maybe [ReshardingConfiguration]))
-> (Maybe [ReshardingConfiguration]
    -> f (Maybe [ReshardingConfiguration]))
-> ModifyReplicationGroupShardConfiguration
-> f ModifyReplicationGroupShardConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ReshardingConfiguration]
  [ReshardingConfiguration]
  [ReshardingConfiguration]
  [ReshardingConfiguration]
-> Iso
     (Maybe [ReshardingConfiguration])
     (Maybe [ReshardingConfiguration])
     (Maybe [ReshardingConfiguration])
     (Maybe [ReshardingConfiguration])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [ReshardingConfiguration]
  [ReshardingConfiguration]
  [ReshardingConfiguration]
  [ReshardingConfiguration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If the value of @NodeGroupCount@ is less than the current number of node
-- groups (shards), then either @NodeGroupsToRemove@ or
-- @NodeGroupsToRetain@ is required. @NodeGroupsToRemove@ is a list of
-- @NodeGroupId@s to remove from the cluster.
--
-- ElastiCache for Redis will attempt to remove all node groups listed by
-- @NodeGroupsToRemove@ from the cluster.
modifyReplicationGroupShardConfiguration_nodeGroupsToRemove :: Lens.Lens' ModifyReplicationGroupShardConfiguration (Prelude.Maybe [Prelude.Text])
modifyReplicationGroupShardConfiguration_nodeGroupsToRemove :: (Maybe [Text] -> f (Maybe [Text]))
-> ModifyReplicationGroupShardConfiguration
-> f ModifyReplicationGroupShardConfiguration
modifyReplicationGroupShardConfiguration_nodeGroupsToRemove = (ModifyReplicationGroupShardConfiguration -> Maybe [Text])
-> (ModifyReplicationGroupShardConfiguration
    -> Maybe [Text] -> ModifyReplicationGroupShardConfiguration)
-> Lens
     ModifyReplicationGroupShardConfiguration
     ModifyReplicationGroupShardConfiguration
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyReplicationGroupShardConfiguration' {Maybe [Text]
nodeGroupsToRemove :: Maybe [Text]
$sel:nodeGroupsToRemove:ModifyReplicationGroupShardConfiguration' :: ModifyReplicationGroupShardConfiguration -> Maybe [Text]
nodeGroupsToRemove} -> Maybe [Text]
nodeGroupsToRemove) (\s :: ModifyReplicationGroupShardConfiguration
s@ModifyReplicationGroupShardConfiguration' {} Maybe [Text]
a -> ModifyReplicationGroupShardConfiguration
s {$sel:nodeGroupsToRemove:ModifyReplicationGroupShardConfiguration' :: Maybe [Text]
nodeGroupsToRemove = Maybe [Text]
a} :: ModifyReplicationGroupShardConfiguration) ((Maybe [Text] -> f (Maybe [Text]))
 -> ModifyReplicationGroupShardConfiguration
 -> f ModifyReplicationGroupShardConfiguration)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ModifyReplicationGroupShardConfiguration
-> f ModifyReplicationGroupShardConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the Redis (cluster mode enabled) cluster (replication group)
-- on which the shards are to be configured.
modifyReplicationGroupShardConfiguration_replicationGroupId :: Lens.Lens' ModifyReplicationGroupShardConfiguration Prelude.Text
modifyReplicationGroupShardConfiguration_replicationGroupId :: (Text -> f Text)
-> ModifyReplicationGroupShardConfiguration
-> f ModifyReplicationGroupShardConfiguration
modifyReplicationGroupShardConfiguration_replicationGroupId = (ModifyReplicationGroupShardConfiguration -> Text)
-> (ModifyReplicationGroupShardConfiguration
    -> Text -> ModifyReplicationGroupShardConfiguration)
-> Lens
     ModifyReplicationGroupShardConfiguration
     ModifyReplicationGroupShardConfiguration
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyReplicationGroupShardConfiguration' {Text
replicationGroupId :: Text
$sel:replicationGroupId:ModifyReplicationGroupShardConfiguration' :: ModifyReplicationGroupShardConfiguration -> Text
replicationGroupId} -> Text
replicationGroupId) (\s :: ModifyReplicationGroupShardConfiguration
s@ModifyReplicationGroupShardConfiguration' {} Text
a -> ModifyReplicationGroupShardConfiguration
s {$sel:replicationGroupId:ModifyReplicationGroupShardConfiguration' :: Text
replicationGroupId = Text
a} :: ModifyReplicationGroupShardConfiguration)

-- | The number of node groups (shards) that results from the modification of
-- the shard configuration.
modifyReplicationGroupShardConfiguration_nodeGroupCount :: Lens.Lens' ModifyReplicationGroupShardConfiguration Prelude.Int
modifyReplicationGroupShardConfiguration_nodeGroupCount :: (Int -> f Int)
-> ModifyReplicationGroupShardConfiguration
-> f ModifyReplicationGroupShardConfiguration
modifyReplicationGroupShardConfiguration_nodeGroupCount = (ModifyReplicationGroupShardConfiguration -> Int)
-> (ModifyReplicationGroupShardConfiguration
    -> Int -> ModifyReplicationGroupShardConfiguration)
-> Lens
     ModifyReplicationGroupShardConfiguration
     ModifyReplicationGroupShardConfiguration
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyReplicationGroupShardConfiguration' {Int
nodeGroupCount :: Int
$sel:nodeGroupCount:ModifyReplicationGroupShardConfiguration' :: ModifyReplicationGroupShardConfiguration -> Int
nodeGroupCount} -> Int
nodeGroupCount) (\s :: ModifyReplicationGroupShardConfiguration
s@ModifyReplicationGroupShardConfiguration' {} Int
a -> ModifyReplicationGroupShardConfiguration
s {$sel:nodeGroupCount:ModifyReplicationGroupShardConfiguration' :: Int
nodeGroupCount = Int
a} :: ModifyReplicationGroupShardConfiguration)

-- | Indicates that the shard reconfiguration process begins immediately. At
-- present, the only permitted value for this parameter is @true@.
--
-- Value: true
modifyReplicationGroupShardConfiguration_applyImmediately :: Lens.Lens' ModifyReplicationGroupShardConfiguration Prelude.Bool
modifyReplicationGroupShardConfiguration_applyImmediately :: (Bool -> f Bool)
-> ModifyReplicationGroupShardConfiguration
-> f ModifyReplicationGroupShardConfiguration
modifyReplicationGroupShardConfiguration_applyImmediately = (ModifyReplicationGroupShardConfiguration -> Bool)
-> (ModifyReplicationGroupShardConfiguration
    -> Bool -> ModifyReplicationGroupShardConfiguration)
-> Lens
     ModifyReplicationGroupShardConfiguration
     ModifyReplicationGroupShardConfiguration
     Bool
     Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyReplicationGroupShardConfiguration' {Bool
applyImmediately :: Bool
$sel:applyImmediately:ModifyReplicationGroupShardConfiguration' :: ModifyReplicationGroupShardConfiguration -> Bool
applyImmediately} -> Bool
applyImmediately) (\s :: ModifyReplicationGroupShardConfiguration
s@ModifyReplicationGroupShardConfiguration' {} Bool
a -> ModifyReplicationGroupShardConfiguration
s {$sel:applyImmediately:ModifyReplicationGroupShardConfiguration' :: Bool
applyImmediately = Bool
a} :: ModifyReplicationGroupShardConfiguration)

instance
  Core.AWSRequest
    ModifyReplicationGroupShardConfiguration
  where
  type
    AWSResponse
      ModifyReplicationGroupShardConfiguration =
      ModifyReplicationGroupShardConfigurationResponse
  request :: ModifyReplicationGroupShardConfiguration
-> Request ModifyReplicationGroupShardConfiguration
request = Service
-> ModifyReplicationGroupShardConfiguration
-> Request ModifyReplicationGroupShardConfiguration
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy ModifyReplicationGroupShardConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse ModifyReplicationGroupShardConfiguration)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either
         String (AWSResponse ModifyReplicationGroupShardConfiguration))
-> Logger
-> Service
-> Proxy ModifyReplicationGroupShardConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse ModifyReplicationGroupShardConfiguration)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"ModifyReplicationGroupShardConfigurationResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe ReplicationGroup
-> Int -> ModifyReplicationGroupShardConfigurationResponse
ModifyReplicationGroupShardConfigurationResponse'
            (Maybe ReplicationGroup
 -> Int -> ModifyReplicationGroupShardConfigurationResponse)
-> Either String (Maybe ReplicationGroup)
-> Either
     String (Int -> ModifyReplicationGroupShardConfigurationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ReplicationGroup)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ReplicationGroup")
              Either
  String (Int -> ModifyReplicationGroupShardConfigurationResponse)
-> Either String Int
-> Either String ModifyReplicationGroupShardConfigurationResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    ModifyReplicationGroupShardConfiguration

instance
  Prelude.NFData
    ModifyReplicationGroupShardConfiguration

instance
  Core.ToHeaders
    ModifyReplicationGroupShardConfiguration
  where
  toHeaders :: ModifyReplicationGroupShardConfiguration -> ResponseHeaders
toHeaders = ResponseHeaders
-> ModifyReplicationGroupShardConfiguration -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance
  Core.ToPath
    ModifyReplicationGroupShardConfiguration
  where
  toPath :: ModifyReplicationGroupShardConfiguration -> ByteString
toPath = ByteString
-> ModifyReplicationGroupShardConfiguration -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance
  Core.ToQuery
    ModifyReplicationGroupShardConfiguration
  where
  toQuery :: ModifyReplicationGroupShardConfiguration -> QueryString
toQuery ModifyReplicationGroupShardConfiguration' {Bool
Int
Maybe [Text]
Maybe [ReshardingConfiguration]
Text
applyImmediately :: Bool
nodeGroupCount :: Int
replicationGroupId :: Text
nodeGroupsToRemove :: Maybe [Text]
reshardingConfiguration :: Maybe [ReshardingConfiguration]
nodeGroupsToRetain :: Maybe [Text]
$sel:applyImmediately:ModifyReplicationGroupShardConfiguration' :: ModifyReplicationGroupShardConfiguration -> Bool
$sel:nodeGroupCount:ModifyReplicationGroupShardConfiguration' :: ModifyReplicationGroupShardConfiguration -> Int
$sel:replicationGroupId:ModifyReplicationGroupShardConfiguration' :: ModifyReplicationGroupShardConfiguration -> Text
$sel:nodeGroupsToRemove:ModifyReplicationGroupShardConfiguration' :: ModifyReplicationGroupShardConfiguration -> Maybe [Text]
$sel:reshardingConfiguration:ModifyReplicationGroupShardConfiguration' :: ModifyReplicationGroupShardConfiguration
-> Maybe [ReshardingConfiguration]
$sel:nodeGroupsToRetain:ModifyReplicationGroupShardConfiguration' :: ModifyReplicationGroupShardConfiguration -> Maybe [Text]
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ( ByteString
"ModifyReplicationGroupShardConfiguration" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
        ByteString
"NodeGroupsToRetain"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"NodeGroupToRetain"
                ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
nodeGroupsToRetain
            ),
        ByteString
"ReshardingConfiguration"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> [ReshardingConfiguration] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"ReshardingConfiguration"
                ([ReshardingConfiguration] -> QueryString)
-> Maybe [ReshardingConfiguration] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ReshardingConfiguration]
reshardingConfiguration
            ),
        ByteString
"NodeGroupsToRemove"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"NodeGroupToRemove"
                ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
nodeGroupsToRemove
            ),
        ByteString
"ReplicationGroupId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
replicationGroupId,
        ByteString
"NodeGroupCount" ByteString -> Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Int
nodeGroupCount,
        ByteString
"ApplyImmediately" ByteString -> Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Bool
applyImmediately
      ]

-- | /See:/ 'newModifyReplicationGroupShardConfigurationResponse' smart constructor.
data ModifyReplicationGroupShardConfigurationResponse = ModifyReplicationGroupShardConfigurationResponse'
  { ModifyReplicationGroupShardConfigurationResponse
-> Maybe ReplicationGroup
replicationGroup :: Prelude.Maybe ReplicationGroup,
    -- | The response's http status code.
    ModifyReplicationGroupShardConfigurationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ModifyReplicationGroupShardConfigurationResponse
-> ModifyReplicationGroupShardConfigurationResponse -> Bool
(ModifyReplicationGroupShardConfigurationResponse
 -> ModifyReplicationGroupShardConfigurationResponse -> Bool)
-> (ModifyReplicationGroupShardConfigurationResponse
    -> ModifyReplicationGroupShardConfigurationResponse -> Bool)
-> Eq ModifyReplicationGroupShardConfigurationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyReplicationGroupShardConfigurationResponse
-> ModifyReplicationGroupShardConfigurationResponse -> Bool
$c/= :: ModifyReplicationGroupShardConfigurationResponse
-> ModifyReplicationGroupShardConfigurationResponse -> Bool
== :: ModifyReplicationGroupShardConfigurationResponse
-> ModifyReplicationGroupShardConfigurationResponse -> Bool
$c== :: ModifyReplicationGroupShardConfigurationResponse
-> ModifyReplicationGroupShardConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [ModifyReplicationGroupShardConfigurationResponse]
ReadPrec ModifyReplicationGroupShardConfigurationResponse
Int -> ReadS ModifyReplicationGroupShardConfigurationResponse
ReadS [ModifyReplicationGroupShardConfigurationResponse]
(Int -> ReadS ModifyReplicationGroupShardConfigurationResponse)
-> ReadS [ModifyReplicationGroupShardConfigurationResponse]
-> ReadPrec ModifyReplicationGroupShardConfigurationResponse
-> ReadPrec [ModifyReplicationGroupShardConfigurationResponse]
-> Read ModifyReplicationGroupShardConfigurationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyReplicationGroupShardConfigurationResponse]
$creadListPrec :: ReadPrec [ModifyReplicationGroupShardConfigurationResponse]
readPrec :: ReadPrec ModifyReplicationGroupShardConfigurationResponse
$creadPrec :: ReadPrec ModifyReplicationGroupShardConfigurationResponse
readList :: ReadS [ModifyReplicationGroupShardConfigurationResponse]
$creadList :: ReadS [ModifyReplicationGroupShardConfigurationResponse]
readsPrec :: Int -> ReadS ModifyReplicationGroupShardConfigurationResponse
$creadsPrec :: Int -> ReadS ModifyReplicationGroupShardConfigurationResponse
Prelude.Read, Int -> ModifyReplicationGroupShardConfigurationResponse -> ShowS
[ModifyReplicationGroupShardConfigurationResponse] -> ShowS
ModifyReplicationGroupShardConfigurationResponse -> String
(Int -> ModifyReplicationGroupShardConfigurationResponse -> ShowS)
-> (ModifyReplicationGroupShardConfigurationResponse -> String)
-> ([ModifyReplicationGroupShardConfigurationResponse] -> ShowS)
-> Show ModifyReplicationGroupShardConfigurationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyReplicationGroupShardConfigurationResponse] -> ShowS
$cshowList :: [ModifyReplicationGroupShardConfigurationResponse] -> ShowS
show :: ModifyReplicationGroupShardConfigurationResponse -> String
$cshow :: ModifyReplicationGroupShardConfigurationResponse -> String
showsPrec :: Int -> ModifyReplicationGroupShardConfigurationResponse -> ShowS
$cshowsPrec :: Int -> ModifyReplicationGroupShardConfigurationResponse -> ShowS
Prelude.Show, (forall x.
 ModifyReplicationGroupShardConfigurationResponse
 -> Rep ModifyReplicationGroupShardConfigurationResponse x)
-> (forall x.
    Rep ModifyReplicationGroupShardConfigurationResponse x
    -> ModifyReplicationGroupShardConfigurationResponse)
-> Generic ModifyReplicationGroupShardConfigurationResponse
forall x.
Rep ModifyReplicationGroupShardConfigurationResponse x
-> ModifyReplicationGroupShardConfigurationResponse
forall x.
ModifyReplicationGroupShardConfigurationResponse
-> Rep ModifyReplicationGroupShardConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ModifyReplicationGroupShardConfigurationResponse x
-> ModifyReplicationGroupShardConfigurationResponse
$cfrom :: forall x.
ModifyReplicationGroupShardConfigurationResponse
-> Rep ModifyReplicationGroupShardConfigurationResponse x
Prelude.Generic)

-- |
-- Create a value of 'ModifyReplicationGroupShardConfigurationResponse' 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:
--
-- 'replicationGroup', 'modifyReplicationGroupShardConfigurationResponse_replicationGroup' - Undocumented member.
--
-- 'httpStatus', 'modifyReplicationGroupShardConfigurationResponse_httpStatus' - The response's http status code.
newModifyReplicationGroupShardConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ModifyReplicationGroupShardConfigurationResponse
newModifyReplicationGroupShardConfigurationResponse :: Int -> ModifyReplicationGroupShardConfigurationResponse
newModifyReplicationGroupShardConfigurationResponse
  Int
pHttpStatus_ =
    ModifyReplicationGroupShardConfigurationResponse' :: Maybe ReplicationGroup
-> Int -> ModifyReplicationGroupShardConfigurationResponse
ModifyReplicationGroupShardConfigurationResponse'
      { $sel:replicationGroup:ModifyReplicationGroupShardConfigurationResponse' :: Maybe ReplicationGroup
replicationGroup =
          Maybe ReplicationGroup
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ModifyReplicationGroupShardConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Undocumented member.
modifyReplicationGroupShardConfigurationResponse_replicationGroup :: Lens.Lens' ModifyReplicationGroupShardConfigurationResponse (Prelude.Maybe ReplicationGroup)
modifyReplicationGroupShardConfigurationResponse_replicationGroup :: (Maybe ReplicationGroup -> f (Maybe ReplicationGroup))
-> ModifyReplicationGroupShardConfigurationResponse
-> f ModifyReplicationGroupShardConfigurationResponse
modifyReplicationGroupShardConfigurationResponse_replicationGroup = (ModifyReplicationGroupShardConfigurationResponse
 -> Maybe ReplicationGroup)
-> (ModifyReplicationGroupShardConfigurationResponse
    -> Maybe ReplicationGroup
    -> ModifyReplicationGroupShardConfigurationResponse)
-> Lens
     ModifyReplicationGroupShardConfigurationResponse
     ModifyReplicationGroupShardConfigurationResponse
     (Maybe ReplicationGroup)
     (Maybe ReplicationGroup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyReplicationGroupShardConfigurationResponse' {Maybe ReplicationGroup
replicationGroup :: Maybe ReplicationGroup
$sel:replicationGroup:ModifyReplicationGroupShardConfigurationResponse' :: ModifyReplicationGroupShardConfigurationResponse
-> Maybe ReplicationGroup
replicationGroup} -> Maybe ReplicationGroup
replicationGroup) (\s :: ModifyReplicationGroupShardConfigurationResponse
s@ModifyReplicationGroupShardConfigurationResponse' {} Maybe ReplicationGroup
a -> ModifyReplicationGroupShardConfigurationResponse
s {$sel:replicationGroup:ModifyReplicationGroupShardConfigurationResponse' :: Maybe ReplicationGroup
replicationGroup = Maybe ReplicationGroup
a} :: ModifyReplicationGroupShardConfigurationResponse)

-- | The response's http status code.
modifyReplicationGroupShardConfigurationResponse_httpStatus :: Lens.Lens' ModifyReplicationGroupShardConfigurationResponse Prelude.Int
modifyReplicationGroupShardConfigurationResponse_httpStatus :: (Int -> f Int)
-> ModifyReplicationGroupShardConfigurationResponse
-> f ModifyReplicationGroupShardConfigurationResponse
modifyReplicationGroupShardConfigurationResponse_httpStatus = (ModifyReplicationGroupShardConfigurationResponse -> Int)
-> (ModifyReplicationGroupShardConfigurationResponse
    -> Int -> ModifyReplicationGroupShardConfigurationResponse)
-> Lens
     ModifyReplicationGroupShardConfigurationResponse
     ModifyReplicationGroupShardConfigurationResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyReplicationGroupShardConfigurationResponse' {Int
httpStatus :: Int
$sel:httpStatus:ModifyReplicationGroupShardConfigurationResponse' :: ModifyReplicationGroupShardConfigurationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ModifyReplicationGroupShardConfigurationResponse
s@ModifyReplicationGroupShardConfigurationResponse' {} Int
a -> ModifyReplicationGroupShardConfigurationResponse
s {$sel:httpStatus:ModifyReplicationGroupShardConfigurationResponse' :: Int
httpStatus = Int
a} :: ModifyReplicationGroupShardConfigurationResponse)

instance
  Prelude.NFData
    ModifyReplicationGroupShardConfigurationResponse