{-# 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.ModifyGlobalReplicationGroup
-- 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 the settings for a Global datastore.
module Amazonka.ElastiCache.ModifyGlobalReplicationGroup
  ( -- * Creating a Request
    ModifyGlobalReplicationGroup (..),
    newModifyGlobalReplicationGroup,

    -- * Request Lenses
    modifyGlobalReplicationGroup_automaticFailoverEnabled,
    modifyGlobalReplicationGroup_engineVersion,
    modifyGlobalReplicationGroup_cacheNodeType,
    modifyGlobalReplicationGroup_cacheParameterGroupName,
    modifyGlobalReplicationGroup_globalReplicationGroupDescription,
    modifyGlobalReplicationGroup_globalReplicationGroupId,
    modifyGlobalReplicationGroup_applyImmediately,

    -- * Destructuring the Response
    ModifyGlobalReplicationGroupResponse (..),
    newModifyGlobalReplicationGroupResponse,

    -- * Response Lenses
    modifyGlobalReplicationGroupResponse_globalReplicationGroup,
    modifyGlobalReplicationGroupResponse_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:/ 'newModifyGlobalReplicationGroup' smart constructor.
data ModifyGlobalReplicationGroup = ModifyGlobalReplicationGroup'
  { -- | Determines whether a read replica is automatically promoted to
    -- read\/write primary if the existing primary encounters a failure.
    ModifyGlobalReplicationGroup -> Maybe Bool
automaticFailoverEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The upgraded version of the cache engine to be run on the clusters in
    -- the Global datastore.
    ModifyGlobalReplicationGroup -> Maybe Text
engineVersion :: Prelude.Maybe Prelude.Text,
    -- | A valid cache node type that you want to scale this Global datastore to.
    ModifyGlobalReplicationGroup -> Maybe Text
cacheNodeType :: Prelude.Maybe Prelude.Text,
    -- | The name of the cache parameter group to use with the Global datastore.
    -- It must be compatible with the major engine version used by the Global
    -- datastore.
    ModifyGlobalReplicationGroup -> Maybe Text
cacheParameterGroupName :: Prelude.Maybe Prelude.Text,
    -- | A description of the Global datastore
    ModifyGlobalReplicationGroup -> Maybe Text
globalReplicationGroupDescription :: Prelude.Maybe Prelude.Text,
    -- | The name of the Global datastore
    ModifyGlobalReplicationGroup -> Text
globalReplicationGroupId :: Prelude.Text,
    -- | This parameter causes the modifications in this request and any pending
    -- modifications to be applied, asynchronously and as soon as possible.
    -- Modifications to Global Replication Groups cannot be requested to be
    -- applied in PreferredMaintenceWindow.
    ModifyGlobalReplicationGroup -> Bool
applyImmediately :: Prelude.Bool
  }
  deriving (ModifyGlobalReplicationGroup
-> ModifyGlobalReplicationGroup -> Bool
(ModifyGlobalReplicationGroup
 -> ModifyGlobalReplicationGroup -> Bool)
-> (ModifyGlobalReplicationGroup
    -> ModifyGlobalReplicationGroup -> Bool)
-> Eq ModifyGlobalReplicationGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyGlobalReplicationGroup
-> ModifyGlobalReplicationGroup -> Bool
$c/= :: ModifyGlobalReplicationGroup
-> ModifyGlobalReplicationGroup -> Bool
== :: ModifyGlobalReplicationGroup
-> ModifyGlobalReplicationGroup -> Bool
$c== :: ModifyGlobalReplicationGroup
-> ModifyGlobalReplicationGroup -> Bool
Prelude.Eq, ReadPrec [ModifyGlobalReplicationGroup]
ReadPrec ModifyGlobalReplicationGroup
Int -> ReadS ModifyGlobalReplicationGroup
ReadS [ModifyGlobalReplicationGroup]
(Int -> ReadS ModifyGlobalReplicationGroup)
-> ReadS [ModifyGlobalReplicationGroup]
-> ReadPrec ModifyGlobalReplicationGroup
-> ReadPrec [ModifyGlobalReplicationGroup]
-> Read ModifyGlobalReplicationGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyGlobalReplicationGroup]
$creadListPrec :: ReadPrec [ModifyGlobalReplicationGroup]
readPrec :: ReadPrec ModifyGlobalReplicationGroup
$creadPrec :: ReadPrec ModifyGlobalReplicationGroup
readList :: ReadS [ModifyGlobalReplicationGroup]
$creadList :: ReadS [ModifyGlobalReplicationGroup]
readsPrec :: Int -> ReadS ModifyGlobalReplicationGroup
$creadsPrec :: Int -> ReadS ModifyGlobalReplicationGroup
Prelude.Read, Int -> ModifyGlobalReplicationGroup -> ShowS
[ModifyGlobalReplicationGroup] -> ShowS
ModifyGlobalReplicationGroup -> String
(Int -> ModifyGlobalReplicationGroup -> ShowS)
-> (ModifyGlobalReplicationGroup -> String)
-> ([ModifyGlobalReplicationGroup] -> ShowS)
-> Show ModifyGlobalReplicationGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyGlobalReplicationGroup] -> ShowS
$cshowList :: [ModifyGlobalReplicationGroup] -> ShowS
show :: ModifyGlobalReplicationGroup -> String
$cshow :: ModifyGlobalReplicationGroup -> String
showsPrec :: Int -> ModifyGlobalReplicationGroup -> ShowS
$cshowsPrec :: Int -> ModifyGlobalReplicationGroup -> ShowS
Prelude.Show, (forall x.
 ModifyGlobalReplicationGroup -> Rep ModifyGlobalReplicationGroup x)
-> (forall x.
    Rep ModifyGlobalReplicationGroup x -> ModifyGlobalReplicationGroup)
-> Generic ModifyGlobalReplicationGroup
forall x.
Rep ModifyGlobalReplicationGroup x -> ModifyGlobalReplicationGroup
forall x.
ModifyGlobalReplicationGroup -> Rep ModifyGlobalReplicationGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ModifyGlobalReplicationGroup x -> ModifyGlobalReplicationGroup
$cfrom :: forall x.
ModifyGlobalReplicationGroup -> Rep ModifyGlobalReplicationGroup x
Prelude.Generic)

-- |
-- Create a value of 'ModifyGlobalReplicationGroup' 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:
--
-- 'automaticFailoverEnabled', 'modifyGlobalReplicationGroup_automaticFailoverEnabled' - Determines whether a read replica is automatically promoted to
-- read\/write primary if the existing primary encounters a failure.
--
-- 'engineVersion', 'modifyGlobalReplicationGroup_engineVersion' - The upgraded version of the cache engine to be run on the clusters in
-- the Global datastore.
--
-- 'cacheNodeType', 'modifyGlobalReplicationGroup_cacheNodeType' - A valid cache node type that you want to scale this Global datastore to.
--
-- 'cacheParameterGroupName', 'modifyGlobalReplicationGroup_cacheParameterGroupName' - The name of the cache parameter group to use with the Global datastore.
-- It must be compatible with the major engine version used by the Global
-- datastore.
--
-- 'globalReplicationGroupDescription', 'modifyGlobalReplicationGroup_globalReplicationGroupDescription' - A description of the Global datastore
--
-- 'globalReplicationGroupId', 'modifyGlobalReplicationGroup_globalReplicationGroupId' - The name of the Global datastore
--
-- 'applyImmediately', 'modifyGlobalReplicationGroup_applyImmediately' - This parameter causes the modifications in this request and any pending
-- modifications to be applied, asynchronously and as soon as possible.
-- Modifications to Global Replication Groups cannot be requested to be
-- applied in PreferredMaintenceWindow.
newModifyGlobalReplicationGroup ::
  -- | 'globalReplicationGroupId'
  Prelude.Text ->
  -- | 'applyImmediately'
  Prelude.Bool ->
  ModifyGlobalReplicationGroup
newModifyGlobalReplicationGroup :: Text -> Bool -> ModifyGlobalReplicationGroup
newModifyGlobalReplicationGroup
  Text
pGlobalReplicationGroupId_
  Bool
pApplyImmediately_ =
    ModifyGlobalReplicationGroup' :: Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Bool
-> ModifyGlobalReplicationGroup
ModifyGlobalReplicationGroup'
      { $sel:automaticFailoverEnabled:ModifyGlobalReplicationGroup' :: Maybe Bool
automaticFailoverEnabled =
          Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:engineVersion:ModifyGlobalReplicationGroup' :: Maybe Text
engineVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:cacheNodeType:ModifyGlobalReplicationGroup' :: Maybe Text
cacheNodeType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:cacheParameterGroupName:ModifyGlobalReplicationGroup' :: Maybe Text
cacheParameterGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:globalReplicationGroupDescription:ModifyGlobalReplicationGroup' :: Maybe Text
globalReplicationGroupDescription =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:globalReplicationGroupId:ModifyGlobalReplicationGroup' :: Text
globalReplicationGroupId =
          Text
pGlobalReplicationGroupId_,
        $sel:applyImmediately:ModifyGlobalReplicationGroup' :: Bool
applyImmediately = Bool
pApplyImmediately_
      }

-- | Determines whether a read replica is automatically promoted to
-- read\/write primary if the existing primary encounters a failure.
modifyGlobalReplicationGroup_automaticFailoverEnabled :: Lens.Lens' ModifyGlobalReplicationGroup (Prelude.Maybe Prelude.Bool)
modifyGlobalReplicationGroup_automaticFailoverEnabled :: (Maybe Bool -> f (Maybe Bool))
-> ModifyGlobalReplicationGroup -> f ModifyGlobalReplicationGroup
modifyGlobalReplicationGroup_automaticFailoverEnabled = (ModifyGlobalReplicationGroup -> Maybe Bool)
-> (ModifyGlobalReplicationGroup
    -> Maybe Bool -> ModifyGlobalReplicationGroup)
-> Lens
     ModifyGlobalReplicationGroup
     ModifyGlobalReplicationGroup
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyGlobalReplicationGroup' {Maybe Bool
automaticFailoverEnabled :: Maybe Bool
$sel:automaticFailoverEnabled:ModifyGlobalReplicationGroup' :: ModifyGlobalReplicationGroup -> Maybe Bool
automaticFailoverEnabled} -> Maybe Bool
automaticFailoverEnabled) (\s :: ModifyGlobalReplicationGroup
s@ModifyGlobalReplicationGroup' {} Maybe Bool
a -> ModifyGlobalReplicationGroup
s {$sel:automaticFailoverEnabled:ModifyGlobalReplicationGroup' :: Maybe Bool
automaticFailoverEnabled = Maybe Bool
a} :: ModifyGlobalReplicationGroup)

-- | The upgraded version of the cache engine to be run on the clusters in
-- the Global datastore.
modifyGlobalReplicationGroup_engineVersion :: Lens.Lens' ModifyGlobalReplicationGroup (Prelude.Maybe Prelude.Text)
modifyGlobalReplicationGroup_engineVersion :: (Maybe Text -> f (Maybe Text))
-> ModifyGlobalReplicationGroup -> f ModifyGlobalReplicationGroup
modifyGlobalReplicationGroup_engineVersion = (ModifyGlobalReplicationGroup -> Maybe Text)
-> (ModifyGlobalReplicationGroup
    -> Maybe Text -> ModifyGlobalReplicationGroup)
-> Lens
     ModifyGlobalReplicationGroup
     ModifyGlobalReplicationGroup
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyGlobalReplicationGroup' {Maybe Text
engineVersion :: Maybe Text
$sel:engineVersion:ModifyGlobalReplicationGroup' :: ModifyGlobalReplicationGroup -> Maybe Text
engineVersion} -> Maybe Text
engineVersion) (\s :: ModifyGlobalReplicationGroup
s@ModifyGlobalReplicationGroup' {} Maybe Text
a -> ModifyGlobalReplicationGroup
s {$sel:engineVersion:ModifyGlobalReplicationGroup' :: Maybe Text
engineVersion = Maybe Text
a} :: ModifyGlobalReplicationGroup)

-- | A valid cache node type that you want to scale this Global datastore to.
modifyGlobalReplicationGroup_cacheNodeType :: Lens.Lens' ModifyGlobalReplicationGroup (Prelude.Maybe Prelude.Text)
modifyGlobalReplicationGroup_cacheNodeType :: (Maybe Text -> f (Maybe Text))
-> ModifyGlobalReplicationGroup -> f ModifyGlobalReplicationGroup
modifyGlobalReplicationGroup_cacheNodeType = (ModifyGlobalReplicationGroup -> Maybe Text)
-> (ModifyGlobalReplicationGroup
    -> Maybe Text -> ModifyGlobalReplicationGroup)
-> Lens
     ModifyGlobalReplicationGroup
     ModifyGlobalReplicationGroup
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyGlobalReplicationGroup' {Maybe Text
cacheNodeType :: Maybe Text
$sel:cacheNodeType:ModifyGlobalReplicationGroup' :: ModifyGlobalReplicationGroup -> Maybe Text
cacheNodeType} -> Maybe Text
cacheNodeType) (\s :: ModifyGlobalReplicationGroup
s@ModifyGlobalReplicationGroup' {} Maybe Text
a -> ModifyGlobalReplicationGroup
s {$sel:cacheNodeType:ModifyGlobalReplicationGroup' :: Maybe Text
cacheNodeType = Maybe Text
a} :: ModifyGlobalReplicationGroup)

-- | The name of the cache parameter group to use with the Global datastore.
-- It must be compatible with the major engine version used by the Global
-- datastore.
modifyGlobalReplicationGroup_cacheParameterGroupName :: Lens.Lens' ModifyGlobalReplicationGroup (Prelude.Maybe Prelude.Text)
modifyGlobalReplicationGroup_cacheParameterGroupName :: (Maybe Text -> f (Maybe Text))
-> ModifyGlobalReplicationGroup -> f ModifyGlobalReplicationGroup
modifyGlobalReplicationGroup_cacheParameterGroupName = (ModifyGlobalReplicationGroup -> Maybe Text)
-> (ModifyGlobalReplicationGroup
    -> Maybe Text -> ModifyGlobalReplicationGroup)
-> Lens
     ModifyGlobalReplicationGroup
     ModifyGlobalReplicationGroup
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyGlobalReplicationGroup' {Maybe Text
cacheParameterGroupName :: Maybe Text
$sel:cacheParameterGroupName:ModifyGlobalReplicationGroup' :: ModifyGlobalReplicationGroup -> Maybe Text
cacheParameterGroupName} -> Maybe Text
cacheParameterGroupName) (\s :: ModifyGlobalReplicationGroup
s@ModifyGlobalReplicationGroup' {} Maybe Text
a -> ModifyGlobalReplicationGroup
s {$sel:cacheParameterGroupName:ModifyGlobalReplicationGroup' :: Maybe Text
cacheParameterGroupName = Maybe Text
a} :: ModifyGlobalReplicationGroup)

-- | A description of the Global datastore
modifyGlobalReplicationGroup_globalReplicationGroupDescription :: Lens.Lens' ModifyGlobalReplicationGroup (Prelude.Maybe Prelude.Text)
modifyGlobalReplicationGroup_globalReplicationGroupDescription :: (Maybe Text -> f (Maybe Text))
-> ModifyGlobalReplicationGroup -> f ModifyGlobalReplicationGroup
modifyGlobalReplicationGroup_globalReplicationGroupDescription = (ModifyGlobalReplicationGroup -> Maybe Text)
-> (ModifyGlobalReplicationGroup
    -> Maybe Text -> ModifyGlobalReplicationGroup)
-> Lens
     ModifyGlobalReplicationGroup
     ModifyGlobalReplicationGroup
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyGlobalReplicationGroup' {Maybe Text
globalReplicationGroupDescription :: Maybe Text
$sel:globalReplicationGroupDescription:ModifyGlobalReplicationGroup' :: ModifyGlobalReplicationGroup -> Maybe Text
globalReplicationGroupDescription} -> Maybe Text
globalReplicationGroupDescription) (\s :: ModifyGlobalReplicationGroup
s@ModifyGlobalReplicationGroup' {} Maybe Text
a -> ModifyGlobalReplicationGroup
s {$sel:globalReplicationGroupDescription:ModifyGlobalReplicationGroup' :: Maybe Text
globalReplicationGroupDescription = Maybe Text
a} :: ModifyGlobalReplicationGroup)

-- | The name of the Global datastore
modifyGlobalReplicationGroup_globalReplicationGroupId :: Lens.Lens' ModifyGlobalReplicationGroup Prelude.Text
modifyGlobalReplicationGroup_globalReplicationGroupId :: (Text -> f Text)
-> ModifyGlobalReplicationGroup -> f ModifyGlobalReplicationGroup
modifyGlobalReplicationGroup_globalReplicationGroupId = (ModifyGlobalReplicationGroup -> Text)
-> (ModifyGlobalReplicationGroup
    -> Text -> ModifyGlobalReplicationGroup)
-> Lens
     ModifyGlobalReplicationGroup ModifyGlobalReplicationGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyGlobalReplicationGroup' {Text
globalReplicationGroupId :: Text
$sel:globalReplicationGroupId:ModifyGlobalReplicationGroup' :: ModifyGlobalReplicationGroup -> Text
globalReplicationGroupId} -> Text
globalReplicationGroupId) (\s :: ModifyGlobalReplicationGroup
s@ModifyGlobalReplicationGroup' {} Text
a -> ModifyGlobalReplicationGroup
s {$sel:globalReplicationGroupId:ModifyGlobalReplicationGroup' :: Text
globalReplicationGroupId = Text
a} :: ModifyGlobalReplicationGroup)

-- | This parameter causes the modifications in this request and any pending
-- modifications to be applied, asynchronously and as soon as possible.
-- Modifications to Global Replication Groups cannot be requested to be
-- applied in PreferredMaintenceWindow.
modifyGlobalReplicationGroup_applyImmediately :: Lens.Lens' ModifyGlobalReplicationGroup Prelude.Bool
modifyGlobalReplicationGroup_applyImmediately :: (Bool -> f Bool)
-> ModifyGlobalReplicationGroup -> f ModifyGlobalReplicationGroup
modifyGlobalReplicationGroup_applyImmediately = (ModifyGlobalReplicationGroup -> Bool)
-> (ModifyGlobalReplicationGroup
    -> Bool -> ModifyGlobalReplicationGroup)
-> Lens
     ModifyGlobalReplicationGroup ModifyGlobalReplicationGroup Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyGlobalReplicationGroup' {Bool
applyImmediately :: Bool
$sel:applyImmediately:ModifyGlobalReplicationGroup' :: ModifyGlobalReplicationGroup -> Bool
applyImmediately} -> Bool
applyImmediately) (\s :: ModifyGlobalReplicationGroup
s@ModifyGlobalReplicationGroup' {} Bool
a -> ModifyGlobalReplicationGroup
s {$sel:applyImmediately:ModifyGlobalReplicationGroup' :: Bool
applyImmediately = Bool
a} :: ModifyGlobalReplicationGroup)

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

instance Prelude.NFData ModifyGlobalReplicationGroup

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

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

instance Core.ToQuery ModifyGlobalReplicationGroup where
  toQuery :: ModifyGlobalReplicationGroup -> QueryString
toQuery ModifyGlobalReplicationGroup' {Bool
Maybe Bool
Maybe Text
Text
applyImmediately :: Bool
globalReplicationGroupId :: Text
globalReplicationGroupDescription :: Maybe Text
cacheParameterGroupName :: Maybe Text
cacheNodeType :: Maybe Text
engineVersion :: Maybe Text
automaticFailoverEnabled :: Maybe Bool
$sel:applyImmediately:ModifyGlobalReplicationGroup' :: ModifyGlobalReplicationGroup -> Bool
$sel:globalReplicationGroupId:ModifyGlobalReplicationGroup' :: ModifyGlobalReplicationGroup -> Text
$sel:globalReplicationGroupDescription:ModifyGlobalReplicationGroup' :: ModifyGlobalReplicationGroup -> Maybe Text
$sel:cacheParameterGroupName:ModifyGlobalReplicationGroup' :: ModifyGlobalReplicationGroup -> Maybe Text
$sel:cacheNodeType:ModifyGlobalReplicationGroup' :: ModifyGlobalReplicationGroup -> Maybe Text
$sel:engineVersion:ModifyGlobalReplicationGroup' :: ModifyGlobalReplicationGroup -> Maybe Text
$sel:automaticFailoverEnabled:ModifyGlobalReplicationGroup' :: ModifyGlobalReplicationGroup -> Maybe Bool
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ( ByteString
"ModifyGlobalReplicationGroup" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
        ByteString
"AutomaticFailoverEnabled"
          ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
automaticFailoverEnabled,
        ByteString
"EngineVersion" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
engineVersion,
        ByteString
"CacheNodeType" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
cacheNodeType,
        ByteString
"CacheParameterGroupName"
          ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
cacheParameterGroupName,
        ByteString
"GlobalReplicationGroupDescription"
          ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
globalReplicationGroupDescription,
        ByteString
"GlobalReplicationGroupId"
          ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
globalReplicationGroupId,
        ByteString
"ApplyImmediately" ByteString -> Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Bool
applyImmediately
      ]

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

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

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

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

instance
  Prelude.NFData
    ModifyGlobalReplicationGroupResponse