{-# 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.DecreaseNodeGroupsInGlobalReplicationGroup
-- 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)
--
-- Decreases the number of node groups in a Global datastore
module Amazonka.ElastiCache.DecreaseNodeGroupsInGlobalReplicationGroup
  ( -- * Creating a Request
    DecreaseNodeGroupsInGlobalReplicationGroup (..),
    newDecreaseNodeGroupsInGlobalReplicationGroup,

    -- * Request Lenses
    decreaseNodeGroupsInGlobalReplicationGroup_globalNodeGroupsToRemove,
    decreaseNodeGroupsInGlobalReplicationGroup_globalNodeGroupsToRetain,
    decreaseNodeGroupsInGlobalReplicationGroup_globalReplicationGroupId,
    decreaseNodeGroupsInGlobalReplicationGroup_nodeGroupCount,
    decreaseNodeGroupsInGlobalReplicationGroup_applyImmediately,

    -- * Destructuring the Response
    DecreaseNodeGroupsInGlobalReplicationGroupResponse (..),
    newDecreaseNodeGroupsInGlobalReplicationGroupResponse,

    -- * Response Lenses
    decreaseNodeGroupsInGlobalReplicationGroupResponse_globalReplicationGroup,
    decreaseNodeGroupsInGlobalReplicationGroupResponse_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:/ 'newDecreaseNodeGroupsInGlobalReplicationGroup' smart constructor.
data DecreaseNodeGroupsInGlobalReplicationGroup = DecreaseNodeGroupsInGlobalReplicationGroup'
  { -- | If the value of NodeGroupCount is less than the current number of node
    -- groups (shards), then either NodeGroupsToRemove or NodeGroupsToRetain is
    -- required. GlobalNodeGroupsToRemove is a list of NodeGroupIds to remove
    -- from the cluster. ElastiCache for Redis will attempt to remove all node
    -- groups listed by GlobalNodeGroupsToRemove from the cluster.
    DecreaseNodeGroupsInGlobalReplicationGroup -> Maybe [Text]
globalNodeGroupsToRemove :: Prelude.Maybe [Prelude.Text],
    -- | If the value of NodeGroupCount is less than the current number of node
    -- groups (shards), then either NodeGroupsToRemove or NodeGroupsToRetain is
    -- required. GlobalNodeGroupsToRetain is a list of NodeGroupIds to retain
    -- from the cluster. ElastiCache for Redis will attempt to retain all node
    -- groups listed by GlobalNodeGroupsToRetain from the cluster.
    DecreaseNodeGroupsInGlobalReplicationGroup -> Maybe [Text]
globalNodeGroupsToRetain :: Prelude.Maybe [Prelude.Text],
    -- | The name of the Global datastore
    DecreaseNodeGroupsInGlobalReplicationGroup -> Text
globalReplicationGroupId :: Prelude.Text,
    -- | The number of node groups (shards) that results from the modification of
    -- the shard configuration
    DecreaseNodeGroupsInGlobalReplicationGroup -> Int
nodeGroupCount :: Prelude.Int,
    -- | Indicates that the shard reconfiguration process begins immediately. At
    -- present, the only permitted value for this parameter is true.
    DecreaseNodeGroupsInGlobalReplicationGroup -> Bool
applyImmediately :: Prelude.Bool
  }
  deriving (DecreaseNodeGroupsInGlobalReplicationGroup
-> DecreaseNodeGroupsInGlobalReplicationGroup -> Bool
(DecreaseNodeGroupsInGlobalReplicationGroup
 -> DecreaseNodeGroupsInGlobalReplicationGroup -> Bool)
-> (DecreaseNodeGroupsInGlobalReplicationGroup
    -> DecreaseNodeGroupsInGlobalReplicationGroup -> Bool)
-> Eq DecreaseNodeGroupsInGlobalReplicationGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DecreaseNodeGroupsInGlobalReplicationGroup
-> DecreaseNodeGroupsInGlobalReplicationGroup -> Bool
$c/= :: DecreaseNodeGroupsInGlobalReplicationGroup
-> DecreaseNodeGroupsInGlobalReplicationGroup -> Bool
== :: DecreaseNodeGroupsInGlobalReplicationGroup
-> DecreaseNodeGroupsInGlobalReplicationGroup -> Bool
$c== :: DecreaseNodeGroupsInGlobalReplicationGroup
-> DecreaseNodeGroupsInGlobalReplicationGroup -> Bool
Prelude.Eq, ReadPrec [DecreaseNodeGroupsInGlobalReplicationGroup]
ReadPrec DecreaseNodeGroupsInGlobalReplicationGroup
Int -> ReadS DecreaseNodeGroupsInGlobalReplicationGroup
ReadS [DecreaseNodeGroupsInGlobalReplicationGroup]
(Int -> ReadS DecreaseNodeGroupsInGlobalReplicationGroup)
-> ReadS [DecreaseNodeGroupsInGlobalReplicationGroup]
-> ReadPrec DecreaseNodeGroupsInGlobalReplicationGroup
-> ReadPrec [DecreaseNodeGroupsInGlobalReplicationGroup]
-> Read DecreaseNodeGroupsInGlobalReplicationGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DecreaseNodeGroupsInGlobalReplicationGroup]
$creadListPrec :: ReadPrec [DecreaseNodeGroupsInGlobalReplicationGroup]
readPrec :: ReadPrec DecreaseNodeGroupsInGlobalReplicationGroup
$creadPrec :: ReadPrec DecreaseNodeGroupsInGlobalReplicationGroup
readList :: ReadS [DecreaseNodeGroupsInGlobalReplicationGroup]
$creadList :: ReadS [DecreaseNodeGroupsInGlobalReplicationGroup]
readsPrec :: Int -> ReadS DecreaseNodeGroupsInGlobalReplicationGroup
$creadsPrec :: Int -> ReadS DecreaseNodeGroupsInGlobalReplicationGroup
Prelude.Read, Int -> DecreaseNodeGroupsInGlobalReplicationGroup -> ShowS
[DecreaseNodeGroupsInGlobalReplicationGroup] -> ShowS
DecreaseNodeGroupsInGlobalReplicationGroup -> String
(Int -> DecreaseNodeGroupsInGlobalReplicationGroup -> ShowS)
-> (DecreaseNodeGroupsInGlobalReplicationGroup -> String)
-> ([DecreaseNodeGroupsInGlobalReplicationGroup] -> ShowS)
-> Show DecreaseNodeGroupsInGlobalReplicationGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DecreaseNodeGroupsInGlobalReplicationGroup] -> ShowS
$cshowList :: [DecreaseNodeGroupsInGlobalReplicationGroup] -> ShowS
show :: DecreaseNodeGroupsInGlobalReplicationGroup -> String
$cshow :: DecreaseNodeGroupsInGlobalReplicationGroup -> String
showsPrec :: Int -> DecreaseNodeGroupsInGlobalReplicationGroup -> ShowS
$cshowsPrec :: Int -> DecreaseNodeGroupsInGlobalReplicationGroup -> ShowS
Prelude.Show, (forall x.
 DecreaseNodeGroupsInGlobalReplicationGroup
 -> Rep DecreaseNodeGroupsInGlobalReplicationGroup x)
-> (forall x.
    Rep DecreaseNodeGroupsInGlobalReplicationGroup x
    -> DecreaseNodeGroupsInGlobalReplicationGroup)
-> Generic DecreaseNodeGroupsInGlobalReplicationGroup
forall x.
Rep DecreaseNodeGroupsInGlobalReplicationGroup x
-> DecreaseNodeGroupsInGlobalReplicationGroup
forall x.
DecreaseNodeGroupsInGlobalReplicationGroup
-> Rep DecreaseNodeGroupsInGlobalReplicationGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DecreaseNodeGroupsInGlobalReplicationGroup x
-> DecreaseNodeGroupsInGlobalReplicationGroup
$cfrom :: forall x.
DecreaseNodeGroupsInGlobalReplicationGroup
-> Rep DecreaseNodeGroupsInGlobalReplicationGroup x
Prelude.Generic)

-- |
-- Create a value of 'DecreaseNodeGroupsInGlobalReplicationGroup' 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:
--
-- 'globalNodeGroupsToRemove', 'decreaseNodeGroupsInGlobalReplicationGroup_globalNodeGroupsToRemove' - If the value of NodeGroupCount is less than the current number of node
-- groups (shards), then either NodeGroupsToRemove or NodeGroupsToRetain is
-- required. GlobalNodeGroupsToRemove is a list of NodeGroupIds to remove
-- from the cluster. ElastiCache for Redis will attempt to remove all node
-- groups listed by GlobalNodeGroupsToRemove from the cluster.
--
-- 'globalNodeGroupsToRetain', 'decreaseNodeGroupsInGlobalReplicationGroup_globalNodeGroupsToRetain' - If the value of NodeGroupCount is less than the current number of node
-- groups (shards), then either NodeGroupsToRemove or NodeGroupsToRetain is
-- required. GlobalNodeGroupsToRetain is a list of NodeGroupIds to retain
-- from the cluster. ElastiCache for Redis will attempt to retain all node
-- groups listed by GlobalNodeGroupsToRetain from the cluster.
--
-- 'globalReplicationGroupId', 'decreaseNodeGroupsInGlobalReplicationGroup_globalReplicationGroupId' - The name of the Global datastore
--
-- 'nodeGroupCount', 'decreaseNodeGroupsInGlobalReplicationGroup_nodeGroupCount' - The number of node groups (shards) that results from the modification of
-- the shard configuration
--
-- 'applyImmediately', 'decreaseNodeGroupsInGlobalReplicationGroup_applyImmediately' - Indicates that the shard reconfiguration process begins immediately. At
-- present, the only permitted value for this parameter is true.
newDecreaseNodeGroupsInGlobalReplicationGroup ::
  -- | 'globalReplicationGroupId'
  Prelude.Text ->
  -- | 'nodeGroupCount'
  Prelude.Int ->
  -- | 'applyImmediately'
  Prelude.Bool ->
  DecreaseNodeGroupsInGlobalReplicationGroup
newDecreaseNodeGroupsInGlobalReplicationGroup :: Text -> Int -> Bool -> DecreaseNodeGroupsInGlobalReplicationGroup
newDecreaseNodeGroupsInGlobalReplicationGroup
  Text
pGlobalReplicationGroupId_
  Int
pNodeGroupCount_
  Bool
pApplyImmediately_ =
    DecreaseNodeGroupsInGlobalReplicationGroup' :: Maybe [Text]
-> Maybe [Text]
-> Text
-> Int
-> Bool
-> DecreaseNodeGroupsInGlobalReplicationGroup
DecreaseNodeGroupsInGlobalReplicationGroup'
      { $sel:globalNodeGroupsToRemove:DecreaseNodeGroupsInGlobalReplicationGroup' :: Maybe [Text]
globalNodeGroupsToRemove =
          Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:globalNodeGroupsToRetain:DecreaseNodeGroupsInGlobalReplicationGroup' :: Maybe [Text]
globalNodeGroupsToRetain =
          Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:globalReplicationGroupId:DecreaseNodeGroupsInGlobalReplicationGroup' :: Text
globalReplicationGroupId =
          Text
pGlobalReplicationGroupId_,
        $sel:nodeGroupCount:DecreaseNodeGroupsInGlobalReplicationGroup' :: Int
nodeGroupCount =
          Int
pNodeGroupCount_,
        $sel:applyImmediately:DecreaseNodeGroupsInGlobalReplicationGroup' :: 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. GlobalNodeGroupsToRemove is a list of NodeGroupIds to remove
-- from the cluster. ElastiCache for Redis will attempt to remove all node
-- groups listed by GlobalNodeGroupsToRemove from the cluster.
decreaseNodeGroupsInGlobalReplicationGroup_globalNodeGroupsToRemove :: Lens.Lens' DecreaseNodeGroupsInGlobalReplicationGroup (Prelude.Maybe [Prelude.Text])
decreaseNodeGroupsInGlobalReplicationGroup_globalNodeGroupsToRemove :: (Maybe [Text] -> f (Maybe [Text]))
-> DecreaseNodeGroupsInGlobalReplicationGroup
-> f DecreaseNodeGroupsInGlobalReplicationGroup
decreaseNodeGroupsInGlobalReplicationGroup_globalNodeGroupsToRemove = (DecreaseNodeGroupsInGlobalReplicationGroup -> Maybe [Text])
-> (DecreaseNodeGroupsInGlobalReplicationGroup
    -> Maybe [Text] -> DecreaseNodeGroupsInGlobalReplicationGroup)
-> Lens
     DecreaseNodeGroupsInGlobalReplicationGroup
     DecreaseNodeGroupsInGlobalReplicationGroup
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DecreaseNodeGroupsInGlobalReplicationGroup' {Maybe [Text]
globalNodeGroupsToRemove :: Maybe [Text]
$sel:globalNodeGroupsToRemove:DecreaseNodeGroupsInGlobalReplicationGroup' :: DecreaseNodeGroupsInGlobalReplicationGroup -> Maybe [Text]
globalNodeGroupsToRemove} -> Maybe [Text]
globalNodeGroupsToRemove) (\s :: DecreaseNodeGroupsInGlobalReplicationGroup
s@DecreaseNodeGroupsInGlobalReplicationGroup' {} Maybe [Text]
a -> DecreaseNodeGroupsInGlobalReplicationGroup
s {$sel:globalNodeGroupsToRemove:DecreaseNodeGroupsInGlobalReplicationGroup' :: Maybe [Text]
globalNodeGroupsToRemove = Maybe [Text]
a} :: DecreaseNodeGroupsInGlobalReplicationGroup) ((Maybe [Text] -> f (Maybe [Text]))
 -> DecreaseNodeGroupsInGlobalReplicationGroup
 -> f DecreaseNodeGroupsInGlobalReplicationGroup)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DecreaseNodeGroupsInGlobalReplicationGroup
-> f DecreaseNodeGroupsInGlobalReplicationGroup
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

-- | If the value of NodeGroupCount is less than the current number of node
-- groups (shards), then either NodeGroupsToRemove or NodeGroupsToRetain is
-- required. GlobalNodeGroupsToRetain is a list of NodeGroupIds to retain
-- from the cluster. ElastiCache for Redis will attempt to retain all node
-- groups listed by GlobalNodeGroupsToRetain from the cluster.
decreaseNodeGroupsInGlobalReplicationGroup_globalNodeGroupsToRetain :: Lens.Lens' DecreaseNodeGroupsInGlobalReplicationGroup (Prelude.Maybe [Prelude.Text])
decreaseNodeGroupsInGlobalReplicationGroup_globalNodeGroupsToRetain :: (Maybe [Text] -> f (Maybe [Text]))
-> DecreaseNodeGroupsInGlobalReplicationGroup
-> f DecreaseNodeGroupsInGlobalReplicationGroup
decreaseNodeGroupsInGlobalReplicationGroup_globalNodeGroupsToRetain = (DecreaseNodeGroupsInGlobalReplicationGroup -> Maybe [Text])
-> (DecreaseNodeGroupsInGlobalReplicationGroup
    -> Maybe [Text] -> DecreaseNodeGroupsInGlobalReplicationGroup)
-> Lens
     DecreaseNodeGroupsInGlobalReplicationGroup
     DecreaseNodeGroupsInGlobalReplicationGroup
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DecreaseNodeGroupsInGlobalReplicationGroup' {Maybe [Text]
globalNodeGroupsToRetain :: Maybe [Text]
$sel:globalNodeGroupsToRetain:DecreaseNodeGroupsInGlobalReplicationGroup' :: DecreaseNodeGroupsInGlobalReplicationGroup -> Maybe [Text]
globalNodeGroupsToRetain} -> Maybe [Text]
globalNodeGroupsToRetain) (\s :: DecreaseNodeGroupsInGlobalReplicationGroup
s@DecreaseNodeGroupsInGlobalReplicationGroup' {} Maybe [Text]
a -> DecreaseNodeGroupsInGlobalReplicationGroup
s {$sel:globalNodeGroupsToRetain:DecreaseNodeGroupsInGlobalReplicationGroup' :: Maybe [Text]
globalNodeGroupsToRetain = Maybe [Text]
a} :: DecreaseNodeGroupsInGlobalReplicationGroup) ((Maybe [Text] -> f (Maybe [Text]))
 -> DecreaseNodeGroupsInGlobalReplicationGroup
 -> f DecreaseNodeGroupsInGlobalReplicationGroup)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DecreaseNodeGroupsInGlobalReplicationGroup
-> f DecreaseNodeGroupsInGlobalReplicationGroup
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 Global datastore
decreaseNodeGroupsInGlobalReplicationGroup_globalReplicationGroupId :: Lens.Lens' DecreaseNodeGroupsInGlobalReplicationGroup Prelude.Text
decreaseNodeGroupsInGlobalReplicationGroup_globalReplicationGroupId :: (Text -> f Text)
-> DecreaseNodeGroupsInGlobalReplicationGroup
-> f DecreaseNodeGroupsInGlobalReplicationGroup
decreaseNodeGroupsInGlobalReplicationGroup_globalReplicationGroupId = (DecreaseNodeGroupsInGlobalReplicationGroup -> Text)
-> (DecreaseNodeGroupsInGlobalReplicationGroup
    -> Text -> DecreaseNodeGroupsInGlobalReplicationGroup)
-> Lens
     DecreaseNodeGroupsInGlobalReplicationGroup
     DecreaseNodeGroupsInGlobalReplicationGroup
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DecreaseNodeGroupsInGlobalReplicationGroup' {Text
globalReplicationGroupId :: Text
$sel:globalReplicationGroupId:DecreaseNodeGroupsInGlobalReplicationGroup' :: DecreaseNodeGroupsInGlobalReplicationGroup -> Text
globalReplicationGroupId} -> Text
globalReplicationGroupId) (\s :: DecreaseNodeGroupsInGlobalReplicationGroup
s@DecreaseNodeGroupsInGlobalReplicationGroup' {} Text
a -> DecreaseNodeGroupsInGlobalReplicationGroup
s {$sel:globalReplicationGroupId:DecreaseNodeGroupsInGlobalReplicationGroup' :: Text
globalReplicationGroupId = Text
a} :: DecreaseNodeGroupsInGlobalReplicationGroup)

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

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

instance
  Core.AWSRequest
    DecreaseNodeGroupsInGlobalReplicationGroup
  where
  type
    AWSResponse
      DecreaseNodeGroupsInGlobalReplicationGroup =
      DecreaseNodeGroupsInGlobalReplicationGroupResponse
  request :: DecreaseNodeGroupsInGlobalReplicationGroup
-> Request DecreaseNodeGroupsInGlobalReplicationGroup
request = Service
-> DecreaseNodeGroupsInGlobalReplicationGroup
-> Request DecreaseNodeGroupsInGlobalReplicationGroup
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DecreaseNodeGroupsInGlobalReplicationGroup
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DecreaseNodeGroupsInGlobalReplicationGroup)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either
         String (AWSResponse DecreaseNodeGroupsInGlobalReplicationGroup))
-> Logger
-> Service
-> Proxy DecreaseNodeGroupsInGlobalReplicationGroup
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DecreaseNodeGroupsInGlobalReplicationGroup)))
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
"DecreaseNodeGroupsInGlobalReplicationGroupResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe GlobalReplicationGroup
-> Int -> DecreaseNodeGroupsInGlobalReplicationGroupResponse
DecreaseNodeGroupsInGlobalReplicationGroupResponse'
            (Maybe GlobalReplicationGroup
 -> Int -> DecreaseNodeGroupsInGlobalReplicationGroupResponse)
-> Either String (Maybe GlobalReplicationGroup)
-> Either
     String (Int -> DecreaseNodeGroupsInGlobalReplicationGroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe GlobalReplicationGroup)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"GlobalReplicationGroup")
              Either
  String (Int -> DecreaseNodeGroupsInGlobalReplicationGroupResponse)
-> Either String Int
-> Either String DecreaseNodeGroupsInGlobalReplicationGroupResponse
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
    DecreaseNodeGroupsInGlobalReplicationGroup

instance
  Prelude.NFData
    DecreaseNodeGroupsInGlobalReplicationGroup

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

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

instance
  Core.ToQuery
    DecreaseNodeGroupsInGlobalReplicationGroup
  where
  toQuery :: DecreaseNodeGroupsInGlobalReplicationGroup -> QueryString
toQuery
    DecreaseNodeGroupsInGlobalReplicationGroup' {Bool
Int
Maybe [Text]
Text
applyImmediately :: Bool
nodeGroupCount :: Int
globalReplicationGroupId :: Text
globalNodeGroupsToRetain :: Maybe [Text]
globalNodeGroupsToRemove :: Maybe [Text]
$sel:applyImmediately:DecreaseNodeGroupsInGlobalReplicationGroup' :: DecreaseNodeGroupsInGlobalReplicationGroup -> Bool
$sel:nodeGroupCount:DecreaseNodeGroupsInGlobalReplicationGroup' :: DecreaseNodeGroupsInGlobalReplicationGroup -> Int
$sel:globalReplicationGroupId:DecreaseNodeGroupsInGlobalReplicationGroup' :: DecreaseNodeGroupsInGlobalReplicationGroup -> Text
$sel:globalNodeGroupsToRetain:DecreaseNodeGroupsInGlobalReplicationGroup' :: DecreaseNodeGroupsInGlobalReplicationGroup -> Maybe [Text]
$sel:globalNodeGroupsToRemove:DecreaseNodeGroupsInGlobalReplicationGroup' :: DecreaseNodeGroupsInGlobalReplicationGroup -> 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
"DecreaseNodeGroupsInGlobalReplicationGroup" ::
                        Prelude.ByteString
                    ),
          ByteString
"Version"
            ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
          ByteString
"GlobalNodeGroupsToRemove"
            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
"GlobalNodeGroupId"
                  ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
globalNodeGroupsToRemove
              ),
          ByteString
"GlobalNodeGroupsToRetain"
            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
"GlobalNodeGroupId"
                  ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
globalNodeGroupsToRetain
              ),
          ByteString
"GlobalReplicationGroupId"
            ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
globalReplicationGroupId,
          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:/ 'newDecreaseNodeGroupsInGlobalReplicationGroupResponse' smart constructor.
data DecreaseNodeGroupsInGlobalReplicationGroupResponse = DecreaseNodeGroupsInGlobalReplicationGroupResponse'
  { DecreaseNodeGroupsInGlobalReplicationGroupResponse
-> Maybe GlobalReplicationGroup
globalReplicationGroup :: Prelude.Maybe GlobalReplicationGroup,
    -- | The response's http status code.
    DecreaseNodeGroupsInGlobalReplicationGroupResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DecreaseNodeGroupsInGlobalReplicationGroupResponse
-> DecreaseNodeGroupsInGlobalReplicationGroupResponse -> Bool
(DecreaseNodeGroupsInGlobalReplicationGroupResponse
 -> DecreaseNodeGroupsInGlobalReplicationGroupResponse -> Bool)
-> (DecreaseNodeGroupsInGlobalReplicationGroupResponse
    -> DecreaseNodeGroupsInGlobalReplicationGroupResponse -> Bool)
-> Eq DecreaseNodeGroupsInGlobalReplicationGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DecreaseNodeGroupsInGlobalReplicationGroupResponse
-> DecreaseNodeGroupsInGlobalReplicationGroupResponse -> Bool
$c/= :: DecreaseNodeGroupsInGlobalReplicationGroupResponse
-> DecreaseNodeGroupsInGlobalReplicationGroupResponse -> Bool
== :: DecreaseNodeGroupsInGlobalReplicationGroupResponse
-> DecreaseNodeGroupsInGlobalReplicationGroupResponse -> Bool
$c== :: DecreaseNodeGroupsInGlobalReplicationGroupResponse
-> DecreaseNodeGroupsInGlobalReplicationGroupResponse -> Bool
Prelude.Eq, ReadPrec [DecreaseNodeGroupsInGlobalReplicationGroupResponse]
ReadPrec DecreaseNodeGroupsInGlobalReplicationGroupResponse
Int -> ReadS DecreaseNodeGroupsInGlobalReplicationGroupResponse
ReadS [DecreaseNodeGroupsInGlobalReplicationGroupResponse]
(Int -> ReadS DecreaseNodeGroupsInGlobalReplicationGroupResponse)
-> ReadS [DecreaseNodeGroupsInGlobalReplicationGroupResponse]
-> ReadPrec DecreaseNodeGroupsInGlobalReplicationGroupResponse
-> ReadPrec [DecreaseNodeGroupsInGlobalReplicationGroupResponse]
-> Read DecreaseNodeGroupsInGlobalReplicationGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DecreaseNodeGroupsInGlobalReplicationGroupResponse]
$creadListPrec :: ReadPrec [DecreaseNodeGroupsInGlobalReplicationGroupResponse]
readPrec :: ReadPrec DecreaseNodeGroupsInGlobalReplicationGroupResponse
$creadPrec :: ReadPrec DecreaseNodeGroupsInGlobalReplicationGroupResponse
readList :: ReadS [DecreaseNodeGroupsInGlobalReplicationGroupResponse]
$creadList :: ReadS [DecreaseNodeGroupsInGlobalReplicationGroupResponse]
readsPrec :: Int -> ReadS DecreaseNodeGroupsInGlobalReplicationGroupResponse
$creadsPrec :: Int -> ReadS DecreaseNodeGroupsInGlobalReplicationGroupResponse
Prelude.Read, Int -> DecreaseNodeGroupsInGlobalReplicationGroupResponse -> ShowS
[DecreaseNodeGroupsInGlobalReplicationGroupResponse] -> ShowS
DecreaseNodeGroupsInGlobalReplicationGroupResponse -> String
(Int
 -> DecreaseNodeGroupsInGlobalReplicationGroupResponse -> ShowS)
-> (DecreaseNodeGroupsInGlobalReplicationGroupResponse -> String)
-> ([DecreaseNodeGroupsInGlobalReplicationGroupResponse] -> ShowS)
-> Show DecreaseNodeGroupsInGlobalReplicationGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DecreaseNodeGroupsInGlobalReplicationGroupResponse] -> ShowS
$cshowList :: [DecreaseNodeGroupsInGlobalReplicationGroupResponse] -> ShowS
show :: DecreaseNodeGroupsInGlobalReplicationGroupResponse -> String
$cshow :: DecreaseNodeGroupsInGlobalReplicationGroupResponse -> String
showsPrec :: Int -> DecreaseNodeGroupsInGlobalReplicationGroupResponse -> ShowS
$cshowsPrec :: Int -> DecreaseNodeGroupsInGlobalReplicationGroupResponse -> ShowS
Prelude.Show, (forall x.
 DecreaseNodeGroupsInGlobalReplicationGroupResponse
 -> Rep DecreaseNodeGroupsInGlobalReplicationGroupResponse x)
-> (forall x.
    Rep DecreaseNodeGroupsInGlobalReplicationGroupResponse x
    -> DecreaseNodeGroupsInGlobalReplicationGroupResponse)
-> Generic DecreaseNodeGroupsInGlobalReplicationGroupResponse
forall x.
Rep DecreaseNodeGroupsInGlobalReplicationGroupResponse x
-> DecreaseNodeGroupsInGlobalReplicationGroupResponse
forall x.
DecreaseNodeGroupsInGlobalReplicationGroupResponse
-> Rep DecreaseNodeGroupsInGlobalReplicationGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DecreaseNodeGroupsInGlobalReplicationGroupResponse x
-> DecreaseNodeGroupsInGlobalReplicationGroupResponse
$cfrom :: forall x.
DecreaseNodeGroupsInGlobalReplicationGroupResponse
-> Rep DecreaseNodeGroupsInGlobalReplicationGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'DecreaseNodeGroupsInGlobalReplicationGroupResponse' 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:
--
-- 'globalReplicationGroup', 'decreaseNodeGroupsInGlobalReplicationGroupResponse_globalReplicationGroup' - Undocumented member.
--
-- 'httpStatus', 'decreaseNodeGroupsInGlobalReplicationGroupResponse_httpStatus' - The response's http status code.
newDecreaseNodeGroupsInGlobalReplicationGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DecreaseNodeGroupsInGlobalReplicationGroupResponse
newDecreaseNodeGroupsInGlobalReplicationGroupResponse :: Int -> DecreaseNodeGroupsInGlobalReplicationGroupResponse
newDecreaseNodeGroupsInGlobalReplicationGroupResponse
  Int
pHttpStatus_ =
    DecreaseNodeGroupsInGlobalReplicationGroupResponse' :: Maybe GlobalReplicationGroup
-> Int -> DecreaseNodeGroupsInGlobalReplicationGroupResponse
DecreaseNodeGroupsInGlobalReplicationGroupResponse'
      { $sel:globalReplicationGroup:DecreaseNodeGroupsInGlobalReplicationGroupResponse' :: Maybe GlobalReplicationGroup
globalReplicationGroup =
          Maybe GlobalReplicationGroup
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DecreaseNodeGroupsInGlobalReplicationGroupResponse' :: Int
httpStatus =
          Int
pHttpStatus_
      }

-- | Undocumented member.
decreaseNodeGroupsInGlobalReplicationGroupResponse_globalReplicationGroup :: Lens.Lens' DecreaseNodeGroupsInGlobalReplicationGroupResponse (Prelude.Maybe GlobalReplicationGroup)
decreaseNodeGroupsInGlobalReplicationGroupResponse_globalReplicationGroup :: (Maybe GlobalReplicationGroup -> f (Maybe GlobalReplicationGroup))
-> DecreaseNodeGroupsInGlobalReplicationGroupResponse
-> f DecreaseNodeGroupsInGlobalReplicationGroupResponse
decreaseNodeGroupsInGlobalReplicationGroupResponse_globalReplicationGroup = (DecreaseNodeGroupsInGlobalReplicationGroupResponse
 -> Maybe GlobalReplicationGroup)
-> (DecreaseNodeGroupsInGlobalReplicationGroupResponse
    -> Maybe GlobalReplicationGroup
    -> DecreaseNodeGroupsInGlobalReplicationGroupResponse)
-> Lens
     DecreaseNodeGroupsInGlobalReplicationGroupResponse
     DecreaseNodeGroupsInGlobalReplicationGroupResponse
     (Maybe GlobalReplicationGroup)
     (Maybe GlobalReplicationGroup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DecreaseNodeGroupsInGlobalReplicationGroupResponse' {Maybe GlobalReplicationGroup
globalReplicationGroup :: Maybe GlobalReplicationGroup
$sel:globalReplicationGroup:DecreaseNodeGroupsInGlobalReplicationGroupResponse' :: DecreaseNodeGroupsInGlobalReplicationGroupResponse
-> Maybe GlobalReplicationGroup
globalReplicationGroup} -> Maybe GlobalReplicationGroup
globalReplicationGroup) (\s :: DecreaseNodeGroupsInGlobalReplicationGroupResponse
s@DecreaseNodeGroupsInGlobalReplicationGroupResponse' {} Maybe GlobalReplicationGroup
a -> DecreaseNodeGroupsInGlobalReplicationGroupResponse
s {$sel:globalReplicationGroup:DecreaseNodeGroupsInGlobalReplicationGroupResponse' :: Maybe GlobalReplicationGroup
globalReplicationGroup = Maybe GlobalReplicationGroup
a} :: DecreaseNodeGroupsInGlobalReplicationGroupResponse)

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

instance
  Prelude.NFData
    DecreaseNodeGroupsInGlobalReplicationGroupResponse