{-# 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.ReplicaAutoScalingDescription
-- 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.ReplicaAutoScalingDescription 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.AutoScalingSettingsDescription
import Amazonka.DynamoDB.Types.ReplicaGlobalSecondaryIndexAutoScalingDescription
import Amazonka.DynamoDB.Types.ReplicaStatus
import Amazonka.DynamoDB.Types.WriteRequest
import qualified Amazonka.Prelude as Prelude

-- | Represents the auto scaling settings of the replica.
--
-- /See:/ 'newReplicaAutoScalingDescription' smart constructor.
data ReplicaAutoScalingDescription = ReplicaAutoScalingDescription'
  { -- | Replica-specific global secondary index auto scaling settings.
    ReplicaAutoScalingDescription
-> Maybe [ReplicaGlobalSecondaryIndexAutoScalingDescription]
globalSecondaryIndexes :: Prelude.Maybe [ReplicaGlobalSecondaryIndexAutoScalingDescription],
    -- | The Region where the replica exists.
    ReplicaAutoScalingDescription -> Maybe Text
regionName :: Prelude.Maybe Prelude.Text,
    ReplicaAutoScalingDescription
-> Maybe AutoScalingSettingsDescription
replicaProvisionedReadCapacityAutoScalingSettings :: Prelude.Maybe AutoScalingSettingsDescription,
    ReplicaAutoScalingDescription
-> Maybe AutoScalingSettingsDescription
replicaProvisionedWriteCapacityAutoScalingSettings :: Prelude.Maybe AutoScalingSettingsDescription,
    -- | The current state of the replica:
    --
    -- -   @CREATING@ - The replica is being created.
    --
    -- -   @UPDATING@ - The replica is being updated.
    --
    -- -   @DELETING@ - The replica is being deleted.
    --
    -- -   @ACTIVE@ - The replica is ready for use.
    ReplicaAutoScalingDescription -> Maybe ReplicaStatus
replicaStatus :: Prelude.Maybe ReplicaStatus
  }
  deriving (ReplicaAutoScalingDescription
-> ReplicaAutoScalingDescription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReplicaAutoScalingDescription
-> ReplicaAutoScalingDescription -> Bool
$c/= :: ReplicaAutoScalingDescription
-> ReplicaAutoScalingDescription -> Bool
== :: ReplicaAutoScalingDescription
-> ReplicaAutoScalingDescription -> Bool
$c== :: ReplicaAutoScalingDescription
-> ReplicaAutoScalingDescription -> Bool
Prelude.Eq, ReadPrec [ReplicaAutoScalingDescription]
ReadPrec ReplicaAutoScalingDescription
Int -> ReadS ReplicaAutoScalingDescription
ReadS [ReplicaAutoScalingDescription]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReplicaAutoScalingDescription]
$creadListPrec :: ReadPrec [ReplicaAutoScalingDescription]
readPrec :: ReadPrec ReplicaAutoScalingDescription
$creadPrec :: ReadPrec ReplicaAutoScalingDescription
readList :: ReadS [ReplicaAutoScalingDescription]
$creadList :: ReadS [ReplicaAutoScalingDescription]
readsPrec :: Int -> ReadS ReplicaAutoScalingDescription
$creadsPrec :: Int -> ReadS ReplicaAutoScalingDescription
Prelude.Read, Int -> ReplicaAutoScalingDescription -> ShowS
[ReplicaAutoScalingDescription] -> ShowS
ReplicaAutoScalingDescription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReplicaAutoScalingDescription] -> ShowS
$cshowList :: [ReplicaAutoScalingDescription] -> ShowS
show :: ReplicaAutoScalingDescription -> String
$cshow :: ReplicaAutoScalingDescription -> String
showsPrec :: Int -> ReplicaAutoScalingDescription -> ShowS
$cshowsPrec :: Int -> ReplicaAutoScalingDescription -> ShowS
Prelude.Show, forall x.
Rep ReplicaAutoScalingDescription x
-> ReplicaAutoScalingDescription
forall x.
ReplicaAutoScalingDescription
-> Rep ReplicaAutoScalingDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ReplicaAutoScalingDescription x
-> ReplicaAutoScalingDescription
$cfrom :: forall x.
ReplicaAutoScalingDescription
-> Rep ReplicaAutoScalingDescription x
Prelude.Generic)

-- |
-- Create a value of 'ReplicaAutoScalingDescription' 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:
--
-- 'globalSecondaryIndexes', 'replicaAutoScalingDescription_globalSecondaryIndexes' - Replica-specific global secondary index auto scaling settings.
--
-- 'regionName', 'replicaAutoScalingDescription_regionName' - The Region where the replica exists.
--
-- 'replicaProvisionedReadCapacityAutoScalingSettings', 'replicaAutoScalingDescription_replicaProvisionedReadCapacityAutoScalingSettings' - Undocumented member.
--
-- 'replicaProvisionedWriteCapacityAutoScalingSettings', 'replicaAutoScalingDescription_replicaProvisionedWriteCapacityAutoScalingSettings' - Undocumented member.
--
-- 'replicaStatus', 'replicaAutoScalingDescription_replicaStatus' - The current state of the replica:
--
-- -   @CREATING@ - The replica is being created.
--
-- -   @UPDATING@ - The replica is being updated.
--
-- -   @DELETING@ - The replica is being deleted.
--
-- -   @ACTIVE@ - The replica is ready for use.
newReplicaAutoScalingDescription ::
  ReplicaAutoScalingDescription
newReplicaAutoScalingDescription :: ReplicaAutoScalingDescription
newReplicaAutoScalingDescription =
  ReplicaAutoScalingDescription'
    { $sel:globalSecondaryIndexes:ReplicaAutoScalingDescription' :: Maybe [ReplicaGlobalSecondaryIndexAutoScalingDescription]
globalSecondaryIndexes =
        forall a. Maybe a
Prelude.Nothing,
      $sel:regionName:ReplicaAutoScalingDescription' :: Maybe Text
regionName = forall a. Maybe a
Prelude.Nothing,
      $sel:replicaProvisionedReadCapacityAutoScalingSettings:ReplicaAutoScalingDescription' :: Maybe AutoScalingSettingsDescription
replicaProvisionedReadCapacityAutoScalingSettings =
        forall a. Maybe a
Prelude.Nothing,
      $sel:replicaProvisionedWriteCapacityAutoScalingSettings:ReplicaAutoScalingDescription' :: Maybe AutoScalingSettingsDescription
replicaProvisionedWriteCapacityAutoScalingSettings =
        forall a. Maybe a
Prelude.Nothing,
      $sel:replicaStatus:ReplicaAutoScalingDescription' :: Maybe ReplicaStatus
replicaStatus = forall a. Maybe a
Prelude.Nothing
    }

-- | Replica-specific global secondary index auto scaling settings.
replicaAutoScalingDescription_globalSecondaryIndexes :: Lens.Lens' ReplicaAutoScalingDescription (Prelude.Maybe [ReplicaGlobalSecondaryIndexAutoScalingDescription])
replicaAutoScalingDescription_globalSecondaryIndexes :: Lens'
  ReplicaAutoScalingDescription
  (Maybe [ReplicaGlobalSecondaryIndexAutoScalingDescription])
replicaAutoScalingDescription_globalSecondaryIndexes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicaAutoScalingDescription' {Maybe [ReplicaGlobalSecondaryIndexAutoScalingDescription]
globalSecondaryIndexes :: Maybe [ReplicaGlobalSecondaryIndexAutoScalingDescription]
$sel:globalSecondaryIndexes:ReplicaAutoScalingDescription' :: ReplicaAutoScalingDescription
-> Maybe [ReplicaGlobalSecondaryIndexAutoScalingDescription]
globalSecondaryIndexes} -> Maybe [ReplicaGlobalSecondaryIndexAutoScalingDescription]
globalSecondaryIndexes) (\s :: ReplicaAutoScalingDescription
s@ReplicaAutoScalingDescription' {} Maybe [ReplicaGlobalSecondaryIndexAutoScalingDescription]
a -> ReplicaAutoScalingDescription
s {$sel:globalSecondaryIndexes:ReplicaAutoScalingDescription' :: Maybe [ReplicaGlobalSecondaryIndexAutoScalingDescription]
globalSecondaryIndexes = Maybe [ReplicaGlobalSecondaryIndexAutoScalingDescription]
a} :: ReplicaAutoScalingDescription) 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

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

-- | Undocumented member.
replicaAutoScalingDescription_replicaProvisionedReadCapacityAutoScalingSettings :: Lens.Lens' ReplicaAutoScalingDescription (Prelude.Maybe AutoScalingSettingsDescription)
replicaAutoScalingDescription_replicaProvisionedReadCapacityAutoScalingSettings :: Lens'
  ReplicaAutoScalingDescription
  (Maybe AutoScalingSettingsDescription)
replicaAutoScalingDescription_replicaProvisionedReadCapacityAutoScalingSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicaAutoScalingDescription' {Maybe AutoScalingSettingsDescription
replicaProvisionedReadCapacityAutoScalingSettings :: Maybe AutoScalingSettingsDescription
$sel:replicaProvisionedReadCapacityAutoScalingSettings:ReplicaAutoScalingDescription' :: ReplicaAutoScalingDescription
-> Maybe AutoScalingSettingsDescription
replicaProvisionedReadCapacityAutoScalingSettings} -> Maybe AutoScalingSettingsDescription
replicaProvisionedReadCapacityAutoScalingSettings) (\s :: ReplicaAutoScalingDescription
s@ReplicaAutoScalingDescription' {} Maybe AutoScalingSettingsDescription
a -> ReplicaAutoScalingDescription
s {$sel:replicaProvisionedReadCapacityAutoScalingSettings:ReplicaAutoScalingDescription' :: Maybe AutoScalingSettingsDescription
replicaProvisionedReadCapacityAutoScalingSettings = Maybe AutoScalingSettingsDescription
a} :: ReplicaAutoScalingDescription)

-- | Undocumented member.
replicaAutoScalingDescription_replicaProvisionedWriteCapacityAutoScalingSettings :: Lens.Lens' ReplicaAutoScalingDescription (Prelude.Maybe AutoScalingSettingsDescription)
replicaAutoScalingDescription_replicaProvisionedWriteCapacityAutoScalingSettings :: Lens'
  ReplicaAutoScalingDescription
  (Maybe AutoScalingSettingsDescription)
replicaAutoScalingDescription_replicaProvisionedWriteCapacityAutoScalingSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicaAutoScalingDescription' {Maybe AutoScalingSettingsDescription
replicaProvisionedWriteCapacityAutoScalingSettings :: Maybe AutoScalingSettingsDescription
$sel:replicaProvisionedWriteCapacityAutoScalingSettings:ReplicaAutoScalingDescription' :: ReplicaAutoScalingDescription
-> Maybe AutoScalingSettingsDescription
replicaProvisionedWriteCapacityAutoScalingSettings} -> Maybe AutoScalingSettingsDescription
replicaProvisionedWriteCapacityAutoScalingSettings) (\s :: ReplicaAutoScalingDescription
s@ReplicaAutoScalingDescription' {} Maybe AutoScalingSettingsDescription
a -> ReplicaAutoScalingDescription
s {$sel:replicaProvisionedWriteCapacityAutoScalingSettings:ReplicaAutoScalingDescription' :: Maybe AutoScalingSettingsDescription
replicaProvisionedWriteCapacityAutoScalingSettings = Maybe AutoScalingSettingsDescription
a} :: ReplicaAutoScalingDescription)

-- | The current state of the replica:
--
-- -   @CREATING@ - The replica is being created.
--
-- -   @UPDATING@ - The replica is being updated.
--
-- -   @DELETING@ - The replica is being deleted.
--
-- -   @ACTIVE@ - The replica is ready for use.
replicaAutoScalingDescription_replicaStatus :: Lens.Lens' ReplicaAutoScalingDescription (Prelude.Maybe ReplicaStatus)
replicaAutoScalingDescription_replicaStatus :: Lens' ReplicaAutoScalingDescription (Maybe ReplicaStatus)
replicaAutoScalingDescription_replicaStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReplicaAutoScalingDescription' {Maybe ReplicaStatus
replicaStatus :: Maybe ReplicaStatus
$sel:replicaStatus:ReplicaAutoScalingDescription' :: ReplicaAutoScalingDescription -> Maybe ReplicaStatus
replicaStatus} -> Maybe ReplicaStatus
replicaStatus) (\s :: ReplicaAutoScalingDescription
s@ReplicaAutoScalingDescription' {} Maybe ReplicaStatus
a -> ReplicaAutoScalingDescription
s {$sel:replicaStatus:ReplicaAutoScalingDescription' :: Maybe ReplicaStatus
replicaStatus = Maybe ReplicaStatus
a} :: ReplicaAutoScalingDescription)

instance Data.FromJSON ReplicaAutoScalingDescription where
  parseJSON :: Value -> Parser ReplicaAutoScalingDescription
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ReplicaAutoScalingDescription"
      ( \Object
x ->
          Maybe [ReplicaGlobalSecondaryIndexAutoScalingDescription]
-> Maybe Text
-> Maybe AutoScalingSettingsDescription
-> Maybe AutoScalingSettingsDescription
-> Maybe ReplicaStatus
-> ReplicaAutoScalingDescription
ReplicaAutoScalingDescription'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"GlobalSecondaryIndexes"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"RegionName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ReplicaProvisionedReadCapacityAutoScalingSettings"
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ReplicaProvisionedWriteCapacityAutoScalingSettings"
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ReplicaStatus")
      )

instance
  Prelude.Hashable
    ReplicaAutoScalingDescription
  where
  hashWithSalt :: Int -> ReplicaAutoScalingDescription -> Int
hashWithSalt Int
_salt ReplicaAutoScalingDescription' {Maybe [ReplicaGlobalSecondaryIndexAutoScalingDescription]
Maybe Text
Maybe ReplicaStatus
Maybe AutoScalingSettingsDescription
replicaStatus :: Maybe ReplicaStatus
replicaProvisionedWriteCapacityAutoScalingSettings :: Maybe AutoScalingSettingsDescription
replicaProvisionedReadCapacityAutoScalingSettings :: Maybe AutoScalingSettingsDescription
regionName :: Maybe Text
globalSecondaryIndexes :: Maybe [ReplicaGlobalSecondaryIndexAutoScalingDescription]
$sel:replicaStatus:ReplicaAutoScalingDescription' :: ReplicaAutoScalingDescription -> Maybe ReplicaStatus
$sel:replicaProvisionedWriteCapacityAutoScalingSettings:ReplicaAutoScalingDescription' :: ReplicaAutoScalingDescription
-> Maybe AutoScalingSettingsDescription
$sel:replicaProvisionedReadCapacityAutoScalingSettings:ReplicaAutoScalingDescription' :: ReplicaAutoScalingDescription
-> Maybe AutoScalingSettingsDescription
$sel:regionName:ReplicaAutoScalingDescription' :: ReplicaAutoScalingDescription -> Maybe Text
$sel:globalSecondaryIndexes:ReplicaAutoScalingDescription' :: ReplicaAutoScalingDescription
-> Maybe [ReplicaGlobalSecondaryIndexAutoScalingDescription]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ReplicaGlobalSecondaryIndexAutoScalingDescription]
globalSecondaryIndexes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
regionName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AutoScalingSettingsDescription
replicaProvisionedReadCapacityAutoScalingSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AutoScalingSettingsDescription
replicaProvisionedWriteCapacityAutoScalingSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ReplicaStatus
replicaStatus

instance Prelude.NFData ReplicaAutoScalingDescription where
  rnf :: ReplicaAutoScalingDescription -> ()
rnf ReplicaAutoScalingDescription' {Maybe [ReplicaGlobalSecondaryIndexAutoScalingDescription]
Maybe Text
Maybe ReplicaStatus
Maybe AutoScalingSettingsDescription
replicaStatus :: Maybe ReplicaStatus
replicaProvisionedWriteCapacityAutoScalingSettings :: Maybe AutoScalingSettingsDescription
replicaProvisionedReadCapacityAutoScalingSettings :: Maybe AutoScalingSettingsDescription
regionName :: Maybe Text
globalSecondaryIndexes :: Maybe [ReplicaGlobalSecondaryIndexAutoScalingDescription]
$sel:replicaStatus:ReplicaAutoScalingDescription' :: ReplicaAutoScalingDescription -> Maybe ReplicaStatus
$sel:replicaProvisionedWriteCapacityAutoScalingSettings:ReplicaAutoScalingDescription' :: ReplicaAutoScalingDescription
-> Maybe AutoScalingSettingsDescription
$sel:replicaProvisionedReadCapacityAutoScalingSettings:ReplicaAutoScalingDescription' :: ReplicaAutoScalingDescription
-> Maybe AutoScalingSettingsDescription
$sel:regionName:ReplicaAutoScalingDescription' :: ReplicaAutoScalingDescription -> Maybe Text
$sel:globalSecondaryIndexes:ReplicaAutoScalingDescription' :: ReplicaAutoScalingDescription
-> Maybe [ReplicaGlobalSecondaryIndexAutoScalingDescription]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ReplicaGlobalSecondaryIndexAutoScalingDescription]
globalSecondaryIndexes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
regionName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf
        Maybe AutoScalingSettingsDescription
replicaProvisionedReadCapacityAutoScalingSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf
        Maybe AutoScalingSettingsDescription
replicaProvisionedWriteCapacityAutoScalingSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ReplicaStatus
replicaStatus