{-# 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.Neptune.ResetDBParameterGroup
-- 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 parameter group to the engine\/system
-- default value. To reset specific parameters, provide a list of the
-- following: @ParameterName@ and @ApplyMethod@. To reset the entire DB
-- parameter group, specify the @DBParameterGroup@ name 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.
module Amazonka.Neptune.ResetDBParameterGroup
  ( -- * Creating a Request
    ResetDBParameterGroup (..),
    newResetDBParameterGroup,

    -- * Request Lenses
    resetDBParameterGroup_resetAllParameters,
    resetDBParameterGroup_parameters,
    resetDBParameterGroup_dbParameterGroupName,

    -- * Destructuring the Response
    DBParameterGroupNameMessage (..),
    newDBParameterGroupNameMessage,

    -- * Response Lenses
    dbParameterGroupNameMessage_dbParameterGroupName,
  )
where

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

-- | /See:/ 'newResetDBParameterGroup' smart constructor.
data ResetDBParameterGroup = ResetDBParameterGroup'
  { -- | Specifies whether (@true@) or not (@false@) to reset all parameters in
    -- the DB parameter group to default values.
    --
    -- Default: @true@
    ResetDBParameterGroup -> Maybe Bool
resetAllParameters :: Prelude.Maybe Prelude.Bool,
    -- | To reset the entire DB parameter group, specify the @DBParameterGroup@
    -- name and @ResetAllParameters@ parameters. To reset specific parameters,
    -- provide a list of the following: @ParameterName@ and @ApplyMethod@. A
    -- maximum of 20 parameters can be modified in a single request.
    --
    -- Valid Values (for Apply method): @pending-reboot@
    ResetDBParameterGroup -> Maybe [Parameter]
parameters :: Prelude.Maybe [Parameter],
    -- | The name of the DB parameter group.
    --
    -- Constraints:
    --
    -- -   Must match the name of an existing DBParameterGroup.
    ResetDBParameterGroup -> Text
dbParameterGroupName :: Prelude.Text
  }
  deriving (ResetDBParameterGroup -> ResetDBParameterGroup -> Bool
(ResetDBParameterGroup -> ResetDBParameterGroup -> Bool)
-> (ResetDBParameterGroup -> ResetDBParameterGroup -> Bool)
-> Eq ResetDBParameterGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResetDBParameterGroup -> ResetDBParameterGroup -> Bool
$c/= :: ResetDBParameterGroup -> ResetDBParameterGroup -> Bool
== :: ResetDBParameterGroup -> ResetDBParameterGroup -> Bool
$c== :: ResetDBParameterGroup -> ResetDBParameterGroup -> Bool
Prelude.Eq, ReadPrec [ResetDBParameterGroup]
ReadPrec ResetDBParameterGroup
Int -> ReadS ResetDBParameterGroup
ReadS [ResetDBParameterGroup]
(Int -> ReadS ResetDBParameterGroup)
-> ReadS [ResetDBParameterGroup]
-> ReadPrec ResetDBParameterGroup
-> ReadPrec [ResetDBParameterGroup]
-> Read ResetDBParameterGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResetDBParameterGroup]
$creadListPrec :: ReadPrec [ResetDBParameterGroup]
readPrec :: ReadPrec ResetDBParameterGroup
$creadPrec :: ReadPrec ResetDBParameterGroup
readList :: ReadS [ResetDBParameterGroup]
$creadList :: ReadS [ResetDBParameterGroup]
readsPrec :: Int -> ReadS ResetDBParameterGroup
$creadsPrec :: Int -> ReadS ResetDBParameterGroup
Prelude.Read, Int -> ResetDBParameterGroup -> ShowS
[ResetDBParameterGroup] -> ShowS
ResetDBParameterGroup -> String
(Int -> ResetDBParameterGroup -> ShowS)
-> (ResetDBParameterGroup -> String)
-> ([ResetDBParameterGroup] -> ShowS)
-> Show ResetDBParameterGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResetDBParameterGroup] -> ShowS
$cshowList :: [ResetDBParameterGroup] -> ShowS
show :: ResetDBParameterGroup -> String
$cshow :: ResetDBParameterGroup -> String
showsPrec :: Int -> ResetDBParameterGroup -> ShowS
$cshowsPrec :: Int -> ResetDBParameterGroup -> ShowS
Prelude.Show, (forall x. ResetDBParameterGroup -> Rep ResetDBParameterGroup x)
-> (forall x. Rep ResetDBParameterGroup x -> ResetDBParameterGroup)
-> Generic ResetDBParameterGroup
forall x. Rep ResetDBParameterGroup x -> ResetDBParameterGroup
forall x. ResetDBParameterGroup -> Rep ResetDBParameterGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResetDBParameterGroup x -> ResetDBParameterGroup
$cfrom :: forall x. ResetDBParameterGroup -> Rep ResetDBParameterGroup x
Prelude.Generic)

-- |
-- Create a value of 'ResetDBParameterGroup' 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', 'resetDBParameterGroup_resetAllParameters' - Specifies whether (@true@) or not (@false@) to reset all parameters in
-- the DB parameter group to default values.
--
-- Default: @true@
--
-- 'parameters', 'resetDBParameterGroup_parameters' - To reset the entire DB parameter group, specify the @DBParameterGroup@
-- name and @ResetAllParameters@ parameters. To reset specific parameters,
-- provide a list of the following: @ParameterName@ and @ApplyMethod@. A
-- maximum of 20 parameters can be modified in a single request.
--
-- Valid Values (for Apply method): @pending-reboot@
--
-- 'dbParameterGroupName', 'resetDBParameterGroup_dbParameterGroupName' - The name of the DB parameter group.
--
-- Constraints:
--
-- -   Must match the name of an existing DBParameterGroup.
newResetDBParameterGroup ::
  -- | 'dbParameterGroupName'
  Prelude.Text ->
  ResetDBParameterGroup
newResetDBParameterGroup :: Text -> ResetDBParameterGroup
newResetDBParameterGroup Text
pDBParameterGroupName_ =
  ResetDBParameterGroup' :: Maybe Bool -> Maybe [Parameter] -> Text -> ResetDBParameterGroup
ResetDBParameterGroup'
    { $sel:resetAllParameters:ResetDBParameterGroup' :: Maybe Bool
resetAllParameters =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:parameters:ResetDBParameterGroup' :: Maybe [Parameter]
parameters = Maybe [Parameter]
forall a. Maybe a
Prelude.Nothing,
      $sel:dbParameterGroupName:ResetDBParameterGroup' :: Text
dbParameterGroupName = Text
pDBParameterGroupName_
    }

-- | Specifies whether (@true@) or not (@false@) to reset all parameters in
-- the DB parameter group to default values.
--
-- Default: @true@
resetDBParameterGroup_resetAllParameters :: Lens.Lens' ResetDBParameterGroup (Prelude.Maybe Prelude.Bool)
resetDBParameterGroup_resetAllParameters :: (Maybe Bool -> f (Maybe Bool))
-> ResetDBParameterGroup -> f ResetDBParameterGroup
resetDBParameterGroup_resetAllParameters = (ResetDBParameterGroup -> Maybe Bool)
-> (ResetDBParameterGroup -> Maybe Bool -> ResetDBParameterGroup)
-> Lens
     ResetDBParameterGroup
     ResetDBParameterGroup
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetDBParameterGroup' {Maybe Bool
resetAllParameters :: Maybe Bool
$sel:resetAllParameters:ResetDBParameterGroup' :: ResetDBParameterGroup -> Maybe Bool
resetAllParameters} -> Maybe Bool
resetAllParameters) (\s :: ResetDBParameterGroup
s@ResetDBParameterGroup' {} Maybe Bool
a -> ResetDBParameterGroup
s {$sel:resetAllParameters:ResetDBParameterGroup' :: Maybe Bool
resetAllParameters = Maybe Bool
a} :: ResetDBParameterGroup)

-- | To reset the entire DB parameter group, specify the @DBParameterGroup@
-- name and @ResetAllParameters@ parameters. To reset specific parameters,
-- provide a list of the following: @ParameterName@ and @ApplyMethod@. A
-- maximum of 20 parameters can be modified in a single request.
--
-- Valid Values (for Apply method): @pending-reboot@
resetDBParameterGroup_parameters :: Lens.Lens' ResetDBParameterGroup (Prelude.Maybe [Parameter])
resetDBParameterGroup_parameters :: (Maybe [Parameter] -> f (Maybe [Parameter]))
-> ResetDBParameterGroup -> f ResetDBParameterGroup
resetDBParameterGroup_parameters = (ResetDBParameterGroup -> Maybe [Parameter])
-> (ResetDBParameterGroup
    -> Maybe [Parameter] -> ResetDBParameterGroup)
-> Lens
     ResetDBParameterGroup
     ResetDBParameterGroup
     (Maybe [Parameter])
     (Maybe [Parameter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetDBParameterGroup' {Maybe [Parameter]
parameters :: Maybe [Parameter]
$sel:parameters:ResetDBParameterGroup' :: ResetDBParameterGroup -> Maybe [Parameter]
parameters} -> Maybe [Parameter]
parameters) (\s :: ResetDBParameterGroup
s@ResetDBParameterGroup' {} Maybe [Parameter]
a -> ResetDBParameterGroup
s {$sel:parameters:ResetDBParameterGroup' :: Maybe [Parameter]
parameters = Maybe [Parameter]
a} :: ResetDBParameterGroup) ((Maybe [Parameter] -> f (Maybe [Parameter]))
 -> ResetDBParameterGroup -> f ResetDBParameterGroup)
-> ((Maybe [Parameter] -> f (Maybe [Parameter]))
    -> Maybe [Parameter] -> f (Maybe [Parameter]))
-> (Maybe [Parameter] -> f (Maybe [Parameter]))
-> ResetDBParameterGroup
-> f ResetDBParameterGroup
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 parameter group.
--
-- Constraints:
--
-- -   Must match the name of an existing DBParameterGroup.
resetDBParameterGroup_dbParameterGroupName :: Lens.Lens' ResetDBParameterGroup Prelude.Text
resetDBParameterGroup_dbParameterGroupName :: (Text -> f Text)
-> ResetDBParameterGroup -> f ResetDBParameterGroup
resetDBParameterGroup_dbParameterGroupName = (ResetDBParameterGroup -> Text)
-> (ResetDBParameterGroup -> Text -> ResetDBParameterGroup)
-> Lens ResetDBParameterGroup ResetDBParameterGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetDBParameterGroup' {Text
dbParameterGroupName :: Text
$sel:dbParameterGroupName:ResetDBParameterGroup' :: ResetDBParameterGroup -> Text
dbParameterGroupName} -> Text
dbParameterGroupName) (\s :: ResetDBParameterGroup
s@ResetDBParameterGroup' {} Text
a -> ResetDBParameterGroup
s {$sel:dbParameterGroupName:ResetDBParameterGroup' :: Text
dbParameterGroupName = Text
a} :: ResetDBParameterGroup)

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

instance Prelude.Hashable ResetDBParameterGroup

instance Prelude.NFData ResetDBParameterGroup

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

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

instance Core.ToQuery ResetDBParameterGroup where
  toQuery :: ResetDBParameterGroup -> QueryString
toQuery ResetDBParameterGroup' {Maybe Bool
Maybe [Parameter]
Text
dbParameterGroupName :: Text
parameters :: Maybe [Parameter]
resetAllParameters :: Maybe Bool
$sel:dbParameterGroupName:ResetDBParameterGroup' :: ResetDBParameterGroup -> Text
$sel:parameters:ResetDBParameterGroup' :: ResetDBParameterGroup -> Maybe [Parameter]
$sel:resetAllParameters:ResetDBParameterGroup' :: ResetDBParameterGroup -> 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
"ResetDBParameterGroup" :: 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
"DBParameterGroupName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbParameterGroupName
      ]