{-# 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.Redshift.ModifyClusterParameterGroup
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Modifies the parameters of a parameter group. For the parameters
-- parameter, it can\'t contain ASCII characters.
--
-- For more information about parameters and parameter groups, go to
-- <https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-parameter-groups.html Amazon Redshift Parameter Groups>
-- in the /Amazon Redshift Cluster Management Guide/.
module Amazonka.Redshift.ModifyClusterParameterGroup
  ( -- * Creating a Request
    ModifyClusterParameterGroup (..),
    newModifyClusterParameterGroup,

    -- * Request Lenses
    modifyClusterParameterGroup_parameterGroupName,
    modifyClusterParameterGroup_parameters,

    -- * Destructuring the Response
    ClusterParameterGroupNameMessage (..),
    newClusterParameterGroupNameMessage,

    -- * Response Lenses
    clusterParameterGroupNameMessage_parameterGroupName,
    clusterParameterGroupNameMessage_parameterGroupStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Describes a modify cluster parameter group operation.
--
-- /See:/ 'newModifyClusterParameterGroup' smart constructor.
data ModifyClusterParameterGroup = ModifyClusterParameterGroup'
  { -- | The name of the parameter group to be modified.
    ModifyClusterParameterGroup -> Text
parameterGroupName :: Prelude.Text,
    -- | An array of parameters to be modified. A maximum of 20 parameters can be
    -- modified in a single request.
    --
    -- For each parameter to be modified, you must supply at least the
    -- parameter name and parameter value; other name-value pairs of the
    -- parameter are optional.
    --
    -- For the workload management (WLM) configuration, you must supply all the
    -- name-value pairs in the wlm_json_configuration parameter.
    ModifyClusterParameterGroup -> [Parameter]
parameters :: [Parameter]
  }
  deriving (ModifyClusterParameterGroup -> ModifyClusterParameterGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyClusterParameterGroup -> ModifyClusterParameterGroup -> Bool
$c/= :: ModifyClusterParameterGroup -> ModifyClusterParameterGroup -> Bool
== :: ModifyClusterParameterGroup -> ModifyClusterParameterGroup -> Bool
$c== :: ModifyClusterParameterGroup -> ModifyClusterParameterGroup -> Bool
Prelude.Eq, ReadPrec [ModifyClusterParameterGroup]
ReadPrec ModifyClusterParameterGroup
Int -> ReadS ModifyClusterParameterGroup
ReadS [ModifyClusterParameterGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyClusterParameterGroup]
$creadListPrec :: ReadPrec [ModifyClusterParameterGroup]
readPrec :: ReadPrec ModifyClusterParameterGroup
$creadPrec :: ReadPrec ModifyClusterParameterGroup
readList :: ReadS [ModifyClusterParameterGroup]
$creadList :: ReadS [ModifyClusterParameterGroup]
readsPrec :: Int -> ReadS ModifyClusterParameterGroup
$creadsPrec :: Int -> ReadS ModifyClusterParameterGroup
Prelude.Read, Int -> ModifyClusterParameterGroup -> ShowS
[ModifyClusterParameterGroup] -> ShowS
ModifyClusterParameterGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyClusterParameterGroup] -> ShowS
$cshowList :: [ModifyClusterParameterGroup] -> ShowS
show :: ModifyClusterParameterGroup -> String
$cshow :: ModifyClusterParameterGroup -> String
showsPrec :: Int -> ModifyClusterParameterGroup -> ShowS
$cshowsPrec :: Int -> ModifyClusterParameterGroup -> ShowS
Prelude.Show, forall x.
Rep ModifyClusterParameterGroup x -> ModifyClusterParameterGroup
forall x.
ModifyClusterParameterGroup -> Rep ModifyClusterParameterGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ModifyClusterParameterGroup x -> ModifyClusterParameterGroup
$cfrom :: forall x.
ModifyClusterParameterGroup -> Rep ModifyClusterParameterGroup x
Prelude.Generic)

-- |
-- Create a value of 'ModifyClusterParameterGroup' 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:
--
-- 'parameterGroupName', 'modifyClusterParameterGroup_parameterGroupName' - The name of the parameter group to be modified.
--
-- 'parameters', 'modifyClusterParameterGroup_parameters' - An array of parameters to be modified. A maximum of 20 parameters can be
-- modified in a single request.
--
-- For each parameter to be modified, you must supply at least the
-- parameter name and parameter value; other name-value pairs of the
-- parameter are optional.
--
-- For the workload management (WLM) configuration, you must supply all the
-- name-value pairs in the wlm_json_configuration parameter.
newModifyClusterParameterGroup ::
  -- | 'parameterGroupName'
  Prelude.Text ->
  ModifyClusterParameterGroup
newModifyClusterParameterGroup :: Text -> ModifyClusterParameterGroup
newModifyClusterParameterGroup Text
pParameterGroupName_ =
  ModifyClusterParameterGroup'
    { $sel:parameterGroupName:ModifyClusterParameterGroup' :: Text
parameterGroupName =
        Text
pParameterGroupName_,
      $sel:parameters:ModifyClusterParameterGroup' :: [Parameter]
parameters = forall a. Monoid a => a
Prelude.mempty
    }

-- | The name of the parameter group to be modified.
modifyClusterParameterGroup_parameterGroupName :: Lens.Lens' ModifyClusterParameterGroup Prelude.Text
modifyClusterParameterGroup_parameterGroupName :: Lens' ModifyClusterParameterGroup Text
modifyClusterParameterGroup_parameterGroupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyClusterParameterGroup' {Text
parameterGroupName :: Text
$sel:parameterGroupName:ModifyClusterParameterGroup' :: ModifyClusterParameterGroup -> Text
parameterGroupName} -> Text
parameterGroupName) (\s :: ModifyClusterParameterGroup
s@ModifyClusterParameterGroup' {} Text
a -> ModifyClusterParameterGroup
s {$sel:parameterGroupName:ModifyClusterParameterGroup' :: Text
parameterGroupName = Text
a} :: ModifyClusterParameterGroup)

-- | An array of parameters to be modified. A maximum of 20 parameters can be
-- modified in a single request.
--
-- For each parameter to be modified, you must supply at least the
-- parameter name and parameter value; other name-value pairs of the
-- parameter are optional.
--
-- For the workload management (WLM) configuration, you must supply all the
-- name-value pairs in the wlm_json_configuration parameter.
modifyClusterParameterGroup_parameters :: Lens.Lens' ModifyClusterParameterGroup [Parameter]
modifyClusterParameterGroup_parameters :: Lens' ModifyClusterParameterGroup [Parameter]
modifyClusterParameterGroup_parameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyClusterParameterGroup' {[Parameter]
parameters :: [Parameter]
$sel:parameters:ModifyClusterParameterGroup' :: ModifyClusterParameterGroup -> [Parameter]
parameters} -> [Parameter]
parameters) (\s :: ModifyClusterParameterGroup
s@ModifyClusterParameterGroup' {} [Parameter]
a -> ModifyClusterParameterGroup
s {$sel:parameters:ModifyClusterParameterGroup' :: [Parameter]
parameters = [Parameter]
a} :: ModifyClusterParameterGroup) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest ModifyClusterParameterGroup where
  type
    AWSResponse ModifyClusterParameterGroup =
      ClusterParameterGroupNameMessage
  request :: (Service -> Service)
-> ModifyClusterParameterGroup
-> Request ModifyClusterParameterGroup
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ModifyClusterParameterGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ModifyClusterParameterGroup)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"ModifyClusterParameterGroupResult"
      (\Int
s ResponseHeaders
h [Node]
x -> forall a. FromXML a => [Node] -> Either String a
Data.parseXML [Node]
x)

instance Prelude.Hashable ModifyClusterParameterGroup where
  hashWithSalt :: Int -> ModifyClusterParameterGroup -> Int
hashWithSalt Int
_salt ModifyClusterParameterGroup' {[Parameter]
Text
parameters :: [Parameter]
parameterGroupName :: Text
$sel:parameters:ModifyClusterParameterGroup' :: ModifyClusterParameterGroup -> [Parameter]
$sel:parameterGroupName:ModifyClusterParameterGroup' :: ModifyClusterParameterGroup -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
parameterGroupName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Parameter]
parameters

instance Prelude.NFData ModifyClusterParameterGroup where
  rnf :: ModifyClusterParameterGroup -> ()
rnf ModifyClusterParameterGroup' {[Parameter]
Text
parameters :: [Parameter]
parameterGroupName :: Text
$sel:parameters:ModifyClusterParameterGroup' :: ModifyClusterParameterGroup -> [Parameter]
$sel:parameterGroupName:ModifyClusterParameterGroup' :: ModifyClusterParameterGroup -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
parameterGroupName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Parameter]
parameters

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

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

instance Data.ToQuery ModifyClusterParameterGroup where
  toQuery :: ModifyClusterParameterGroup -> QueryString
toQuery ModifyClusterParameterGroup' {[Parameter]
Text
parameters :: [Parameter]
parameterGroupName :: Text
$sel:parameters:ModifyClusterParameterGroup' :: ModifyClusterParameterGroup -> [Parameter]
$sel:parameterGroupName:ModifyClusterParameterGroup' :: ModifyClusterParameterGroup -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ( ByteString
"ModifyClusterParameterGroup" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
        ByteString
"ParameterGroupName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
parameterGroupName,
        ByteString
"Parameters"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"Parameter" [Parameter]
parameters
      ]