{-# 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.MemoryDb.UpdateCluster
-- 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 cluster. You can use this operation to
-- change one or more cluster configuration settings by specifying the
-- settings and the new values.
module Amazonka.MemoryDb.UpdateCluster
  ( -- * Creating a Request
    UpdateCluster (..),
    newUpdateCluster,

    -- * Request Lenses
    updateCluster_engineVersion,
    updateCluster_securityGroupIds,
    updateCluster_snsTopicArn,
    updateCluster_snapshotWindow,
    updateCluster_maintenanceWindow,
    updateCluster_shardConfiguration,
    updateCluster_snapshotRetentionLimit,
    updateCluster_replicaConfiguration,
    updateCluster_nodeType,
    updateCluster_snsTopicStatus,
    updateCluster_description,
    updateCluster_aCLName,
    updateCluster_parameterGroupName,
    updateCluster_clusterName,

    -- * Destructuring the Response
    UpdateClusterResponse (..),
    newUpdateClusterResponse,

    -- * Response Lenses
    updateClusterResponse_cluster,
    updateClusterResponse_httpStatus,
  )
where

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

-- | /See:/ 'newUpdateCluster' smart constructor.
data UpdateCluster = UpdateCluster'
  { -- | The upgraded version of the engine to be run on the nodes. You can
    -- upgrade to a newer engine version, but you cannot downgrade to an
    -- earlier engine version. If you want to use an earlier engine version,
    -- you must delete the existing cluster and create it anew with the earlier
    -- engine version.
    UpdateCluster -> Maybe Text
engineVersion :: Prelude.Maybe Prelude.Text,
    -- | The SecurityGroupIds to update
    UpdateCluster -> Maybe [Text]
securityGroupIds :: Prelude.Maybe [Prelude.Text],
    -- | The SNS topic ARN to update
    UpdateCluster -> Maybe Text
snsTopicArn :: Prelude.Maybe Prelude.Text,
    -- | The daily time range (in UTC) during which MemoryDB begins taking a
    -- daily snapshot of your cluster.
    UpdateCluster -> Maybe Text
snapshotWindow :: Prelude.Maybe Prelude.Text,
    -- | The maintenance window to update
    UpdateCluster -> Maybe Text
maintenanceWindow :: Prelude.Maybe Prelude.Text,
    -- | The number of shards in the cluster
    UpdateCluster -> Maybe ShardConfigurationRequest
shardConfiguration :: Prelude.Maybe ShardConfigurationRequest,
    -- | The number of days for which MemoryDB retains automatic cluster
    -- snapshots before deleting them. For example, if you set
    -- SnapshotRetentionLimit to 5, a snapshot that was taken today is retained
    -- for 5 days before being deleted.
    UpdateCluster -> Maybe Int
snapshotRetentionLimit :: Prelude.Maybe Prelude.Int,
    -- | The number of replicas that will reside in each shard
    UpdateCluster -> Maybe ReplicaConfigurationRequest
replicaConfiguration :: Prelude.Maybe ReplicaConfigurationRequest,
    -- | A valid node type that you want to scale this cluster up or down to.
    UpdateCluster -> Maybe Text
nodeType :: Prelude.Maybe Prelude.Text,
    -- | The status of the Amazon SNS notification topic. Notifications are sent
    -- only if the status is active.
    UpdateCluster -> Maybe Text
snsTopicStatus :: Prelude.Maybe Prelude.Text,
    -- | The description of the cluster to update
    UpdateCluster -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The Access Control List that is associated with the cluster
    UpdateCluster -> Maybe Text
aCLName :: Prelude.Maybe Prelude.Text,
    -- | The name of the parameter group to update
    UpdateCluster -> Maybe Text
parameterGroupName :: Prelude.Maybe Prelude.Text,
    -- | The name of the cluster to update
    UpdateCluster -> Text
clusterName :: Prelude.Text
  }
  deriving (UpdateCluster -> UpdateCluster -> Bool
(UpdateCluster -> UpdateCluster -> Bool)
-> (UpdateCluster -> UpdateCluster -> Bool) -> Eq UpdateCluster
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateCluster -> UpdateCluster -> Bool
$c/= :: UpdateCluster -> UpdateCluster -> Bool
== :: UpdateCluster -> UpdateCluster -> Bool
$c== :: UpdateCluster -> UpdateCluster -> Bool
Prelude.Eq, ReadPrec [UpdateCluster]
ReadPrec UpdateCluster
Int -> ReadS UpdateCluster
ReadS [UpdateCluster]
(Int -> ReadS UpdateCluster)
-> ReadS [UpdateCluster]
-> ReadPrec UpdateCluster
-> ReadPrec [UpdateCluster]
-> Read UpdateCluster
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateCluster]
$creadListPrec :: ReadPrec [UpdateCluster]
readPrec :: ReadPrec UpdateCluster
$creadPrec :: ReadPrec UpdateCluster
readList :: ReadS [UpdateCluster]
$creadList :: ReadS [UpdateCluster]
readsPrec :: Int -> ReadS UpdateCluster
$creadsPrec :: Int -> ReadS UpdateCluster
Prelude.Read, Int -> UpdateCluster -> ShowS
[UpdateCluster] -> ShowS
UpdateCluster -> String
(Int -> UpdateCluster -> ShowS)
-> (UpdateCluster -> String)
-> ([UpdateCluster] -> ShowS)
-> Show UpdateCluster
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateCluster] -> ShowS
$cshowList :: [UpdateCluster] -> ShowS
show :: UpdateCluster -> String
$cshow :: UpdateCluster -> String
showsPrec :: Int -> UpdateCluster -> ShowS
$cshowsPrec :: Int -> UpdateCluster -> ShowS
Prelude.Show, (forall x. UpdateCluster -> Rep UpdateCluster x)
-> (forall x. Rep UpdateCluster x -> UpdateCluster)
-> Generic UpdateCluster
forall x. Rep UpdateCluster x -> UpdateCluster
forall x. UpdateCluster -> Rep UpdateCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateCluster x -> UpdateCluster
$cfrom :: forall x. UpdateCluster -> Rep UpdateCluster x
Prelude.Generic)

-- |
-- Create a value of 'UpdateCluster' 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:
--
-- 'engineVersion', 'updateCluster_engineVersion' - The upgraded version of the engine to be run on the nodes. You can
-- upgrade to a newer engine version, but you cannot downgrade to an
-- earlier engine version. If you want to use an earlier engine version,
-- you must delete the existing cluster and create it anew with the earlier
-- engine version.
--
-- 'securityGroupIds', 'updateCluster_securityGroupIds' - The SecurityGroupIds to update
--
-- 'snsTopicArn', 'updateCluster_snsTopicArn' - The SNS topic ARN to update
--
-- 'snapshotWindow', 'updateCluster_snapshotWindow' - The daily time range (in UTC) during which MemoryDB begins taking a
-- daily snapshot of your cluster.
--
-- 'maintenanceWindow', 'updateCluster_maintenanceWindow' - The maintenance window to update
--
-- 'shardConfiguration', 'updateCluster_shardConfiguration' - The number of shards in the cluster
--
-- 'snapshotRetentionLimit', 'updateCluster_snapshotRetentionLimit' - The number of days for which MemoryDB retains automatic cluster
-- snapshots before deleting them. For example, if you set
-- SnapshotRetentionLimit to 5, a snapshot that was taken today is retained
-- for 5 days before being deleted.
--
-- 'replicaConfiguration', 'updateCluster_replicaConfiguration' - The number of replicas that will reside in each shard
--
-- 'nodeType', 'updateCluster_nodeType' - A valid node type that you want to scale this cluster up or down to.
--
-- 'snsTopicStatus', 'updateCluster_snsTopicStatus' - The status of the Amazon SNS notification topic. Notifications are sent
-- only if the status is active.
--
-- 'description', 'updateCluster_description' - The description of the cluster to update
--
-- 'aCLName', 'updateCluster_aCLName' - The Access Control List that is associated with the cluster
--
-- 'parameterGroupName', 'updateCluster_parameterGroupName' - The name of the parameter group to update
--
-- 'clusterName', 'updateCluster_clusterName' - The name of the cluster to update
newUpdateCluster ::
  -- | 'clusterName'
  Prelude.Text ->
  UpdateCluster
newUpdateCluster :: Text -> UpdateCluster
newUpdateCluster Text
pClusterName_ =
  UpdateCluster' :: Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ShardConfigurationRequest
-> Maybe Int
-> Maybe ReplicaConfigurationRequest
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> UpdateCluster
UpdateCluster'
    { $sel:engineVersion:UpdateCluster' :: Maybe Text
engineVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:securityGroupIds:UpdateCluster' :: Maybe [Text]
securityGroupIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:snsTopicArn:UpdateCluster' :: Maybe Text
snsTopicArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:snapshotWindow:UpdateCluster' :: Maybe Text
snapshotWindow = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maintenanceWindow:UpdateCluster' :: Maybe Text
maintenanceWindow = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:shardConfiguration:UpdateCluster' :: Maybe ShardConfigurationRequest
shardConfiguration = Maybe ShardConfigurationRequest
forall a. Maybe a
Prelude.Nothing,
      $sel:snapshotRetentionLimit:UpdateCluster' :: Maybe Int
snapshotRetentionLimit = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:replicaConfiguration:UpdateCluster' :: Maybe ReplicaConfigurationRequest
replicaConfiguration = Maybe ReplicaConfigurationRequest
forall a. Maybe a
Prelude.Nothing,
      $sel:nodeType:UpdateCluster' :: Maybe Text
nodeType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:snsTopicStatus:UpdateCluster' :: Maybe Text
snsTopicStatus = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:UpdateCluster' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:aCLName:UpdateCluster' :: Maybe Text
aCLName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:parameterGroupName:UpdateCluster' :: Maybe Text
parameterGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clusterName:UpdateCluster' :: Text
clusterName = Text
pClusterName_
    }

-- | The upgraded version of the engine to be run on the nodes. You can
-- upgrade to a newer engine version, but you cannot downgrade to an
-- earlier engine version. If you want to use an earlier engine version,
-- you must delete the existing cluster and create it anew with the earlier
-- engine version.
updateCluster_engineVersion :: Lens.Lens' UpdateCluster (Prelude.Maybe Prelude.Text)
updateCluster_engineVersion :: (Maybe Text -> f (Maybe Text)) -> UpdateCluster -> f UpdateCluster
updateCluster_engineVersion = (UpdateCluster -> Maybe Text)
-> (UpdateCluster -> Maybe Text -> UpdateCluster)
-> Lens UpdateCluster UpdateCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCluster' {Maybe Text
engineVersion :: Maybe Text
$sel:engineVersion:UpdateCluster' :: UpdateCluster -> Maybe Text
engineVersion} -> Maybe Text
engineVersion) (\s :: UpdateCluster
s@UpdateCluster' {} Maybe Text
a -> UpdateCluster
s {$sel:engineVersion:UpdateCluster' :: Maybe Text
engineVersion = Maybe Text
a} :: UpdateCluster)

-- | The SecurityGroupIds to update
updateCluster_securityGroupIds :: Lens.Lens' UpdateCluster (Prelude.Maybe [Prelude.Text])
updateCluster_securityGroupIds :: (Maybe [Text] -> f (Maybe [Text]))
-> UpdateCluster -> f UpdateCluster
updateCluster_securityGroupIds = (UpdateCluster -> Maybe [Text])
-> (UpdateCluster -> Maybe [Text] -> UpdateCluster)
-> Lens UpdateCluster UpdateCluster (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCluster' {Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:securityGroupIds:UpdateCluster' :: UpdateCluster -> Maybe [Text]
securityGroupIds} -> Maybe [Text]
securityGroupIds) (\s :: UpdateCluster
s@UpdateCluster' {} Maybe [Text]
a -> UpdateCluster
s {$sel:securityGroupIds:UpdateCluster' :: Maybe [Text]
securityGroupIds = Maybe [Text]
a} :: UpdateCluster) ((Maybe [Text] -> f (Maybe [Text]))
 -> UpdateCluster -> f UpdateCluster)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> UpdateCluster
-> f UpdateCluster
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The SNS topic ARN to update
updateCluster_snsTopicArn :: Lens.Lens' UpdateCluster (Prelude.Maybe Prelude.Text)
updateCluster_snsTopicArn :: (Maybe Text -> f (Maybe Text)) -> UpdateCluster -> f UpdateCluster
updateCluster_snsTopicArn = (UpdateCluster -> Maybe Text)
-> (UpdateCluster -> Maybe Text -> UpdateCluster)
-> Lens UpdateCluster UpdateCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCluster' {Maybe Text
snsTopicArn :: Maybe Text
$sel:snsTopicArn:UpdateCluster' :: UpdateCluster -> Maybe Text
snsTopicArn} -> Maybe Text
snsTopicArn) (\s :: UpdateCluster
s@UpdateCluster' {} Maybe Text
a -> UpdateCluster
s {$sel:snsTopicArn:UpdateCluster' :: Maybe Text
snsTopicArn = Maybe Text
a} :: UpdateCluster)

-- | The daily time range (in UTC) during which MemoryDB begins taking a
-- daily snapshot of your cluster.
updateCluster_snapshotWindow :: Lens.Lens' UpdateCluster (Prelude.Maybe Prelude.Text)
updateCluster_snapshotWindow :: (Maybe Text -> f (Maybe Text)) -> UpdateCluster -> f UpdateCluster
updateCluster_snapshotWindow = (UpdateCluster -> Maybe Text)
-> (UpdateCluster -> Maybe Text -> UpdateCluster)
-> Lens UpdateCluster UpdateCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCluster' {Maybe Text
snapshotWindow :: Maybe Text
$sel:snapshotWindow:UpdateCluster' :: UpdateCluster -> Maybe Text
snapshotWindow} -> Maybe Text
snapshotWindow) (\s :: UpdateCluster
s@UpdateCluster' {} Maybe Text
a -> UpdateCluster
s {$sel:snapshotWindow:UpdateCluster' :: Maybe Text
snapshotWindow = Maybe Text
a} :: UpdateCluster)

-- | The maintenance window to update
updateCluster_maintenanceWindow :: Lens.Lens' UpdateCluster (Prelude.Maybe Prelude.Text)
updateCluster_maintenanceWindow :: (Maybe Text -> f (Maybe Text)) -> UpdateCluster -> f UpdateCluster
updateCluster_maintenanceWindow = (UpdateCluster -> Maybe Text)
-> (UpdateCluster -> Maybe Text -> UpdateCluster)
-> Lens UpdateCluster UpdateCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCluster' {Maybe Text
maintenanceWindow :: Maybe Text
$sel:maintenanceWindow:UpdateCluster' :: UpdateCluster -> Maybe Text
maintenanceWindow} -> Maybe Text
maintenanceWindow) (\s :: UpdateCluster
s@UpdateCluster' {} Maybe Text
a -> UpdateCluster
s {$sel:maintenanceWindow:UpdateCluster' :: Maybe Text
maintenanceWindow = Maybe Text
a} :: UpdateCluster)

-- | The number of shards in the cluster
updateCluster_shardConfiguration :: Lens.Lens' UpdateCluster (Prelude.Maybe ShardConfigurationRequest)
updateCluster_shardConfiguration :: (Maybe ShardConfigurationRequest
 -> f (Maybe ShardConfigurationRequest))
-> UpdateCluster -> f UpdateCluster
updateCluster_shardConfiguration = (UpdateCluster -> Maybe ShardConfigurationRequest)
-> (UpdateCluster
    -> Maybe ShardConfigurationRequest -> UpdateCluster)
-> Lens
     UpdateCluster
     UpdateCluster
     (Maybe ShardConfigurationRequest)
     (Maybe ShardConfigurationRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCluster' {Maybe ShardConfigurationRequest
shardConfiguration :: Maybe ShardConfigurationRequest
$sel:shardConfiguration:UpdateCluster' :: UpdateCluster -> Maybe ShardConfigurationRequest
shardConfiguration} -> Maybe ShardConfigurationRequest
shardConfiguration) (\s :: UpdateCluster
s@UpdateCluster' {} Maybe ShardConfigurationRequest
a -> UpdateCluster
s {$sel:shardConfiguration:UpdateCluster' :: Maybe ShardConfigurationRequest
shardConfiguration = Maybe ShardConfigurationRequest
a} :: UpdateCluster)

-- | The number of days for which MemoryDB retains automatic cluster
-- snapshots before deleting them. For example, if you set
-- SnapshotRetentionLimit to 5, a snapshot that was taken today is retained
-- for 5 days before being deleted.
updateCluster_snapshotRetentionLimit :: Lens.Lens' UpdateCluster (Prelude.Maybe Prelude.Int)
updateCluster_snapshotRetentionLimit :: (Maybe Int -> f (Maybe Int)) -> UpdateCluster -> f UpdateCluster
updateCluster_snapshotRetentionLimit = (UpdateCluster -> Maybe Int)
-> (UpdateCluster -> Maybe Int -> UpdateCluster)
-> Lens UpdateCluster UpdateCluster (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCluster' {Maybe Int
snapshotRetentionLimit :: Maybe Int
$sel:snapshotRetentionLimit:UpdateCluster' :: UpdateCluster -> Maybe Int
snapshotRetentionLimit} -> Maybe Int
snapshotRetentionLimit) (\s :: UpdateCluster
s@UpdateCluster' {} Maybe Int
a -> UpdateCluster
s {$sel:snapshotRetentionLimit:UpdateCluster' :: Maybe Int
snapshotRetentionLimit = Maybe Int
a} :: UpdateCluster)

-- | The number of replicas that will reside in each shard
updateCluster_replicaConfiguration :: Lens.Lens' UpdateCluster (Prelude.Maybe ReplicaConfigurationRequest)
updateCluster_replicaConfiguration :: (Maybe ReplicaConfigurationRequest
 -> f (Maybe ReplicaConfigurationRequest))
-> UpdateCluster -> f UpdateCluster
updateCluster_replicaConfiguration = (UpdateCluster -> Maybe ReplicaConfigurationRequest)
-> (UpdateCluster
    -> Maybe ReplicaConfigurationRequest -> UpdateCluster)
-> Lens
     UpdateCluster
     UpdateCluster
     (Maybe ReplicaConfigurationRequest)
     (Maybe ReplicaConfigurationRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCluster' {Maybe ReplicaConfigurationRequest
replicaConfiguration :: Maybe ReplicaConfigurationRequest
$sel:replicaConfiguration:UpdateCluster' :: UpdateCluster -> Maybe ReplicaConfigurationRequest
replicaConfiguration} -> Maybe ReplicaConfigurationRequest
replicaConfiguration) (\s :: UpdateCluster
s@UpdateCluster' {} Maybe ReplicaConfigurationRequest
a -> UpdateCluster
s {$sel:replicaConfiguration:UpdateCluster' :: Maybe ReplicaConfigurationRequest
replicaConfiguration = Maybe ReplicaConfigurationRequest
a} :: UpdateCluster)

-- | A valid node type that you want to scale this cluster up or down to.
updateCluster_nodeType :: Lens.Lens' UpdateCluster (Prelude.Maybe Prelude.Text)
updateCluster_nodeType :: (Maybe Text -> f (Maybe Text)) -> UpdateCluster -> f UpdateCluster
updateCluster_nodeType = (UpdateCluster -> Maybe Text)
-> (UpdateCluster -> Maybe Text -> UpdateCluster)
-> Lens UpdateCluster UpdateCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCluster' {Maybe Text
nodeType :: Maybe Text
$sel:nodeType:UpdateCluster' :: UpdateCluster -> Maybe Text
nodeType} -> Maybe Text
nodeType) (\s :: UpdateCluster
s@UpdateCluster' {} Maybe Text
a -> UpdateCluster
s {$sel:nodeType:UpdateCluster' :: Maybe Text
nodeType = Maybe Text
a} :: UpdateCluster)

-- | The status of the Amazon SNS notification topic. Notifications are sent
-- only if the status is active.
updateCluster_snsTopicStatus :: Lens.Lens' UpdateCluster (Prelude.Maybe Prelude.Text)
updateCluster_snsTopicStatus :: (Maybe Text -> f (Maybe Text)) -> UpdateCluster -> f UpdateCluster
updateCluster_snsTopicStatus = (UpdateCluster -> Maybe Text)
-> (UpdateCluster -> Maybe Text -> UpdateCluster)
-> Lens UpdateCluster UpdateCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCluster' {Maybe Text
snsTopicStatus :: Maybe Text
$sel:snsTopicStatus:UpdateCluster' :: UpdateCluster -> Maybe Text
snsTopicStatus} -> Maybe Text
snsTopicStatus) (\s :: UpdateCluster
s@UpdateCluster' {} Maybe Text
a -> UpdateCluster
s {$sel:snsTopicStatus:UpdateCluster' :: Maybe Text
snsTopicStatus = Maybe Text
a} :: UpdateCluster)

-- | The description of the cluster to update
updateCluster_description :: Lens.Lens' UpdateCluster (Prelude.Maybe Prelude.Text)
updateCluster_description :: (Maybe Text -> f (Maybe Text)) -> UpdateCluster -> f UpdateCluster
updateCluster_description = (UpdateCluster -> Maybe Text)
-> (UpdateCluster -> Maybe Text -> UpdateCluster)
-> Lens UpdateCluster UpdateCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCluster' {Maybe Text
description :: Maybe Text
$sel:description:UpdateCluster' :: UpdateCluster -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateCluster
s@UpdateCluster' {} Maybe Text
a -> UpdateCluster
s {$sel:description:UpdateCluster' :: Maybe Text
description = Maybe Text
a} :: UpdateCluster)

-- | The Access Control List that is associated with the cluster
updateCluster_aCLName :: Lens.Lens' UpdateCluster (Prelude.Maybe Prelude.Text)
updateCluster_aCLName :: (Maybe Text -> f (Maybe Text)) -> UpdateCluster -> f UpdateCluster
updateCluster_aCLName = (UpdateCluster -> Maybe Text)
-> (UpdateCluster -> Maybe Text -> UpdateCluster)
-> Lens UpdateCluster UpdateCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCluster' {Maybe Text
aCLName :: Maybe Text
$sel:aCLName:UpdateCluster' :: UpdateCluster -> Maybe Text
aCLName} -> Maybe Text
aCLName) (\s :: UpdateCluster
s@UpdateCluster' {} Maybe Text
a -> UpdateCluster
s {$sel:aCLName:UpdateCluster' :: Maybe Text
aCLName = Maybe Text
a} :: UpdateCluster)

-- | The name of the parameter group to update
updateCluster_parameterGroupName :: Lens.Lens' UpdateCluster (Prelude.Maybe Prelude.Text)
updateCluster_parameterGroupName :: (Maybe Text -> f (Maybe Text)) -> UpdateCluster -> f UpdateCluster
updateCluster_parameterGroupName = (UpdateCluster -> Maybe Text)
-> (UpdateCluster -> Maybe Text -> UpdateCluster)
-> Lens UpdateCluster UpdateCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCluster' {Maybe Text
parameterGroupName :: Maybe Text
$sel:parameterGroupName:UpdateCluster' :: UpdateCluster -> Maybe Text
parameterGroupName} -> Maybe Text
parameterGroupName) (\s :: UpdateCluster
s@UpdateCluster' {} Maybe Text
a -> UpdateCluster
s {$sel:parameterGroupName:UpdateCluster' :: Maybe Text
parameterGroupName = Maybe Text
a} :: UpdateCluster)

-- | The name of the cluster to update
updateCluster_clusterName :: Lens.Lens' UpdateCluster Prelude.Text
updateCluster_clusterName :: (Text -> f Text) -> UpdateCluster -> f UpdateCluster
updateCluster_clusterName = (UpdateCluster -> Text)
-> (UpdateCluster -> Text -> UpdateCluster)
-> Lens UpdateCluster UpdateCluster Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCluster' {Text
clusterName :: Text
$sel:clusterName:UpdateCluster' :: UpdateCluster -> Text
clusterName} -> Text
clusterName) (\s :: UpdateCluster
s@UpdateCluster' {} Text
a -> UpdateCluster
s {$sel:clusterName:UpdateCluster' :: Text
clusterName = Text
a} :: UpdateCluster)

instance Core.AWSRequest UpdateCluster where
  type
    AWSResponse UpdateCluster =
      UpdateClusterResponse
  request :: UpdateCluster -> Request UpdateCluster
request = Service -> UpdateCluster -> Request UpdateCluster
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateCluster
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateCluster)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateCluster))
-> Logger
-> Service
-> Proxy UpdateCluster
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateCluster)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Cluster -> Int -> UpdateClusterResponse
UpdateClusterResponse'
            (Maybe Cluster -> Int -> UpdateClusterResponse)
-> Either String (Maybe Cluster)
-> Either String (Int -> UpdateClusterResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Cluster)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Cluster")
            Either String (Int -> UpdateClusterResponse)
-> Either String Int -> Either String UpdateClusterResponse
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 UpdateCluster

instance Prelude.NFData UpdateCluster

instance Core.ToHeaders UpdateCluster where
  toHeaders :: UpdateCluster -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateCluster -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AmazonMemoryDB.UpdateCluster" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON UpdateCluster where
  toJSON :: UpdateCluster -> Value
toJSON UpdateCluster' {Maybe Int
Maybe [Text]
Maybe Text
Maybe ReplicaConfigurationRequest
Maybe ShardConfigurationRequest
Text
clusterName :: Text
parameterGroupName :: Maybe Text
aCLName :: Maybe Text
description :: Maybe Text
snsTopicStatus :: Maybe Text
nodeType :: Maybe Text
replicaConfiguration :: Maybe ReplicaConfigurationRequest
snapshotRetentionLimit :: Maybe Int
shardConfiguration :: Maybe ShardConfigurationRequest
maintenanceWindow :: Maybe Text
snapshotWindow :: Maybe Text
snsTopicArn :: Maybe Text
securityGroupIds :: Maybe [Text]
engineVersion :: Maybe Text
$sel:clusterName:UpdateCluster' :: UpdateCluster -> Text
$sel:parameterGroupName:UpdateCluster' :: UpdateCluster -> Maybe Text
$sel:aCLName:UpdateCluster' :: UpdateCluster -> Maybe Text
$sel:description:UpdateCluster' :: UpdateCluster -> Maybe Text
$sel:snsTopicStatus:UpdateCluster' :: UpdateCluster -> Maybe Text
$sel:nodeType:UpdateCluster' :: UpdateCluster -> Maybe Text
$sel:replicaConfiguration:UpdateCluster' :: UpdateCluster -> Maybe ReplicaConfigurationRequest
$sel:snapshotRetentionLimit:UpdateCluster' :: UpdateCluster -> Maybe Int
$sel:shardConfiguration:UpdateCluster' :: UpdateCluster -> Maybe ShardConfigurationRequest
$sel:maintenanceWindow:UpdateCluster' :: UpdateCluster -> Maybe Text
$sel:snapshotWindow:UpdateCluster' :: UpdateCluster -> Maybe Text
$sel:snsTopicArn:UpdateCluster' :: UpdateCluster -> Maybe Text
$sel:securityGroupIds:UpdateCluster' :: UpdateCluster -> Maybe [Text]
$sel:engineVersion:UpdateCluster' :: UpdateCluster -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"EngineVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
engineVersion,
            (Text
"SecurityGroupIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
securityGroupIds,
            (Text
"SnsTopicArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
snsTopicArn,
            (Text
"SnapshotWindow" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
snapshotWindow,
            (Text
"MaintenanceWindow" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
maintenanceWindow,
            (Text
"ShardConfiguration" Text -> ShardConfigurationRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ShardConfigurationRequest -> Pair)
-> Maybe ShardConfigurationRequest -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ShardConfigurationRequest
shardConfiguration,
            (Text
"SnapshotRetentionLimit" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
snapshotRetentionLimit,
            (Text
"ReplicaConfiguration" Text -> ReplicaConfigurationRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ReplicaConfigurationRequest -> Pair)
-> Maybe ReplicaConfigurationRequest -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReplicaConfigurationRequest
replicaConfiguration,
            (Text
"NodeType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nodeType,
            (Text
"SnsTopicStatus" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
snsTopicStatus,
            (Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Text
"ACLName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
aCLName,
            (Text
"ParameterGroupName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
parameterGroupName,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ClusterName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clusterName)
          ]
      )

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

instance Core.ToQuery UpdateCluster where
  toQuery :: UpdateCluster -> QueryString
toQuery = QueryString -> UpdateCluster -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

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

-- |
-- Create a value of 'UpdateClusterResponse' 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:
--
-- 'cluster', 'updateClusterResponse_cluster' - The updated cluster
--
-- 'httpStatus', 'updateClusterResponse_httpStatus' - The response's http status code.
newUpdateClusterResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateClusterResponse
newUpdateClusterResponse :: Int -> UpdateClusterResponse
newUpdateClusterResponse Int
pHttpStatus_ =
  UpdateClusterResponse' :: Maybe Cluster -> Int -> UpdateClusterResponse
UpdateClusterResponse'
    { $sel:cluster:UpdateClusterResponse' :: Maybe Cluster
cluster = Maybe Cluster
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateClusterResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The updated cluster
updateClusterResponse_cluster :: Lens.Lens' UpdateClusterResponse (Prelude.Maybe Cluster)
updateClusterResponse_cluster :: (Maybe Cluster -> f (Maybe Cluster))
-> UpdateClusterResponse -> f UpdateClusterResponse
updateClusterResponse_cluster = (UpdateClusterResponse -> Maybe Cluster)
-> (UpdateClusterResponse
    -> Maybe Cluster -> UpdateClusterResponse)
-> Lens
     UpdateClusterResponse
     UpdateClusterResponse
     (Maybe Cluster)
     (Maybe Cluster)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateClusterResponse' {Maybe Cluster
cluster :: Maybe Cluster
$sel:cluster:UpdateClusterResponse' :: UpdateClusterResponse -> Maybe Cluster
cluster} -> Maybe Cluster
cluster) (\s :: UpdateClusterResponse
s@UpdateClusterResponse' {} Maybe Cluster
a -> UpdateClusterResponse
s {$sel:cluster:UpdateClusterResponse' :: Maybe Cluster
cluster = Maybe Cluster
a} :: UpdateClusterResponse)

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

instance Prelude.NFData UpdateClusterResponse