{-# 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.AutoScalingSettingsUpdate
-- 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.AutoScalingSettingsUpdate where

import qualified Amazonka.Core as Core
import Amazonka.DynamoDB.Types.AutoScalingPolicyUpdate
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents the auto scaling settings to be modified for a global table
-- or global secondary index.
--
-- /See:/ 'newAutoScalingSettingsUpdate' smart constructor.
data AutoScalingSettingsUpdate = AutoScalingSettingsUpdate'
  { -- | Disabled auto scaling for this global table or global secondary index.
    AutoScalingSettingsUpdate -> Maybe Bool
autoScalingDisabled :: Prelude.Maybe Prelude.Bool,
    -- | The minimum capacity units that a global table or global secondary index
    -- should be scaled down to.
    AutoScalingSettingsUpdate -> Maybe Natural
minimumUnits :: Prelude.Maybe Prelude.Natural,
    -- | The scaling policy to apply for scaling target global table or global
    -- secondary index capacity units.
    AutoScalingSettingsUpdate -> Maybe AutoScalingPolicyUpdate
scalingPolicyUpdate :: Prelude.Maybe AutoScalingPolicyUpdate,
    -- | The maximum capacity units that a global table or global secondary index
    -- should be scaled up to.
    AutoScalingSettingsUpdate -> Maybe Natural
maximumUnits :: Prelude.Maybe Prelude.Natural,
    -- | Role ARN used for configuring auto scaling policy.
    AutoScalingSettingsUpdate -> Maybe Text
autoScalingRoleArn :: Prelude.Maybe Prelude.Text
  }
  deriving (AutoScalingSettingsUpdate -> AutoScalingSettingsUpdate -> Bool
(AutoScalingSettingsUpdate -> AutoScalingSettingsUpdate -> Bool)
-> (AutoScalingSettingsUpdate -> AutoScalingSettingsUpdate -> Bool)
-> Eq AutoScalingSettingsUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoScalingSettingsUpdate -> AutoScalingSettingsUpdate -> Bool
$c/= :: AutoScalingSettingsUpdate -> AutoScalingSettingsUpdate -> Bool
== :: AutoScalingSettingsUpdate -> AutoScalingSettingsUpdate -> Bool
$c== :: AutoScalingSettingsUpdate -> AutoScalingSettingsUpdate -> Bool
Prelude.Eq, ReadPrec [AutoScalingSettingsUpdate]
ReadPrec AutoScalingSettingsUpdate
Int -> ReadS AutoScalingSettingsUpdate
ReadS [AutoScalingSettingsUpdate]
(Int -> ReadS AutoScalingSettingsUpdate)
-> ReadS [AutoScalingSettingsUpdate]
-> ReadPrec AutoScalingSettingsUpdate
-> ReadPrec [AutoScalingSettingsUpdate]
-> Read AutoScalingSettingsUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoScalingSettingsUpdate]
$creadListPrec :: ReadPrec [AutoScalingSettingsUpdate]
readPrec :: ReadPrec AutoScalingSettingsUpdate
$creadPrec :: ReadPrec AutoScalingSettingsUpdate
readList :: ReadS [AutoScalingSettingsUpdate]
$creadList :: ReadS [AutoScalingSettingsUpdate]
readsPrec :: Int -> ReadS AutoScalingSettingsUpdate
$creadsPrec :: Int -> ReadS AutoScalingSettingsUpdate
Prelude.Read, Int -> AutoScalingSettingsUpdate -> ShowS
[AutoScalingSettingsUpdate] -> ShowS
AutoScalingSettingsUpdate -> String
(Int -> AutoScalingSettingsUpdate -> ShowS)
-> (AutoScalingSettingsUpdate -> String)
-> ([AutoScalingSettingsUpdate] -> ShowS)
-> Show AutoScalingSettingsUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoScalingSettingsUpdate] -> ShowS
$cshowList :: [AutoScalingSettingsUpdate] -> ShowS
show :: AutoScalingSettingsUpdate -> String
$cshow :: AutoScalingSettingsUpdate -> String
showsPrec :: Int -> AutoScalingSettingsUpdate -> ShowS
$cshowsPrec :: Int -> AutoScalingSettingsUpdate -> ShowS
Prelude.Show, (forall x.
 AutoScalingSettingsUpdate -> Rep AutoScalingSettingsUpdate x)
-> (forall x.
    Rep AutoScalingSettingsUpdate x -> AutoScalingSettingsUpdate)
-> Generic AutoScalingSettingsUpdate
forall x.
Rep AutoScalingSettingsUpdate x -> AutoScalingSettingsUpdate
forall x.
AutoScalingSettingsUpdate -> Rep AutoScalingSettingsUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AutoScalingSettingsUpdate x -> AutoScalingSettingsUpdate
$cfrom :: forall x.
AutoScalingSettingsUpdate -> Rep AutoScalingSettingsUpdate x
Prelude.Generic)

-- |
-- Create a value of 'AutoScalingSettingsUpdate' 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:
--
-- 'autoScalingDisabled', 'autoScalingSettingsUpdate_autoScalingDisabled' - Disabled auto scaling for this global table or global secondary index.
--
-- 'minimumUnits', 'autoScalingSettingsUpdate_minimumUnits' - The minimum capacity units that a global table or global secondary index
-- should be scaled down to.
--
-- 'scalingPolicyUpdate', 'autoScalingSettingsUpdate_scalingPolicyUpdate' - The scaling policy to apply for scaling target global table or global
-- secondary index capacity units.
--
-- 'maximumUnits', 'autoScalingSettingsUpdate_maximumUnits' - The maximum capacity units that a global table or global secondary index
-- should be scaled up to.
--
-- 'autoScalingRoleArn', 'autoScalingSettingsUpdate_autoScalingRoleArn' - Role ARN used for configuring auto scaling policy.
newAutoScalingSettingsUpdate ::
  AutoScalingSettingsUpdate
newAutoScalingSettingsUpdate :: AutoScalingSettingsUpdate
newAutoScalingSettingsUpdate =
  AutoScalingSettingsUpdate' :: Maybe Bool
-> Maybe Natural
-> Maybe AutoScalingPolicyUpdate
-> Maybe Natural
-> Maybe Text
-> AutoScalingSettingsUpdate
AutoScalingSettingsUpdate'
    { $sel:autoScalingDisabled:AutoScalingSettingsUpdate' :: Maybe Bool
autoScalingDisabled =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:minimumUnits:AutoScalingSettingsUpdate' :: Maybe Natural
minimumUnits = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:scalingPolicyUpdate:AutoScalingSettingsUpdate' :: Maybe AutoScalingPolicyUpdate
scalingPolicyUpdate = Maybe AutoScalingPolicyUpdate
forall a. Maybe a
Prelude.Nothing,
      $sel:maximumUnits:AutoScalingSettingsUpdate' :: Maybe Natural
maximumUnits = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:autoScalingRoleArn:AutoScalingSettingsUpdate' :: Maybe Text
autoScalingRoleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Disabled auto scaling for this global table or global secondary index.
autoScalingSettingsUpdate_autoScalingDisabled :: Lens.Lens' AutoScalingSettingsUpdate (Prelude.Maybe Prelude.Bool)
autoScalingSettingsUpdate_autoScalingDisabled :: (Maybe Bool -> f (Maybe Bool))
-> AutoScalingSettingsUpdate -> f AutoScalingSettingsUpdate
autoScalingSettingsUpdate_autoScalingDisabled = (AutoScalingSettingsUpdate -> Maybe Bool)
-> (AutoScalingSettingsUpdate
    -> Maybe Bool -> AutoScalingSettingsUpdate)
-> Lens
     AutoScalingSettingsUpdate
     AutoScalingSettingsUpdate
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingSettingsUpdate' {Maybe Bool
autoScalingDisabled :: Maybe Bool
$sel:autoScalingDisabled:AutoScalingSettingsUpdate' :: AutoScalingSettingsUpdate -> Maybe Bool
autoScalingDisabled} -> Maybe Bool
autoScalingDisabled) (\s :: AutoScalingSettingsUpdate
s@AutoScalingSettingsUpdate' {} Maybe Bool
a -> AutoScalingSettingsUpdate
s {$sel:autoScalingDisabled:AutoScalingSettingsUpdate' :: Maybe Bool
autoScalingDisabled = Maybe Bool
a} :: AutoScalingSettingsUpdate)

-- | The minimum capacity units that a global table or global secondary index
-- should be scaled down to.
autoScalingSettingsUpdate_minimumUnits :: Lens.Lens' AutoScalingSettingsUpdate (Prelude.Maybe Prelude.Natural)
autoScalingSettingsUpdate_minimumUnits :: (Maybe Natural -> f (Maybe Natural))
-> AutoScalingSettingsUpdate -> f AutoScalingSettingsUpdate
autoScalingSettingsUpdate_minimumUnits = (AutoScalingSettingsUpdate -> Maybe Natural)
-> (AutoScalingSettingsUpdate
    -> Maybe Natural -> AutoScalingSettingsUpdate)
-> Lens
     AutoScalingSettingsUpdate
     AutoScalingSettingsUpdate
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingSettingsUpdate' {Maybe Natural
minimumUnits :: Maybe Natural
$sel:minimumUnits:AutoScalingSettingsUpdate' :: AutoScalingSettingsUpdate -> Maybe Natural
minimumUnits} -> Maybe Natural
minimumUnits) (\s :: AutoScalingSettingsUpdate
s@AutoScalingSettingsUpdate' {} Maybe Natural
a -> AutoScalingSettingsUpdate
s {$sel:minimumUnits:AutoScalingSettingsUpdate' :: Maybe Natural
minimumUnits = Maybe Natural
a} :: AutoScalingSettingsUpdate)

-- | The scaling policy to apply for scaling target global table or global
-- secondary index capacity units.
autoScalingSettingsUpdate_scalingPolicyUpdate :: Lens.Lens' AutoScalingSettingsUpdate (Prelude.Maybe AutoScalingPolicyUpdate)
autoScalingSettingsUpdate_scalingPolicyUpdate :: (Maybe AutoScalingPolicyUpdate
 -> f (Maybe AutoScalingPolicyUpdate))
-> AutoScalingSettingsUpdate -> f AutoScalingSettingsUpdate
autoScalingSettingsUpdate_scalingPolicyUpdate = (AutoScalingSettingsUpdate -> Maybe AutoScalingPolicyUpdate)
-> (AutoScalingSettingsUpdate
    -> Maybe AutoScalingPolicyUpdate -> AutoScalingSettingsUpdate)
-> Lens
     AutoScalingSettingsUpdate
     AutoScalingSettingsUpdate
     (Maybe AutoScalingPolicyUpdate)
     (Maybe AutoScalingPolicyUpdate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingSettingsUpdate' {Maybe AutoScalingPolicyUpdate
scalingPolicyUpdate :: Maybe AutoScalingPolicyUpdate
$sel:scalingPolicyUpdate:AutoScalingSettingsUpdate' :: AutoScalingSettingsUpdate -> Maybe AutoScalingPolicyUpdate
scalingPolicyUpdate} -> Maybe AutoScalingPolicyUpdate
scalingPolicyUpdate) (\s :: AutoScalingSettingsUpdate
s@AutoScalingSettingsUpdate' {} Maybe AutoScalingPolicyUpdate
a -> AutoScalingSettingsUpdate
s {$sel:scalingPolicyUpdate:AutoScalingSettingsUpdate' :: Maybe AutoScalingPolicyUpdate
scalingPolicyUpdate = Maybe AutoScalingPolicyUpdate
a} :: AutoScalingSettingsUpdate)

-- | The maximum capacity units that a global table or global secondary index
-- should be scaled up to.
autoScalingSettingsUpdate_maximumUnits :: Lens.Lens' AutoScalingSettingsUpdate (Prelude.Maybe Prelude.Natural)
autoScalingSettingsUpdate_maximumUnits :: (Maybe Natural -> f (Maybe Natural))
-> AutoScalingSettingsUpdate -> f AutoScalingSettingsUpdate
autoScalingSettingsUpdate_maximumUnits = (AutoScalingSettingsUpdate -> Maybe Natural)
-> (AutoScalingSettingsUpdate
    -> Maybe Natural -> AutoScalingSettingsUpdate)
-> Lens
     AutoScalingSettingsUpdate
     AutoScalingSettingsUpdate
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingSettingsUpdate' {Maybe Natural
maximumUnits :: Maybe Natural
$sel:maximumUnits:AutoScalingSettingsUpdate' :: AutoScalingSettingsUpdate -> Maybe Natural
maximumUnits} -> Maybe Natural
maximumUnits) (\s :: AutoScalingSettingsUpdate
s@AutoScalingSettingsUpdate' {} Maybe Natural
a -> AutoScalingSettingsUpdate
s {$sel:maximumUnits:AutoScalingSettingsUpdate' :: Maybe Natural
maximumUnits = Maybe Natural
a} :: AutoScalingSettingsUpdate)

-- | Role ARN used for configuring auto scaling policy.
autoScalingSettingsUpdate_autoScalingRoleArn :: Lens.Lens' AutoScalingSettingsUpdate (Prelude.Maybe Prelude.Text)
autoScalingSettingsUpdate_autoScalingRoleArn :: (Maybe Text -> f (Maybe Text))
-> AutoScalingSettingsUpdate -> f AutoScalingSettingsUpdate
autoScalingSettingsUpdate_autoScalingRoleArn = (AutoScalingSettingsUpdate -> Maybe Text)
-> (AutoScalingSettingsUpdate
    -> Maybe Text -> AutoScalingSettingsUpdate)
-> Lens
     AutoScalingSettingsUpdate
     AutoScalingSettingsUpdate
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoScalingSettingsUpdate' {Maybe Text
autoScalingRoleArn :: Maybe Text
$sel:autoScalingRoleArn:AutoScalingSettingsUpdate' :: AutoScalingSettingsUpdate -> Maybe Text
autoScalingRoleArn} -> Maybe Text
autoScalingRoleArn) (\s :: AutoScalingSettingsUpdate
s@AutoScalingSettingsUpdate' {} Maybe Text
a -> AutoScalingSettingsUpdate
s {$sel:autoScalingRoleArn:AutoScalingSettingsUpdate' :: Maybe Text
autoScalingRoleArn = Maybe Text
a} :: AutoScalingSettingsUpdate)

instance Prelude.Hashable AutoScalingSettingsUpdate

instance Prelude.NFData AutoScalingSettingsUpdate

instance Core.ToJSON AutoScalingSettingsUpdate where
  toJSON :: AutoScalingSettingsUpdate -> Value
toJSON AutoScalingSettingsUpdate' {Maybe Bool
Maybe Natural
Maybe Text
Maybe AutoScalingPolicyUpdate
autoScalingRoleArn :: Maybe Text
maximumUnits :: Maybe Natural
scalingPolicyUpdate :: Maybe AutoScalingPolicyUpdate
minimumUnits :: Maybe Natural
autoScalingDisabled :: Maybe Bool
$sel:autoScalingRoleArn:AutoScalingSettingsUpdate' :: AutoScalingSettingsUpdate -> Maybe Text
$sel:maximumUnits:AutoScalingSettingsUpdate' :: AutoScalingSettingsUpdate -> Maybe Natural
$sel:scalingPolicyUpdate:AutoScalingSettingsUpdate' :: AutoScalingSettingsUpdate -> Maybe AutoScalingPolicyUpdate
$sel:minimumUnits:AutoScalingSettingsUpdate' :: AutoScalingSettingsUpdate -> Maybe Natural
$sel:autoScalingDisabled:AutoScalingSettingsUpdate' :: AutoScalingSettingsUpdate -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"AutoScalingDisabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
autoScalingDisabled,
            (Text
"MinimumUnits" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
minimumUnits,
            (Text
"ScalingPolicyUpdate" Text -> AutoScalingPolicyUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AutoScalingPolicyUpdate -> Pair)
-> Maybe AutoScalingPolicyUpdate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AutoScalingPolicyUpdate
scalingPolicyUpdate,
            (Text
"MaximumUnits" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maximumUnits,
            (Text
"AutoScalingRoleArn" 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
autoScalingRoleArn
          ]
      )