{-# 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.DecreaseReplicaCount
-- 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)
--
-- Dynamically decreases the number of replicas in a Redis (cluster mode
-- disabled) replication group or the number of replica nodes in one or
-- more node groups (shards) of a Redis (cluster mode enabled) replication
-- group. This operation is performed with no cluster down time.
module Amazonka.ElastiCache.DecreaseReplicaCount
  ( -- * Creating a Request
    DecreaseReplicaCount (..),
    newDecreaseReplicaCount,

    -- * Request Lenses
    decreaseReplicaCount_newReplicaCount,
    decreaseReplicaCount_replicaConfiguration,
    decreaseReplicaCount_replicasToRemove,
    decreaseReplicaCount_replicationGroupId,
    decreaseReplicaCount_applyImmediately,

    -- * Destructuring the Response
    DecreaseReplicaCountResponse (..),
    newDecreaseReplicaCountResponse,

    -- * Response Lenses
    decreaseReplicaCountResponse_replicationGroup,
    decreaseReplicaCountResponse_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

-- | /See:/ 'newDecreaseReplicaCount' smart constructor.
data DecreaseReplicaCount = DecreaseReplicaCount'
  { -- | The number of read replica nodes you want at the completion of this
    -- operation. For Redis (cluster mode disabled) replication groups, this is
    -- the number of replica nodes in the replication group. For Redis (cluster
    -- mode enabled) replication groups, this is the number of replica nodes in
    -- each of the replication group\'s node groups.
    --
    -- The minimum number of replicas in a shard or replication group is:
    --
    -- -   Redis (cluster mode disabled)
    --
    --     -   If Multi-AZ is enabled: 1
    --
    --     -   If Multi-AZ is not enabled: 0
    --
    -- -   Redis (cluster mode enabled): 0 (though you will not be able to
    --     failover to a replica if your primary node fails)
    DecreaseReplicaCount -> Maybe Int
newReplicaCount' :: Prelude.Maybe Prelude.Int,
    -- | A list of @ConfigureShard@ objects that can be used to configure each
    -- shard in a Redis (cluster mode enabled) replication group. The
    -- @ConfigureShard@ has three members: @NewReplicaCount@, @NodeGroupId@,
    -- and @PreferredAvailabilityZones@.
    DecreaseReplicaCount -> Maybe [ConfigureShard]
replicaConfiguration :: Prelude.Maybe [ConfigureShard],
    -- | A list of the node ids to remove from the replication group or node
    -- group (shard).
    DecreaseReplicaCount -> Maybe [Text]
replicasToRemove :: Prelude.Maybe [Prelude.Text],
    -- | The id of the replication group from which you want to remove replica
    -- nodes.
    DecreaseReplicaCount -> Text
replicationGroupId :: Prelude.Text,
    -- | If @True@, the number of replica nodes is decreased immediately.
    -- @ApplyImmediately=False@ is not currently supported.
    DecreaseReplicaCount -> Bool
applyImmediately :: Prelude.Bool
  }
  deriving (DecreaseReplicaCount -> DecreaseReplicaCount -> Bool
(DecreaseReplicaCount -> DecreaseReplicaCount -> Bool)
-> (DecreaseReplicaCount -> DecreaseReplicaCount -> Bool)
-> Eq DecreaseReplicaCount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DecreaseReplicaCount -> DecreaseReplicaCount -> Bool
$c/= :: DecreaseReplicaCount -> DecreaseReplicaCount -> Bool
== :: DecreaseReplicaCount -> DecreaseReplicaCount -> Bool
$c== :: DecreaseReplicaCount -> DecreaseReplicaCount -> Bool
Prelude.Eq, ReadPrec [DecreaseReplicaCount]
ReadPrec DecreaseReplicaCount
Int -> ReadS DecreaseReplicaCount
ReadS [DecreaseReplicaCount]
(Int -> ReadS DecreaseReplicaCount)
-> ReadS [DecreaseReplicaCount]
-> ReadPrec DecreaseReplicaCount
-> ReadPrec [DecreaseReplicaCount]
-> Read DecreaseReplicaCount
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DecreaseReplicaCount]
$creadListPrec :: ReadPrec [DecreaseReplicaCount]
readPrec :: ReadPrec DecreaseReplicaCount
$creadPrec :: ReadPrec DecreaseReplicaCount
readList :: ReadS [DecreaseReplicaCount]
$creadList :: ReadS [DecreaseReplicaCount]
readsPrec :: Int -> ReadS DecreaseReplicaCount
$creadsPrec :: Int -> ReadS DecreaseReplicaCount
Prelude.Read, Int -> DecreaseReplicaCount -> ShowS
[DecreaseReplicaCount] -> ShowS
DecreaseReplicaCount -> String
(Int -> DecreaseReplicaCount -> ShowS)
-> (DecreaseReplicaCount -> String)
-> ([DecreaseReplicaCount] -> ShowS)
-> Show DecreaseReplicaCount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DecreaseReplicaCount] -> ShowS
$cshowList :: [DecreaseReplicaCount] -> ShowS
show :: DecreaseReplicaCount -> String
$cshow :: DecreaseReplicaCount -> String
showsPrec :: Int -> DecreaseReplicaCount -> ShowS
$cshowsPrec :: Int -> DecreaseReplicaCount -> ShowS
Prelude.Show, (forall x. DecreaseReplicaCount -> Rep DecreaseReplicaCount x)
-> (forall x. Rep DecreaseReplicaCount x -> DecreaseReplicaCount)
-> Generic DecreaseReplicaCount
forall x. Rep DecreaseReplicaCount x -> DecreaseReplicaCount
forall x. DecreaseReplicaCount -> Rep DecreaseReplicaCount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DecreaseReplicaCount x -> DecreaseReplicaCount
$cfrom :: forall x. DecreaseReplicaCount -> Rep DecreaseReplicaCount x
Prelude.Generic)

-- |
-- Create a value of 'DecreaseReplicaCount' 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:
--
-- 'newReplicaCount'', 'decreaseReplicaCount_newReplicaCount' - The number of read replica nodes you want at the completion of this
-- operation. For Redis (cluster mode disabled) replication groups, this is
-- the number of replica nodes in the replication group. For Redis (cluster
-- mode enabled) replication groups, this is the number of replica nodes in
-- each of the replication group\'s node groups.
--
-- The minimum number of replicas in a shard or replication group is:
--
-- -   Redis (cluster mode disabled)
--
--     -   If Multi-AZ is enabled: 1
--
--     -   If Multi-AZ is not enabled: 0
--
-- -   Redis (cluster mode enabled): 0 (though you will not be able to
--     failover to a replica if your primary node fails)
--
-- 'replicaConfiguration', 'decreaseReplicaCount_replicaConfiguration' - A list of @ConfigureShard@ objects that can be used to configure each
-- shard in a Redis (cluster mode enabled) replication group. The
-- @ConfigureShard@ has three members: @NewReplicaCount@, @NodeGroupId@,
-- and @PreferredAvailabilityZones@.
--
-- 'replicasToRemove', 'decreaseReplicaCount_replicasToRemove' - A list of the node ids to remove from the replication group or node
-- group (shard).
--
-- 'replicationGroupId', 'decreaseReplicaCount_replicationGroupId' - The id of the replication group from which you want to remove replica
-- nodes.
--
-- 'applyImmediately', 'decreaseReplicaCount_applyImmediately' - If @True@, the number of replica nodes is decreased immediately.
-- @ApplyImmediately=False@ is not currently supported.
newDecreaseReplicaCount ::
  -- | 'replicationGroupId'
  Prelude.Text ->
  -- | 'applyImmediately'
  Prelude.Bool ->
  DecreaseReplicaCount
newDecreaseReplicaCount :: Text -> Bool -> DecreaseReplicaCount
newDecreaseReplicaCount
  Text
pReplicationGroupId_
  Bool
pApplyImmediately_ =
    DecreaseReplicaCount' :: Maybe Int
-> Maybe [ConfigureShard]
-> Maybe [Text]
-> Text
-> Bool
-> DecreaseReplicaCount
DecreaseReplicaCount'
      { $sel:newReplicaCount':DecreaseReplicaCount' :: Maybe Int
newReplicaCount' =
          Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:replicaConfiguration:DecreaseReplicaCount' :: Maybe [ConfigureShard]
replicaConfiguration = Maybe [ConfigureShard]
forall a. Maybe a
Prelude.Nothing,
        $sel:replicasToRemove:DecreaseReplicaCount' :: Maybe [Text]
replicasToRemove = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:replicationGroupId:DecreaseReplicaCount' :: Text
replicationGroupId = Text
pReplicationGroupId_,
        $sel:applyImmediately:DecreaseReplicaCount' :: Bool
applyImmediately = Bool
pApplyImmediately_
      }

-- | The number of read replica nodes you want at the completion of this
-- operation. For Redis (cluster mode disabled) replication groups, this is
-- the number of replica nodes in the replication group. For Redis (cluster
-- mode enabled) replication groups, this is the number of replica nodes in
-- each of the replication group\'s node groups.
--
-- The minimum number of replicas in a shard or replication group is:
--
-- -   Redis (cluster mode disabled)
--
--     -   If Multi-AZ is enabled: 1
--
--     -   If Multi-AZ is not enabled: 0
--
-- -   Redis (cluster mode enabled): 0 (though you will not be able to
--     failover to a replica if your primary node fails)
decreaseReplicaCount_newReplicaCount :: Lens.Lens' DecreaseReplicaCount (Prelude.Maybe Prelude.Int)
decreaseReplicaCount_newReplicaCount :: (Maybe Int -> f (Maybe Int))
-> DecreaseReplicaCount -> f DecreaseReplicaCount
decreaseReplicaCount_newReplicaCount = (DecreaseReplicaCount -> Maybe Int)
-> (DecreaseReplicaCount -> Maybe Int -> DecreaseReplicaCount)
-> Lens
     DecreaseReplicaCount DecreaseReplicaCount (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DecreaseReplicaCount' {Maybe Int
newReplicaCount' :: Maybe Int
$sel:newReplicaCount':DecreaseReplicaCount' :: DecreaseReplicaCount -> Maybe Int
newReplicaCount'} -> Maybe Int
newReplicaCount') (\s :: DecreaseReplicaCount
s@DecreaseReplicaCount' {} Maybe Int
a -> DecreaseReplicaCount
s {$sel:newReplicaCount':DecreaseReplicaCount' :: Maybe Int
newReplicaCount' = Maybe Int
a} :: DecreaseReplicaCount)

-- | A list of @ConfigureShard@ objects that can be used to configure each
-- shard in a Redis (cluster mode enabled) replication group. The
-- @ConfigureShard@ has three members: @NewReplicaCount@, @NodeGroupId@,
-- and @PreferredAvailabilityZones@.
decreaseReplicaCount_replicaConfiguration :: Lens.Lens' DecreaseReplicaCount (Prelude.Maybe [ConfigureShard])
decreaseReplicaCount_replicaConfiguration :: (Maybe [ConfigureShard] -> f (Maybe [ConfigureShard]))
-> DecreaseReplicaCount -> f DecreaseReplicaCount
decreaseReplicaCount_replicaConfiguration = (DecreaseReplicaCount -> Maybe [ConfigureShard])
-> (DecreaseReplicaCount
    -> Maybe [ConfigureShard] -> DecreaseReplicaCount)
-> Lens
     DecreaseReplicaCount
     DecreaseReplicaCount
     (Maybe [ConfigureShard])
     (Maybe [ConfigureShard])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DecreaseReplicaCount' {Maybe [ConfigureShard]
replicaConfiguration :: Maybe [ConfigureShard]
$sel:replicaConfiguration:DecreaseReplicaCount' :: DecreaseReplicaCount -> Maybe [ConfigureShard]
replicaConfiguration} -> Maybe [ConfigureShard]
replicaConfiguration) (\s :: DecreaseReplicaCount
s@DecreaseReplicaCount' {} Maybe [ConfigureShard]
a -> DecreaseReplicaCount
s {$sel:replicaConfiguration:DecreaseReplicaCount' :: Maybe [ConfigureShard]
replicaConfiguration = Maybe [ConfigureShard]
a} :: DecreaseReplicaCount) ((Maybe [ConfigureShard] -> f (Maybe [ConfigureShard]))
 -> DecreaseReplicaCount -> f DecreaseReplicaCount)
-> ((Maybe [ConfigureShard] -> f (Maybe [ConfigureShard]))
    -> Maybe [ConfigureShard] -> f (Maybe [ConfigureShard]))
-> (Maybe [ConfigureShard] -> f (Maybe [ConfigureShard]))
-> DecreaseReplicaCount
-> f DecreaseReplicaCount
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ConfigureShard] [ConfigureShard] [ConfigureShard] [ConfigureShard]
-> Iso
     (Maybe [ConfigureShard])
     (Maybe [ConfigureShard])
     (Maybe [ConfigureShard])
     (Maybe [ConfigureShard])
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
  [ConfigureShard] [ConfigureShard] [ConfigureShard] [ConfigureShard]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of the node ids to remove from the replication group or node
-- group (shard).
decreaseReplicaCount_replicasToRemove :: Lens.Lens' DecreaseReplicaCount (Prelude.Maybe [Prelude.Text])
decreaseReplicaCount_replicasToRemove :: (Maybe [Text] -> f (Maybe [Text]))
-> DecreaseReplicaCount -> f DecreaseReplicaCount
decreaseReplicaCount_replicasToRemove = (DecreaseReplicaCount -> Maybe [Text])
-> (DecreaseReplicaCount -> Maybe [Text] -> DecreaseReplicaCount)
-> Lens
     DecreaseReplicaCount
     DecreaseReplicaCount
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DecreaseReplicaCount' {Maybe [Text]
replicasToRemove :: Maybe [Text]
$sel:replicasToRemove:DecreaseReplicaCount' :: DecreaseReplicaCount -> Maybe [Text]
replicasToRemove} -> Maybe [Text]
replicasToRemove) (\s :: DecreaseReplicaCount
s@DecreaseReplicaCount' {} Maybe [Text]
a -> DecreaseReplicaCount
s {$sel:replicasToRemove:DecreaseReplicaCount' :: Maybe [Text]
replicasToRemove = Maybe [Text]
a} :: DecreaseReplicaCount) ((Maybe [Text] -> f (Maybe [Text]))
 -> DecreaseReplicaCount -> f DecreaseReplicaCount)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DecreaseReplicaCount
-> f DecreaseReplicaCount
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 id of the replication group from which you want to remove replica
-- nodes.
decreaseReplicaCount_replicationGroupId :: Lens.Lens' DecreaseReplicaCount Prelude.Text
decreaseReplicaCount_replicationGroupId :: (Text -> f Text) -> DecreaseReplicaCount -> f DecreaseReplicaCount
decreaseReplicaCount_replicationGroupId = (DecreaseReplicaCount -> Text)
-> (DecreaseReplicaCount -> Text -> DecreaseReplicaCount)
-> Lens DecreaseReplicaCount DecreaseReplicaCount Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DecreaseReplicaCount' {Text
replicationGroupId :: Text
$sel:replicationGroupId:DecreaseReplicaCount' :: DecreaseReplicaCount -> Text
replicationGroupId} -> Text
replicationGroupId) (\s :: DecreaseReplicaCount
s@DecreaseReplicaCount' {} Text
a -> DecreaseReplicaCount
s {$sel:replicationGroupId:DecreaseReplicaCount' :: Text
replicationGroupId = Text
a} :: DecreaseReplicaCount)

-- | If @True@, the number of replica nodes is decreased immediately.
-- @ApplyImmediately=False@ is not currently supported.
decreaseReplicaCount_applyImmediately :: Lens.Lens' DecreaseReplicaCount Prelude.Bool
decreaseReplicaCount_applyImmediately :: (Bool -> f Bool) -> DecreaseReplicaCount -> f DecreaseReplicaCount
decreaseReplicaCount_applyImmediately = (DecreaseReplicaCount -> Bool)
-> (DecreaseReplicaCount -> Bool -> DecreaseReplicaCount)
-> Lens DecreaseReplicaCount DecreaseReplicaCount Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DecreaseReplicaCount' {Bool
applyImmediately :: Bool
$sel:applyImmediately:DecreaseReplicaCount' :: DecreaseReplicaCount -> Bool
applyImmediately} -> Bool
applyImmediately) (\s :: DecreaseReplicaCount
s@DecreaseReplicaCount' {} Bool
a -> DecreaseReplicaCount
s {$sel:applyImmediately:DecreaseReplicaCount' :: Bool
applyImmediately = Bool
a} :: DecreaseReplicaCount)

instance Core.AWSRequest DecreaseReplicaCount where
  type
    AWSResponse DecreaseReplicaCount =
      DecreaseReplicaCountResponse
  request :: DecreaseReplicaCount -> Request DecreaseReplicaCount
request = Service -> DecreaseReplicaCount -> Request DecreaseReplicaCount
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DecreaseReplicaCount
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DecreaseReplicaCount)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DecreaseReplicaCount))
-> Logger
-> Service
-> Proxy DecreaseReplicaCount
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DecreaseReplicaCount)))
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
"DecreaseReplicaCountResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe ReplicationGroup -> Int -> DecreaseReplicaCountResponse
DecreaseReplicaCountResponse'
            (Maybe ReplicationGroup -> Int -> DecreaseReplicaCountResponse)
-> Either String (Maybe ReplicationGroup)
-> Either String (Int -> DecreaseReplicaCountResponse)
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 -> DecreaseReplicaCountResponse)
-> Either String Int -> Either String DecreaseReplicaCountResponse
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 DecreaseReplicaCount

instance Prelude.NFData DecreaseReplicaCount

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

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

instance Core.ToQuery DecreaseReplicaCount where
  toQuery :: DecreaseReplicaCount -> QueryString
toQuery DecreaseReplicaCount' {Bool
Maybe Int
Maybe [Text]
Maybe [ConfigureShard]
Text
applyImmediately :: Bool
replicationGroupId :: Text
replicasToRemove :: Maybe [Text]
replicaConfiguration :: Maybe [ConfigureShard]
newReplicaCount' :: Maybe Int
$sel:applyImmediately:DecreaseReplicaCount' :: DecreaseReplicaCount -> Bool
$sel:replicationGroupId:DecreaseReplicaCount' :: DecreaseReplicaCount -> Text
$sel:replicasToRemove:DecreaseReplicaCount' :: DecreaseReplicaCount -> Maybe [Text]
$sel:replicaConfiguration:DecreaseReplicaCount' :: DecreaseReplicaCount -> Maybe [ConfigureShard]
$sel:newReplicaCount':DecreaseReplicaCount' :: DecreaseReplicaCount -> Maybe Int
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DecreaseReplicaCount" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
        ByteString
"NewReplicaCount" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
newReplicaCount',
        ByteString
"ReplicaConfiguration"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> [ConfigureShard] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"ConfigureShard"
                ([ConfigureShard] -> QueryString)
-> Maybe [ConfigureShard] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ConfigureShard]
replicaConfiguration
            ),
        ByteString
"ReplicasToRemove"
          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
"member"
                ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
replicasToRemove
            ),
        ByteString
"ReplicationGroupId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
replicationGroupId,
        ByteString
"ApplyImmediately" ByteString -> Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Bool
applyImmediately
      ]

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

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

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

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

instance Prelude.NFData DecreaseReplicaCountResponse