{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.DynamoDB.Types.ReplicaAutoScalingUpdate
-- 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)
module Amazonka.DynamoDB.Types.ReplicaAutoScalingUpdate where

import qualified Amazonka.Core as Core
import Amazonka.DynamoDB.Types.AutoScalingSettingsUpdate
import Amazonka.DynamoDB.Types.ReplicaGlobalSecondaryIndexAutoScalingUpdate
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents the auto scaling settings of a replica that will be modified.
--
-- /See:/ 'newReplicaAutoScalingUpdate' smart constructor.
data ReplicaAutoScalingUpdate = ReplicaAutoScalingUpdate'
  { ReplicaAutoScalingUpdate -> Maybe AutoScalingSettingsUpdate
replicaProvisionedReadCapacityAutoScalingUpdate :: Prelude.Maybe AutoScalingSettingsUpdate,
    -- | Represents the auto scaling settings of global secondary indexes that
    -- will be modified.
    ReplicaAutoScalingUpdate
-> Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
replicaGlobalSecondaryIndexUpdates :: Prelude.Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate],
    -- | The Region where the replica exists.
    ReplicaAutoScalingUpdate -> Text
regionName :: Prelude.Text
  }
  deriving (ReplicaAutoScalingUpdate -> ReplicaAutoScalingUpdate -> Bool
(ReplicaAutoScalingUpdate -> ReplicaAutoScalingUpdate -> Bool)
-> (ReplicaAutoScalingUpdate -> ReplicaAutoScalingUpdate -> Bool)
-> Eq ReplicaAutoScalingUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReplicaAutoScalingUpdate -> ReplicaAutoScalingUpdate -> Bool
$c/= :: ReplicaAutoScalingUpdate -> ReplicaAutoScalingUpdate -> Bool
== :: ReplicaAutoScalingUpdate -> ReplicaAutoScalingUpdate -> Bool
$c== :: ReplicaAutoScalingUpdate -> ReplicaAutoScalingUpdate -> Bool
Prelude.Eq, ReadPrec [ReplicaAutoScalingUpdate]
ReadPrec ReplicaAutoScalingUpdate
Int -> ReadS ReplicaAutoScalingUpdate
ReadS [ReplicaAutoScalingUpdate]
(Int -> ReadS ReplicaAutoScalingUpdate)
-> ReadS [ReplicaAutoScalingUpdate]
-> ReadPrec ReplicaAutoScalingUpdate
-> ReadPrec [ReplicaAutoScalingUpdate]
-> Read ReplicaAutoScalingUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReplicaAutoScalingUpdate]
$creadListPrec :: ReadPrec [ReplicaAutoScalingUpdate]
readPrec :: ReadPrec ReplicaAutoScalingUpdate
$creadPrec :: ReadPrec ReplicaAutoScalingUpdate
readList :: ReadS [ReplicaAutoScalingUpdate]
$creadList :: ReadS [ReplicaAutoScalingUpdate]
readsPrec :: Int -> ReadS ReplicaAutoScalingUpdate
$creadsPrec :: Int -> ReadS ReplicaAutoScalingUpdate
Prelude.Read, Int -> ReplicaAutoScalingUpdate -> ShowS
[ReplicaAutoScalingUpdate] -> ShowS
ReplicaAutoScalingUpdate -> String
(Int -> ReplicaAutoScalingUpdate -> ShowS)
-> (ReplicaAutoScalingUpdate -> String)
-> ([ReplicaAutoScalingUpdate] -> ShowS)
-> Show ReplicaAutoScalingUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReplicaAutoScalingUpdate] -> ShowS
$cshowList :: [ReplicaAutoScalingUpdate] -> ShowS
show :: ReplicaAutoScalingUpdate -> String
$cshow :: ReplicaAutoScalingUpdate -> String
showsPrec :: Int -> ReplicaAutoScalingUpdate -> ShowS
$cshowsPrec :: Int -> ReplicaAutoScalingUpdate -> ShowS
Prelude.Show, (forall x.
 ReplicaAutoScalingUpdate -> Rep ReplicaAutoScalingUpdate x)
-> (forall x.
    Rep ReplicaAutoScalingUpdate x -> ReplicaAutoScalingUpdate)
-> Generic ReplicaAutoScalingUpdate
forall x.
Rep ReplicaAutoScalingUpdate x -> ReplicaAutoScalingUpdate
forall x.
ReplicaAutoScalingUpdate -> Rep ReplicaAutoScalingUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ReplicaAutoScalingUpdate x -> ReplicaAutoScalingUpdate
$cfrom :: forall x.
ReplicaAutoScalingUpdate -> Rep ReplicaAutoScalingUpdate x
Prelude.Generic)

-- |
-- Create a value of 'ReplicaAutoScalingUpdate' 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:
--
-- 'replicaProvisionedReadCapacityAutoScalingUpdate', 'replicaAutoScalingUpdate_replicaProvisionedReadCapacityAutoScalingUpdate' - Undocumented member.
--
-- 'replicaGlobalSecondaryIndexUpdates', 'replicaAutoScalingUpdate_replicaGlobalSecondaryIndexUpdates' - Represents the auto scaling settings of global secondary indexes that
-- will be modified.
--
-- 'regionName', 'replicaAutoScalingUpdate_regionName' - The Region where the replica exists.
newReplicaAutoScalingUpdate ::
  -- | 'regionName'
  Prelude.Text ->
  ReplicaAutoScalingUpdate
newReplicaAutoScalingUpdate :: Text -> ReplicaAutoScalingUpdate
newReplicaAutoScalingUpdate Text
pRegionName_ =
  ReplicaAutoScalingUpdate' :: Maybe AutoScalingSettingsUpdate
-> Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
-> Text
-> ReplicaAutoScalingUpdate
ReplicaAutoScalingUpdate'
    { $sel:replicaProvisionedReadCapacityAutoScalingUpdate:ReplicaAutoScalingUpdate' :: Maybe AutoScalingSettingsUpdate
replicaProvisionedReadCapacityAutoScalingUpdate =
        Maybe AutoScalingSettingsUpdate
forall a. Maybe a
Prelude.Nothing,
      $sel:replicaGlobalSecondaryIndexUpdates:ReplicaAutoScalingUpdate' :: Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
replicaGlobalSecondaryIndexUpdates =
        Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
forall a. Maybe a
Prelude.Nothing,
      $sel:regionName:ReplicaAutoScalingUpdate' :: Text
regionName = Text
pRegionName_
    }

-- | Undocumented member.
replicaAutoScalingUpdate_replicaProvisionedReadCapacityAutoScalingUpdate :: Lens.Lens' ReplicaAutoScalingUpdate (Prelude.Maybe AutoScalingSettingsUpdate)
replicaAutoScalingUpdate_replicaProvisionedReadCapacityAutoScalingUpdate :: (Maybe AutoScalingSettingsUpdate
 -> f (Maybe AutoScalingSettingsUpdate))
-> ReplicaAutoScalingUpdate -> f ReplicaAutoScalingUpdate
replicaAutoScalingUpdate_replicaProvisionedReadCapacityAutoScalingUpdate = (ReplicaAutoScalingUpdate -> Maybe AutoScalingSettingsUpdate)
-> (ReplicaAutoScalingUpdate
    -> Maybe AutoScalingSettingsUpdate -> ReplicaAutoScalingUpdate)
-> Lens
     ReplicaAutoScalingUpdate
     ReplicaAutoScalingUpdate
     (Maybe AutoScalingSettingsUpdate)
     (Maybe AutoScalingSettingsUpdate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicaAutoScalingUpdate' {Maybe AutoScalingSettingsUpdate
replicaProvisionedReadCapacityAutoScalingUpdate :: Maybe AutoScalingSettingsUpdate
$sel:replicaProvisionedReadCapacityAutoScalingUpdate:ReplicaAutoScalingUpdate' :: ReplicaAutoScalingUpdate -> Maybe AutoScalingSettingsUpdate
replicaProvisionedReadCapacityAutoScalingUpdate} -> Maybe AutoScalingSettingsUpdate
replicaProvisionedReadCapacityAutoScalingUpdate) (\s :: ReplicaAutoScalingUpdate
s@ReplicaAutoScalingUpdate' {} Maybe AutoScalingSettingsUpdate
a -> ReplicaAutoScalingUpdate
s {$sel:replicaProvisionedReadCapacityAutoScalingUpdate:ReplicaAutoScalingUpdate' :: Maybe AutoScalingSettingsUpdate
replicaProvisionedReadCapacityAutoScalingUpdate = Maybe AutoScalingSettingsUpdate
a} :: ReplicaAutoScalingUpdate)

-- | Represents the auto scaling settings of global secondary indexes that
-- will be modified.
replicaAutoScalingUpdate_replicaGlobalSecondaryIndexUpdates :: Lens.Lens' ReplicaAutoScalingUpdate (Prelude.Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate])
replicaAutoScalingUpdate_replicaGlobalSecondaryIndexUpdates :: (Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
 -> f (Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]))
-> ReplicaAutoScalingUpdate -> f ReplicaAutoScalingUpdate
replicaAutoScalingUpdate_replicaGlobalSecondaryIndexUpdates = (ReplicaAutoScalingUpdate
 -> Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate])
-> (ReplicaAutoScalingUpdate
    -> Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
    -> ReplicaAutoScalingUpdate)
-> Lens
     ReplicaAutoScalingUpdate
     ReplicaAutoScalingUpdate
     (Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate])
     (Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicaAutoScalingUpdate' {Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
replicaGlobalSecondaryIndexUpdates :: Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
$sel:replicaGlobalSecondaryIndexUpdates:ReplicaAutoScalingUpdate' :: ReplicaAutoScalingUpdate
-> Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
replicaGlobalSecondaryIndexUpdates} -> Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
replicaGlobalSecondaryIndexUpdates) (\s :: ReplicaAutoScalingUpdate
s@ReplicaAutoScalingUpdate' {} Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
a -> ReplicaAutoScalingUpdate
s {$sel:replicaGlobalSecondaryIndexUpdates:ReplicaAutoScalingUpdate' :: Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
replicaGlobalSecondaryIndexUpdates = Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
a} :: ReplicaAutoScalingUpdate) ((Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
  -> f (Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]))
 -> ReplicaAutoScalingUpdate -> f ReplicaAutoScalingUpdate)
-> ((Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
     -> f (Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]))
    -> Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
    -> f (Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]))
-> (Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
    -> f (Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]))
-> ReplicaAutoScalingUpdate
-> f ReplicaAutoScalingUpdate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
  [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
  [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
  [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
-> Iso
     (Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate])
     (Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate])
     (Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate])
     (Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate])
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
  [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
  [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
  [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
  [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Region where the replica exists.
replicaAutoScalingUpdate_regionName :: Lens.Lens' ReplicaAutoScalingUpdate Prelude.Text
replicaAutoScalingUpdate_regionName :: (Text -> f Text)
-> ReplicaAutoScalingUpdate -> f ReplicaAutoScalingUpdate
replicaAutoScalingUpdate_regionName = (ReplicaAutoScalingUpdate -> Text)
-> (ReplicaAutoScalingUpdate -> Text -> ReplicaAutoScalingUpdate)
-> Lens ReplicaAutoScalingUpdate ReplicaAutoScalingUpdate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicaAutoScalingUpdate' {Text
regionName :: Text
$sel:regionName:ReplicaAutoScalingUpdate' :: ReplicaAutoScalingUpdate -> Text
regionName} -> Text
regionName) (\s :: ReplicaAutoScalingUpdate
s@ReplicaAutoScalingUpdate' {} Text
a -> ReplicaAutoScalingUpdate
s {$sel:regionName:ReplicaAutoScalingUpdate' :: Text
regionName = Text
a} :: ReplicaAutoScalingUpdate)

instance Prelude.Hashable ReplicaAutoScalingUpdate

instance Prelude.NFData ReplicaAutoScalingUpdate

instance Core.ToJSON ReplicaAutoScalingUpdate where
  toJSON :: ReplicaAutoScalingUpdate -> Value
toJSON ReplicaAutoScalingUpdate' {Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
Maybe AutoScalingSettingsUpdate
Text
regionName :: Text
replicaGlobalSecondaryIndexUpdates :: Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
replicaProvisionedReadCapacityAutoScalingUpdate :: Maybe AutoScalingSettingsUpdate
$sel:regionName:ReplicaAutoScalingUpdate' :: ReplicaAutoScalingUpdate -> Text
$sel:replicaGlobalSecondaryIndexUpdates:ReplicaAutoScalingUpdate' :: ReplicaAutoScalingUpdate
-> Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
$sel:replicaProvisionedReadCapacityAutoScalingUpdate:ReplicaAutoScalingUpdate' :: ReplicaAutoScalingUpdate -> Maybe AutoScalingSettingsUpdate
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ ( Text
"ReplicaProvisionedReadCapacityAutoScalingUpdate"
                Text -> AutoScalingSettingsUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=
            )
              (AutoScalingSettingsUpdate -> Pair)
-> Maybe AutoScalingSettingsUpdate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AutoScalingSettingsUpdate
replicaProvisionedReadCapacityAutoScalingUpdate,
            (Text
"ReplicaGlobalSecondaryIndexUpdates" Text -> [ReplicaGlobalSecondaryIndexAutoScalingUpdate] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([ReplicaGlobalSecondaryIndexAutoScalingUpdate] -> Pair)
-> Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
-> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
replicaGlobalSecondaryIndexUpdates,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"RegionName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
regionName)
          ]
      )