{-# 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.DocumentDB.ModifyDBClusterParameterGroup
-- 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 parameters of a cluster parameter group. To modify more
-- than one parameter, submit a list of the following: @ParameterName@,
-- @ParameterValue@, and @ApplyMethod@. A maximum of 20 parameters can be
-- modified in a single request.
--
-- Changes to dynamic parameters are applied immediately. Changes to static
-- parameters require a reboot or maintenance window before the change can
-- take effect.
--
-- After you create a cluster parameter group, you should wait at least 5
-- minutes before creating your first cluster that uses that cluster
-- parameter group as the default parameter group. This allows Amazon
-- DocumentDB to fully complete the create action before the parameter
-- group is used as the default for a new cluster. This step is especially
-- important for parameters that are critical when creating the default
-- database for a cluster, such as the character set for the default
-- database defined by the @character_set_database@ parameter.
module Amazonka.DocumentDB.ModifyDBClusterParameterGroup
  ( -- * Creating a Request
    ModifyDBClusterParameterGroup (..),
    newModifyDBClusterParameterGroup,

    -- * Request Lenses
    modifyDBClusterParameterGroup_dbClusterParameterGroupName,
    modifyDBClusterParameterGroup_parameters,

    -- * Destructuring the Response
    DBClusterParameterGroupNameMessage (..),
    newDBClusterParameterGroupNameMessage,

    -- * Response Lenses
    dbClusterParameterGroupNameMessage_dbClusterParameterGroupName,
  )
where

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

-- | Represents the input to ModifyDBClusterParameterGroup.
--
-- /See:/ 'newModifyDBClusterParameterGroup' smart constructor.
data ModifyDBClusterParameterGroup = ModifyDBClusterParameterGroup'
  { -- | The name of the cluster parameter group to modify.
    ModifyDBClusterParameterGroup -> Text
dbClusterParameterGroupName :: Prelude.Text,
    -- | A list of parameters in the cluster parameter group to modify.
    ModifyDBClusterParameterGroup -> [Parameter]
parameters :: [Parameter]
  }
  deriving (ModifyDBClusterParameterGroup
-> ModifyDBClusterParameterGroup -> Bool
(ModifyDBClusterParameterGroup
 -> ModifyDBClusterParameterGroup -> Bool)
-> (ModifyDBClusterParameterGroup
    -> ModifyDBClusterParameterGroup -> Bool)
-> Eq ModifyDBClusterParameterGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyDBClusterParameterGroup
-> ModifyDBClusterParameterGroup -> Bool
$c/= :: ModifyDBClusterParameterGroup
-> ModifyDBClusterParameterGroup -> Bool
== :: ModifyDBClusterParameterGroup
-> ModifyDBClusterParameterGroup -> Bool
$c== :: ModifyDBClusterParameterGroup
-> ModifyDBClusterParameterGroup -> Bool
Prelude.Eq, ReadPrec [ModifyDBClusterParameterGroup]
ReadPrec ModifyDBClusterParameterGroup
Int -> ReadS ModifyDBClusterParameterGroup
ReadS [ModifyDBClusterParameterGroup]
(Int -> ReadS ModifyDBClusterParameterGroup)
-> ReadS [ModifyDBClusterParameterGroup]
-> ReadPrec ModifyDBClusterParameterGroup
-> ReadPrec [ModifyDBClusterParameterGroup]
-> Read ModifyDBClusterParameterGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyDBClusterParameterGroup]
$creadListPrec :: ReadPrec [ModifyDBClusterParameterGroup]
readPrec :: ReadPrec ModifyDBClusterParameterGroup
$creadPrec :: ReadPrec ModifyDBClusterParameterGroup
readList :: ReadS [ModifyDBClusterParameterGroup]
$creadList :: ReadS [ModifyDBClusterParameterGroup]
readsPrec :: Int -> ReadS ModifyDBClusterParameterGroup
$creadsPrec :: Int -> ReadS ModifyDBClusterParameterGroup
Prelude.Read, Int -> ModifyDBClusterParameterGroup -> ShowS
[ModifyDBClusterParameterGroup] -> ShowS
ModifyDBClusterParameterGroup -> String
(Int -> ModifyDBClusterParameterGroup -> ShowS)
-> (ModifyDBClusterParameterGroup -> String)
-> ([ModifyDBClusterParameterGroup] -> ShowS)
-> Show ModifyDBClusterParameterGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyDBClusterParameterGroup] -> ShowS
$cshowList :: [ModifyDBClusterParameterGroup] -> ShowS
show :: ModifyDBClusterParameterGroup -> String
$cshow :: ModifyDBClusterParameterGroup -> String
showsPrec :: Int -> ModifyDBClusterParameterGroup -> ShowS
$cshowsPrec :: Int -> ModifyDBClusterParameterGroup -> ShowS
Prelude.Show, (forall x.
 ModifyDBClusterParameterGroup
 -> Rep ModifyDBClusterParameterGroup x)
-> (forall x.
    Rep ModifyDBClusterParameterGroup x
    -> ModifyDBClusterParameterGroup)
-> Generic ModifyDBClusterParameterGroup
forall x.
Rep ModifyDBClusterParameterGroup x
-> ModifyDBClusterParameterGroup
forall x.
ModifyDBClusterParameterGroup
-> Rep ModifyDBClusterParameterGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ModifyDBClusterParameterGroup x
-> ModifyDBClusterParameterGroup
$cfrom :: forall x.
ModifyDBClusterParameterGroup
-> Rep ModifyDBClusterParameterGroup x
Prelude.Generic)

-- |
-- Create a value of 'ModifyDBClusterParameterGroup' 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:
--
-- 'dbClusterParameterGroupName', 'modifyDBClusterParameterGroup_dbClusterParameterGroupName' - The name of the cluster parameter group to modify.
--
-- 'parameters', 'modifyDBClusterParameterGroup_parameters' - A list of parameters in the cluster parameter group to modify.
newModifyDBClusterParameterGroup ::
  -- | 'dbClusterParameterGroupName'
  Prelude.Text ->
  ModifyDBClusterParameterGroup
newModifyDBClusterParameterGroup :: Text -> ModifyDBClusterParameterGroup
newModifyDBClusterParameterGroup
  Text
pDBClusterParameterGroupName_ =
    ModifyDBClusterParameterGroup' :: Text -> [Parameter] -> ModifyDBClusterParameterGroup
ModifyDBClusterParameterGroup'
      { $sel:dbClusterParameterGroupName:ModifyDBClusterParameterGroup' :: Text
dbClusterParameterGroupName =
          Text
pDBClusterParameterGroupName_,
        $sel:parameters:ModifyDBClusterParameterGroup' :: [Parameter]
parameters = [Parameter]
forall a. Monoid a => a
Prelude.mempty
      }

-- | The name of the cluster parameter group to modify.
modifyDBClusterParameterGroup_dbClusterParameterGroupName :: Lens.Lens' ModifyDBClusterParameterGroup Prelude.Text
modifyDBClusterParameterGroup_dbClusterParameterGroupName :: (Text -> f Text)
-> ModifyDBClusterParameterGroup -> f ModifyDBClusterParameterGroup
modifyDBClusterParameterGroup_dbClusterParameterGroupName = (ModifyDBClusterParameterGroup -> Text)
-> (ModifyDBClusterParameterGroup
    -> Text -> ModifyDBClusterParameterGroup)
-> Lens
     ModifyDBClusterParameterGroup
     ModifyDBClusterParameterGroup
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyDBClusterParameterGroup' {Text
dbClusterParameterGroupName :: Text
$sel:dbClusterParameterGroupName:ModifyDBClusterParameterGroup' :: ModifyDBClusterParameterGroup -> Text
dbClusterParameterGroupName} -> Text
dbClusterParameterGroupName) (\s :: ModifyDBClusterParameterGroup
s@ModifyDBClusterParameterGroup' {} Text
a -> ModifyDBClusterParameterGroup
s {$sel:dbClusterParameterGroupName:ModifyDBClusterParameterGroup' :: Text
dbClusterParameterGroupName = Text
a} :: ModifyDBClusterParameterGroup)

-- | A list of parameters in the cluster parameter group to modify.
modifyDBClusterParameterGroup_parameters :: Lens.Lens' ModifyDBClusterParameterGroup [Parameter]
modifyDBClusterParameterGroup_parameters :: ([Parameter] -> f [Parameter])
-> ModifyDBClusterParameterGroup -> f ModifyDBClusterParameterGroup
modifyDBClusterParameterGroup_parameters = (ModifyDBClusterParameterGroup -> [Parameter])
-> (ModifyDBClusterParameterGroup
    -> [Parameter] -> ModifyDBClusterParameterGroup)
-> Lens
     ModifyDBClusterParameterGroup
     ModifyDBClusterParameterGroup
     [Parameter]
     [Parameter]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyDBClusterParameterGroup' {[Parameter]
parameters :: [Parameter]
$sel:parameters:ModifyDBClusterParameterGroup' :: ModifyDBClusterParameterGroup -> [Parameter]
parameters} -> [Parameter]
parameters) (\s :: ModifyDBClusterParameterGroup
s@ModifyDBClusterParameterGroup' {} [Parameter]
a -> ModifyDBClusterParameterGroup
s {$sel:parameters:ModifyDBClusterParameterGroup' :: [Parameter]
parameters = [Parameter]
a} :: ModifyDBClusterParameterGroup) (([Parameter] -> f [Parameter])
 -> ModifyDBClusterParameterGroup
 -> f ModifyDBClusterParameterGroup)
-> (([Parameter] -> f [Parameter]) -> [Parameter] -> f [Parameter])
-> ([Parameter] -> f [Parameter])
-> ModifyDBClusterParameterGroup
-> f ModifyDBClusterParameterGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Parameter] -> f [Parameter]) -> [Parameter] -> f [Parameter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.Hashable
    ModifyDBClusterParameterGroup

instance Prelude.NFData ModifyDBClusterParameterGroup

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

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

instance Core.ToQuery ModifyDBClusterParameterGroup where
  toQuery :: ModifyDBClusterParameterGroup -> QueryString
toQuery ModifyDBClusterParameterGroup' {[Parameter]
Text
parameters :: [Parameter]
dbClusterParameterGroupName :: Text
$sel:parameters:ModifyDBClusterParameterGroup' :: ModifyDBClusterParameterGroup -> [Parameter]
$sel:dbClusterParameterGroupName:ModifyDBClusterParameterGroup' :: ModifyDBClusterParameterGroup -> 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
"ModifyDBClusterParameterGroup" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"DBClusterParameterGroupName"
          ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbClusterParameterGroupName,
        ByteString
"Parameters"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ByteString -> [Parameter] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"Parameter" [Parameter]
parameters
      ]