{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.DynamoDB.Types.ReplicaAutoScalingUpdate where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DynamoDB.Types.AttributeValue
import Amazonka.DynamoDB.Types.AutoScalingSettingsUpdate
import Amazonka.DynamoDB.Types.ReplicaGlobalSecondaryIndexAutoScalingUpdate
import Amazonka.DynamoDB.Types.WriteRequest
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'
  { -- | Represents the auto scaling settings of global secondary indexes that
    -- will be modified.
    ReplicaAutoScalingUpdate
-> Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
replicaGlobalSecondaryIndexUpdates :: Prelude.Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate],
    ReplicaAutoScalingUpdate -> Maybe AutoScalingSettingsUpdate
replicaProvisionedReadCapacityAutoScalingUpdate :: Prelude.Maybe AutoScalingSettingsUpdate,
    -- | The Region where the replica exists.
    ReplicaAutoScalingUpdate -> Text
regionName :: Prelude.Text
  }
  deriving (ReplicaAutoScalingUpdate -> ReplicaAutoScalingUpdate -> Bool
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]
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
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.
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:
--
-- 'replicaGlobalSecondaryIndexUpdates', 'replicaAutoScalingUpdate_replicaGlobalSecondaryIndexUpdates' - Represents the auto scaling settings of global secondary indexes that
-- will be modified.
--
-- 'replicaProvisionedReadCapacityAutoScalingUpdate', 'replicaAutoScalingUpdate_replicaProvisionedReadCapacityAutoScalingUpdate' - Undocumented member.
--
-- 'regionName', 'replicaAutoScalingUpdate_regionName' - The Region where the replica exists.
newReplicaAutoScalingUpdate ::
  -- | 'regionName'
  Prelude.Text ->
  ReplicaAutoScalingUpdate
newReplicaAutoScalingUpdate :: Text -> ReplicaAutoScalingUpdate
newReplicaAutoScalingUpdate Text
pRegionName_ =
  ReplicaAutoScalingUpdate'
    { $sel:replicaGlobalSecondaryIndexUpdates:ReplicaAutoScalingUpdate' :: Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
replicaGlobalSecondaryIndexUpdates =
        forall a. Maybe a
Prelude.Nothing,
      $sel:replicaProvisionedReadCapacityAutoScalingUpdate:ReplicaAutoScalingUpdate' :: Maybe AutoScalingSettingsUpdate
replicaProvisionedReadCapacityAutoScalingUpdate =
        forall a. Maybe a
Prelude.Nothing,
      $sel:regionName:ReplicaAutoScalingUpdate' :: Text
regionName = Text
pRegionName_
    }

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

-- | Undocumented member.
replicaAutoScalingUpdate_replicaProvisionedReadCapacityAutoScalingUpdate :: Lens.Lens' ReplicaAutoScalingUpdate (Prelude.Maybe AutoScalingSettingsUpdate)
replicaAutoScalingUpdate_replicaProvisionedReadCapacityAutoScalingUpdate :: Lens' ReplicaAutoScalingUpdate (Maybe AutoScalingSettingsUpdate)
replicaAutoScalingUpdate_replicaProvisionedReadCapacityAutoScalingUpdate = 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)

-- | The Region where the replica exists.
replicaAutoScalingUpdate_regionName :: Lens.Lens' ReplicaAutoScalingUpdate Prelude.Text
replicaAutoScalingUpdate_regionName :: Lens' ReplicaAutoScalingUpdate Text
replicaAutoScalingUpdate_regionName = 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 where
  hashWithSalt :: Int -> ReplicaAutoScalingUpdate -> Int
hashWithSalt Int
_salt ReplicaAutoScalingUpdate' {Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
Maybe AutoScalingSettingsUpdate
Text
regionName :: Text
replicaProvisionedReadCapacityAutoScalingUpdate :: Maybe AutoScalingSettingsUpdate
replicaGlobalSecondaryIndexUpdates :: Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
$sel:regionName:ReplicaAutoScalingUpdate' :: ReplicaAutoScalingUpdate -> Text
$sel:replicaProvisionedReadCapacityAutoScalingUpdate:ReplicaAutoScalingUpdate' :: ReplicaAutoScalingUpdate -> Maybe AutoScalingSettingsUpdate
$sel:replicaGlobalSecondaryIndexUpdates:ReplicaAutoScalingUpdate' :: ReplicaAutoScalingUpdate
-> Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
replicaGlobalSecondaryIndexUpdates
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AutoScalingSettingsUpdate
replicaProvisionedReadCapacityAutoScalingUpdate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
regionName

instance Prelude.NFData ReplicaAutoScalingUpdate where
  rnf :: ReplicaAutoScalingUpdate -> ()
rnf ReplicaAutoScalingUpdate' {Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
Maybe AutoScalingSettingsUpdate
Text
regionName :: Text
replicaProvisionedReadCapacityAutoScalingUpdate :: Maybe AutoScalingSettingsUpdate
replicaGlobalSecondaryIndexUpdates :: Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
$sel:regionName:ReplicaAutoScalingUpdate' :: ReplicaAutoScalingUpdate -> Text
$sel:replicaProvisionedReadCapacityAutoScalingUpdate:ReplicaAutoScalingUpdate' :: ReplicaAutoScalingUpdate -> Maybe AutoScalingSettingsUpdate
$sel:replicaGlobalSecondaryIndexUpdates:ReplicaAutoScalingUpdate' :: ReplicaAutoScalingUpdate
-> Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ReplicaGlobalSecondaryIndexAutoScalingUpdate]
replicaGlobalSecondaryIndexUpdates
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf
        Maybe AutoScalingSettingsUpdate
replicaProvisionedReadCapacityAutoScalingUpdate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
regionName

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