{-# 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.RDS.ResetDBClusterParameterGroup
-- 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 DB cluster parameter group to the default
-- value. To reset specific parameters submit a list of the following:
-- @ParameterName@ and @ApplyMethod@. To reset the entire DB cluster
-- parameter group, specify the @DBClusterParameterGroupName@ and
-- @ResetAllParameters@ parameters.
--
-- When resetting the entire group, dynamic parameters are updated
-- immediately and static parameters are set to @pending-reboot@ to take
-- effect on the next DB instance restart or @RebootDBInstance@ request.
-- You must call @RebootDBInstance@ for every DB instance in your DB
-- cluster that you want the updated static parameter to apply to.
--
-- For more information on Amazon Aurora, see
-- <https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html What Is Amazon Aurora?>
-- in the /Amazon Aurora User Guide./
--
-- This action only applies to Aurora DB clusters.
module Amazonka.RDS.ResetDBClusterParameterGroup
  ( -- * Creating a Request
    ResetDBClusterParameterGroup (..),
    newResetDBClusterParameterGroup,

    -- * Request Lenses
    resetDBClusterParameterGroup_resetAllParameters,
    resetDBClusterParameterGroup_parameters,
    resetDBClusterParameterGroup_dbClusterParameterGroupName,

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

    -- * Response Lenses
    dbClusterParameterGroupNameMessage_dbClusterParameterGroupName,
  )
where

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

-- |
--
-- /See:/ 'newResetDBClusterParameterGroup' smart constructor.
data ResetDBClusterParameterGroup = ResetDBClusterParameterGroup'
  { -- | A value that indicates whether to reset all parameters in the DB cluster
    -- parameter group to their default values. You can\'t use this parameter
    -- if there is a list of parameter names specified for the @Parameters@
    -- parameter.
    ResetDBClusterParameterGroup -> Maybe Bool
resetAllParameters :: Prelude.Maybe Prelude.Bool,
    -- | A list of parameter names in the DB cluster parameter group to reset to
    -- the default values. You can\'t use this parameter if the
    -- @ResetAllParameters@ parameter is enabled.
    ResetDBClusterParameterGroup -> Maybe [Parameter]
parameters :: Prelude.Maybe [Parameter],
    -- | The name of the DB cluster parameter group to reset.
    ResetDBClusterParameterGroup -> Text
dbClusterParameterGroupName :: Prelude.Text
  }
  deriving (ResetDBClusterParameterGroup
-> ResetDBClusterParameterGroup -> Bool
(ResetDBClusterParameterGroup
 -> ResetDBClusterParameterGroup -> Bool)
-> (ResetDBClusterParameterGroup
    -> ResetDBClusterParameterGroup -> Bool)
-> Eq ResetDBClusterParameterGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResetDBClusterParameterGroup
-> ResetDBClusterParameterGroup -> Bool
$c/= :: ResetDBClusterParameterGroup
-> ResetDBClusterParameterGroup -> Bool
== :: ResetDBClusterParameterGroup
-> ResetDBClusterParameterGroup -> Bool
$c== :: ResetDBClusterParameterGroup
-> ResetDBClusterParameterGroup -> Bool
Prelude.Eq, ReadPrec [ResetDBClusterParameterGroup]
ReadPrec ResetDBClusterParameterGroup
Int -> ReadS ResetDBClusterParameterGroup
ReadS [ResetDBClusterParameterGroup]
(Int -> ReadS ResetDBClusterParameterGroup)
-> ReadS [ResetDBClusterParameterGroup]
-> ReadPrec ResetDBClusterParameterGroup
-> ReadPrec [ResetDBClusterParameterGroup]
-> Read ResetDBClusterParameterGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResetDBClusterParameterGroup]
$creadListPrec :: ReadPrec [ResetDBClusterParameterGroup]
readPrec :: ReadPrec ResetDBClusterParameterGroup
$creadPrec :: ReadPrec ResetDBClusterParameterGroup
readList :: ReadS [ResetDBClusterParameterGroup]
$creadList :: ReadS [ResetDBClusterParameterGroup]
readsPrec :: Int -> ReadS ResetDBClusterParameterGroup
$creadsPrec :: Int -> ReadS ResetDBClusterParameterGroup
Prelude.Read, Int -> ResetDBClusterParameterGroup -> ShowS
[ResetDBClusterParameterGroup] -> ShowS
ResetDBClusterParameterGroup -> String
(Int -> ResetDBClusterParameterGroup -> ShowS)
-> (ResetDBClusterParameterGroup -> String)
-> ([ResetDBClusterParameterGroup] -> ShowS)
-> Show ResetDBClusterParameterGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResetDBClusterParameterGroup] -> ShowS
$cshowList :: [ResetDBClusterParameterGroup] -> ShowS
show :: ResetDBClusterParameterGroup -> String
$cshow :: ResetDBClusterParameterGroup -> String
showsPrec :: Int -> ResetDBClusterParameterGroup -> ShowS
$cshowsPrec :: Int -> ResetDBClusterParameterGroup -> ShowS
Prelude.Show, (forall x.
 ResetDBClusterParameterGroup -> Rep ResetDBClusterParameterGroup x)
-> (forall x.
    Rep ResetDBClusterParameterGroup x -> ResetDBClusterParameterGroup)
-> Generic ResetDBClusterParameterGroup
forall x.
Rep ResetDBClusterParameterGroup x -> ResetDBClusterParameterGroup
forall x.
ResetDBClusterParameterGroup -> Rep ResetDBClusterParameterGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ResetDBClusterParameterGroup x -> ResetDBClusterParameterGroup
$cfrom :: forall x.
ResetDBClusterParameterGroup -> Rep ResetDBClusterParameterGroup x
Prelude.Generic)

-- |
-- Create a value of 'ResetDBClusterParameterGroup' 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:
--
-- 'resetAllParameters', 'resetDBClusterParameterGroup_resetAllParameters' - A value that indicates whether to reset all parameters in the DB cluster
-- parameter group to their default values. You can\'t use this parameter
-- if there is a list of parameter names specified for the @Parameters@
-- parameter.
--
-- 'parameters', 'resetDBClusterParameterGroup_parameters' - A list of parameter names in the DB cluster parameter group to reset to
-- the default values. You can\'t use this parameter if the
-- @ResetAllParameters@ parameter is enabled.
--
-- 'dbClusterParameterGroupName', 'resetDBClusterParameterGroup_dbClusterParameterGroupName' - The name of the DB cluster parameter group to reset.
newResetDBClusterParameterGroup ::
  -- | 'dbClusterParameterGroupName'
  Prelude.Text ->
  ResetDBClusterParameterGroup
newResetDBClusterParameterGroup :: Text -> ResetDBClusterParameterGroup
newResetDBClusterParameterGroup
  Text
pDBClusterParameterGroupName_ =
    ResetDBClusterParameterGroup' :: Maybe Bool
-> Maybe [Parameter] -> Text -> ResetDBClusterParameterGroup
ResetDBClusterParameterGroup'
      { $sel:resetAllParameters:ResetDBClusterParameterGroup' :: Maybe Bool
resetAllParameters =
          Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:parameters:ResetDBClusterParameterGroup' :: Maybe [Parameter]
parameters = Maybe [Parameter]
forall a. Maybe a
Prelude.Nothing,
        $sel:dbClusterParameterGroupName:ResetDBClusterParameterGroup' :: Text
dbClusterParameterGroupName =
          Text
pDBClusterParameterGroupName_
      }

-- | A value that indicates whether to reset all parameters in the DB cluster
-- parameter group to their default values. You can\'t use this parameter
-- if there is a list of parameter names specified for the @Parameters@
-- parameter.
resetDBClusterParameterGroup_resetAllParameters :: Lens.Lens' ResetDBClusterParameterGroup (Prelude.Maybe Prelude.Bool)
resetDBClusterParameterGroup_resetAllParameters :: (Maybe Bool -> f (Maybe Bool))
-> ResetDBClusterParameterGroup -> f ResetDBClusterParameterGroup
resetDBClusterParameterGroup_resetAllParameters = (ResetDBClusterParameterGroup -> Maybe Bool)
-> (ResetDBClusterParameterGroup
    -> Maybe Bool -> ResetDBClusterParameterGroup)
-> Lens
     ResetDBClusterParameterGroup
     ResetDBClusterParameterGroup
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetDBClusterParameterGroup' {Maybe Bool
resetAllParameters :: Maybe Bool
$sel:resetAllParameters:ResetDBClusterParameterGroup' :: ResetDBClusterParameterGroup -> Maybe Bool
resetAllParameters} -> Maybe Bool
resetAllParameters) (\s :: ResetDBClusterParameterGroup
s@ResetDBClusterParameterGroup' {} Maybe Bool
a -> ResetDBClusterParameterGroup
s {$sel:resetAllParameters:ResetDBClusterParameterGroup' :: Maybe Bool
resetAllParameters = Maybe Bool
a} :: ResetDBClusterParameterGroup)

-- | A list of parameter names in the DB cluster parameter group to reset to
-- the default values. You can\'t use this parameter if the
-- @ResetAllParameters@ parameter is enabled.
resetDBClusterParameterGroup_parameters :: Lens.Lens' ResetDBClusterParameterGroup (Prelude.Maybe [Parameter])
resetDBClusterParameterGroup_parameters :: (Maybe [Parameter] -> f (Maybe [Parameter]))
-> ResetDBClusterParameterGroup -> f ResetDBClusterParameterGroup
resetDBClusterParameterGroup_parameters = (ResetDBClusterParameterGroup -> Maybe [Parameter])
-> (ResetDBClusterParameterGroup
    -> Maybe [Parameter] -> ResetDBClusterParameterGroup)
-> Lens
     ResetDBClusterParameterGroup
     ResetDBClusterParameterGroup
     (Maybe [Parameter])
     (Maybe [Parameter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetDBClusterParameterGroup' {Maybe [Parameter]
parameters :: Maybe [Parameter]
$sel:parameters:ResetDBClusterParameterGroup' :: ResetDBClusterParameterGroup -> Maybe [Parameter]
parameters} -> Maybe [Parameter]
parameters) (\s :: ResetDBClusterParameterGroup
s@ResetDBClusterParameterGroup' {} Maybe [Parameter]
a -> ResetDBClusterParameterGroup
s {$sel:parameters:ResetDBClusterParameterGroup' :: Maybe [Parameter]
parameters = Maybe [Parameter]
a} :: ResetDBClusterParameterGroup) ((Maybe [Parameter] -> f (Maybe [Parameter]))
 -> ResetDBClusterParameterGroup -> f ResetDBClusterParameterGroup)
-> ((Maybe [Parameter] -> f (Maybe [Parameter]))
    -> Maybe [Parameter] -> f (Maybe [Parameter]))
-> (Maybe [Parameter] -> f (Maybe [Parameter]))
-> ResetDBClusterParameterGroup
-> f ResetDBClusterParameterGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Parameter] [Parameter] [Parameter] [Parameter]
-> Iso
     (Maybe [Parameter])
     (Maybe [Parameter])
     (Maybe [Parameter])
     (Maybe [Parameter])
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 [Parameter] [Parameter] [Parameter] [Parameter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance Prelude.NFData ResetDBClusterParameterGroup

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

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

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