{-# 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.RDS.Types.ScalingConfigurationInfo
-- 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.RDS.Types.ScalingConfigurationInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Shows the scaling configuration for an Aurora DB cluster in @serverless@
-- DB engine mode.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.html Using Amazon Aurora Serverless v1>
-- in the /Amazon Aurora User Guide/.
--
-- /See:/ 'newScalingConfigurationInfo' smart constructor.
data ScalingConfigurationInfo = ScalingConfigurationInfo'
  { -- | A value that indicates whether automatic pause is allowed for the Aurora
    -- DB cluster in @serverless@ DB engine mode.
    --
    -- When the value is set to false for an Aurora Serverless v1 DB cluster,
    -- the DB cluster automatically resumes.
    ScalingConfigurationInfo -> Maybe Bool
autoPause :: Prelude.Maybe Prelude.Bool,
    -- | The maximum capacity for an Aurora DB cluster in @serverless@ DB engine
    -- mode.
    ScalingConfigurationInfo -> Maybe Int
maxCapacity :: Prelude.Maybe Prelude.Int,
    -- | The minimum capacity for an Aurora DB cluster in @serverless@ DB engine
    -- mode.
    ScalingConfigurationInfo -> Maybe Int
minCapacity :: Prelude.Maybe Prelude.Int,
    -- | The number of seconds before scaling times out. What happens when an
    -- attempted scaling action times out is determined by the @TimeoutAction@
    -- setting.
    ScalingConfigurationInfo -> Maybe Int
secondsBeforeTimeout :: Prelude.Maybe Prelude.Int,
    -- | The remaining amount of time, in seconds, before the Aurora DB cluster
    -- in @serverless@ mode is paused. A DB cluster can be paused only when
    -- it\'s idle (it has no connections).
    ScalingConfigurationInfo -> Maybe Int
secondsUntilAutoPause :: Prelude.Maybe Prelude.Int,
    -- | The action that occurs when Aurora times out while attempting to change
    -- the capacity of an Aurora Serverless v1 cluster. The value is either
    -- @ForceApplyCapacityChange@ or @RollbackCapacityChange@.
    --
    -- @ForceApplyCapacityChange@, the default, sets the capacity to the
    -- specified value as soon as possible.
    --
    -- @RollbackCapacityChange@ ignores the capacity change if a scaling point
    -- isn\'t found in the timeout period.
    ScalingConfigurationInfo -> Maybe Text
timeoutAction :: Prelude.Maybe Prelude.Text
  }
  deriving (ScalingConfigurationInfo -> ScalingConfigurationInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScalingConfigurationInfo -> ScalingConfigurationInfo -> Bool
$c/= :: ScalingConfigurationInfo -> ScalingConfigurationInfo -> Bool
== :: ScalingConfigurationInfo -> ScalingConfigurationInfo -> Bool
$c== :: ScalingConfigurationInfo -> ScalingConfigurationInfo -> Bool
Prelude.Eq, ReadPrec [ScalingConfigurationInfo]
ReadPrec ScalingConfigurationInfo
Int -> ReadS ScalingConfigurationInfo
ReadS [ScalingConfigurationInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScalingConfigurationInfo]
$creadListPrec :: ReadPrec [ScalingConfigurationInfo]
readPrec :: ReadPrec ScalingConfigurationInfo
$creadPrec :: ReadPrec ScalingConfigurationInfo
readList :: ReadS [ScalingConfigurationInfo]
$creadList :: ReadS [ScalingConfigurationInfo]
readsPrec :: Int -> ReadS ScalingConfigurationInfo
$creadsPrec :: Int -> ReadS ScalingConfigurationInfo
Prelude.Read, Int -> ScalingConfigurationInfo -> ShowS
[ScalingConfigurationInfo] -> ShowS
ScalingConfigurationInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScalingConfigurationInfo] -> ShowS
$cshowList :: [ScalingConfigurationInfo] -> ShowS
show :: ScalingConfigurationInfo -> String
$cshow :: ScalingConfigurationInfo -> String
showsPrec :: Int -> ScalingConfigurationInfo -> ShowS
$cshowsPrec :: Int -> ScalingConfigurationInfo -> ShowS
Prelude.Show, forall x.
Rep ScalingConfigurationInfo x -> ScalingConfigurationInfo
forall x.
ScalingConfigurationInfo -> Rep ScalingConfigurationInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ScalingConfigurationInfo x -> ScalingConfigurationInfo
$cfrom :: forall x.
ScalingConfigurationInfo -> Rep ScalingConfigurationInfo x
Prelude.Generic)

-- |
-- Create a value of 'ScalingConfigurationInfo' 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:
--
-- 'autoPause', 'scalingConfigurationInfo_autoPause' - A value that indicates whether automatic pause is allowed for the Aurora
-- DB cluster in @serverless@ DB engine mode.
--
-- When the value is set to false for an Aurora Serverless v1 DB cluster,
-- the DB cluster automatically resumes.
--
-- 'maxCapacity', 'scalingConfigurationInfo_maxCapacity' - The maximum capacity for an Aurora DB cluster in @serverless@ DB engine
-- mode.
--
-- 'minCapacity', 'scalingConfigurationInfo_minCapacity' - The minimum capacity for an Aurora DB cluster in @serverless@ DB engine
-- mode.
--
-- 'secondsBeforeTimeout', 'scalingConfigurationInfo_secondsBeforeTimeout' - The number of seconds before scaling times out. What happens when an
-- attempted scaling action times out is determined by the @TimeoutAction@
-- setting.
--
-- 'secondsUntilAutoPause', 'scalingConfigurationInfo_secondsUntilAutoPause' - The remaining amount of time, in seconds, before the Aurora DB cluster
-- in @serverless@ mode is paused. A DB cluster can be paused only when
-- it\'s idle (it has no connections).
--
-- 'timeoutAction', 'scalingConfigurationInfo_timeoutAction' - The action that occurs when Aurora times out while attempting to change
-- the capacity of an Aurora Serverless v1 cluster. The value is either
-- @ForceApplyCapacityChange@ or @RollbackCapacityChange@.
--
-- @ForceApplyCapacityChange@, the default, sets the capacity to the
-- specified value as soon as possible.
--
-- @RollbackCapacityChange@ ignores the capacity change if a scaling point
-- isn\'t found in the timeout period.
newScalingConfigurationInfo ::
  ScalingConfigurationInfo
newScalingConfigurationInfo :: ScalingConfigurationInfo
newScalingConfigurationInfo =
  ScalingConfigurationInfo'
    { $sel:autoPause:ScalingConfigurationInfo' :: Maybe Bool
autoPause =
        forall a. Maybe a
Prelude.Nothing,
      $sel:maxCapacity:ScalingConfigurationInfo' :: Maybe Int
maxCapacity = forall a. Maybe a
Prelude.Nothing,
      $sel:minCapacity:ScalingConfigurationInfo' :: Maybe Int
minCapacity = forall a. Maybe a
Prelude.Nothing,
      $sel:secondsBeforeTimeout:ScalingConfigurationInfo' :: Maybe Int
secondsBeforeTimeout = forall a. Maybe a
Prelude.Nothing,
      $sel:secondsUntilAutoPause:ScalingConfigurationInfo' :: Maybe Int
secondsUntilAutoPause = forall a. Maybe a
Prelude.Nothing,
      $sel:timeoutAction:ScalingConfigurationInfo' :: Maybe Text
timeoutAction = forall a. Maybe a
Prelude.Nothing
    }

-- | A value that indicates whether automatic pause is allowed for the Aurora
-- DB cluster in @serverless@ DB engine mode.
--
-- When the value is set to false for an Aurora Serverless v1 DB cluster,
-- the DB cluster automatically resumes.
scalingConfigurationInfo_autoPause :: Lens.Lens' ScalingConfigurationInfo (Prelude.Maybe Prelude.Bool)
scalingConfigurationInfo_autoPause :: Lens' ScalingConfigurationInfo (Maybe Bool)
scalingConfigurationInfo_autoPause = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingConfigurationInfo' {Maybe Bool
autoPause :: Maybe Bool
$sel:autoPause:ScalingConfigurationInfo' :: ScalingConfigurationInfo -> Maybe Bool
autoPause} -> Maybe Bool
autoPause) (\s :: ScalingConfigurationInfo
s@ScalingConfigurationInfo' {} Maybe Bool
a -> ScalingConfigurationInfo
s {$sel:autoPause:ScalingConfigurationInfo' :: Maybe Bool
autoPause = Maybe Bool
a} :: ScalingConfigurationInfo)

-- | The maximum capacity for an Aurora DB cluster in @serverless@ DB engine
-- mode.
scalingConfigurationInfo_maxCapacity :: Lens.Lens' ScalingConfigurationInfo (Prelude.Maybe Prelude.Int)
scalingConfigurationInfo_maxCapacity :: Lens' ScalingConfigurationInfo (Maybe Int)
scalingConfigurationInfo_maxCapacity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingConfigurationInfo' {Maybe Int
maxCapacity :: Maybe Int
$sel:maxCapacity:ScalingConfigurationInfo' :: ScalingConfigurationInfo -> Maybe Int
maxCapacity} -> Maybe Int
maxCapacity) (\s :: ScalingConfigurationInfo
s@ScalingConfigurationInfo' {} Maybe Int
a -> ScalingConfigurationInfo
s {$sel:maxCapacity:ScalingConfigurationInfo' :: Maybe Int
maxCapacity = Maybe Int
a} :: ScalingConfigurationInfo)

-- | The minimum capacity for an Aurora DB cluster in @serverless@ DB engine
-- mode.
scalingConfigurationInfo_minCapacity :: Lens.Lens' ScalingConfigurationInfo (Prelude.Maybe Prelude.Int)
scalingConfigurationInfo_minCapacity :: Lens' ScalingConfigurationInfo (Maybe Int)
scalingConfigurationInfo_minCapacity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingConfigurationInfo' {Maybe Int
minCapacity :: Maybe Int
$sel:minCapacity:ScalingConfigurationInfo' :: ScalingConfigurationInfo -> Maybe Int
minCapacity} -> Maybe Int
minCapacity) (\s :: ScalingConfigurationInfo
s@ScalingConfigurationInfo' {} Maybe Int
a -> ScalingConfigurationInfo
s {$sel:minCapacity:ScalingConfigurationInfo' :: Maybe Int
minCapacity = Maybe Int
a} :: ScalingConfigurationInfo)

-- | The number of seconds before scaling times out. What happens when an
-- attempted scaling action times out is determined by the @TimeoutAction@
-- setting.
scalingConfigurationInfo_secondsBeforeTimeout :: Lens.Lens' ScalingConfigurationInfo (Prelude.Maybe Prelude.Int)
scalingConfigurationInfo_secondsBeforeTimeout :: Lens' ScalingConfigurationInfo (Maybe Int)
scalingConfigurationInfo_secondsBeforeTimeout = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingConfigurationInfo' {Maybe Int
secondsBeforeTimeout :: Maybe Int
$sel:secondsBeforeTimeout:ScalingConfigurationInfo' :: ScalingConfigurationInfo -> Maybe Int
secondsBeforeTimeout} -> Maybe Int
secondsBeforeTimeout) (\s :: ScalingConfigurationInfo
s@ScalingConfigurationInfo' {} Maybe Int
a -> ScalingConfigurationInfo
s {$sel:secondsBeforeTimeout:ScalingConfigurationInfo' :: Maybe Int
secondsBeforeTimeout = Maybe Int
a} :: ScalingConfigurationInfo)

-- | The remaining amount of time, in seconds, before the Aurora DB cluster
-- in @serverless@ mode is paused. A DB cluster can be paused only when
-- it\'s idle (it has no connections).
scalingConfigurationInfo_secondsUntilAutoPause :: Lens.Lens' ScalingConfigurationInfo (Prelude.Maybe Prelude.Int)
scalingConfigurationInfo_secondsUntilAutoPause :: Lens' ScalingConfigurationInfo (Maybe Int)
scalingConfigurationInfo_secondsUntilAutoPause = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingConfigurationInfo' {Maybe Int
secondsUntilAutoPause :: Maybe Int
$sel:secondsUntilAutoPause:ScalingConfigurationInfo' :: ScalingConfigurationInfo -> Maybe Int
secondsUntilAutoPause} -> Maybe Int
secondsUntilAutoPause) (\s :: ScalingConfigurationInfo
s@ScalingConfigurationInfo' {} Maybe Int
a -> ScalingConfigurationInfo
s {$sel:secondsUntilAutoPause:ScalingConfigurationInfo' :: Maybe Int
secondsUntilAutoPause = Maybe Int
a} :: ScalingConfigurationInfo)

-- | The action that occurs when Aurora times out while attempting to change
-- the capacity of an Aurora Serverless v1 cluster. The value is either
-- @ForceApplyCapacityChange@ or @RollbackCapacityChange@.
--
-- @ForceApplyCapacityChange@, the default, sets the capacity to the
-- specified value as soon as possible.
--
-- @RollbackCapacityChange@ ignores the capacity change if a scaling point
-- isn\'t found in the timeout period.
scalingConfigurationInfo_timeoutAction :: Lens.Lens' ScalingConfigurationInfo (Prelude.Maybe Prelude.Text)
scalingConfigurationInfo_timeoutAction :: Lens' ScalingConfigurationInfo (Maybe Text)
scalingConfigurationInfo_timeoutAction = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingConfigurationInfo' {Maybe Text
timeoutAction :: Maybe Text
$sel:timeoutAction:ScalingConfigurationInfo' :: ScalingConfigurationInfo -> Maybe Text
timeoutAction} -> Maybe Text
timeoutAction) (\s :: ScalingConfigurationInfo
s@ScalingConfigurationInfo' {} Maybe Text
a -> ScalingConfigurationInfo
s {$sel:timeoutAction:ScalingConfigurationInfo' :: Maybe Text
timeoutAction = Maybe Text
a} :: ScalingConfigurationInfo)

instance Data.FromXML ScalingConfigurationInfo where
  parseXML :: [Node] -> Either String ScalingConfigurationInfo
parseXML [Node]
x =
    Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> ScalingConfigurationInfo
ScalingConfigurationInfo'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"AutoPause")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"MaxCapacity")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"MinCapacity")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"SecondsBeforeTimeout")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"SecondsUntilAutoPause")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"TimeoutAction")

instance Prelude.Hashable ScalingConfigurationInfo where
  hashWithSalt :: Int -> ScalingConfigurationInfo -> Int
hashWithSalt Int
_salt ScalingConfigurationInfo' {Maybe Bool
Maybe Int
Maybe Text
timeoutAction :: Maybe Text
secondsUntilAutoPause :: Maybe Int
secondsBeforeTimeout :: Maybe Int
minCapacity :: Maybe Int
maxCapacity :: Maybe Int
autoPause :: Maybe Bool
$sel:timeoutAction:ScalingConfigurationInfo' :: ScalingConfigurationInfo -> Maybe Text
$sel:secondsUntilAutoPause:ScalingConfigurationInfo' :: ScalingConfigurationInfo -> Maybe Int
$sel:secondsBeforeTimeout:ScalingConfigurationInfo' :: ScalingConfigurationInfo -> Maybe Int
$sel:minCapacity:ScalingConfigurationInfo' :: ScalingConfigurationInfo -> Maybe Int
$sel:maxCapacity:ScalingConfigurationInfo' :: ScalingConfigurationInfo -> Maybe Int
$sel:autoPause:ScalingConfigurationInfo' :: ScalingConfigurationInfo -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
autoPause
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxCapacity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
minCapacity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
secondsBeforeTimeout
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
secondsUntilAutoPause
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
timeoutAction

instance Prelude.NFData ScalingConfigurationInfo where
  rnf :: ScalingConfigurationInfo -> ()
rnf ScalingConfigurationInfo' {Maybe Bool
Maybe Int
Maybe Text
timeoutAction :: Maybe Text
secondsUntilAutoPause :: Maybe Int
secondsBeforeTimeout :: Maybe Int
minCapacity :: Maybe Int
maxCapacity :: Maybe Int
autoPause :: Maybe Bool
$sel:timeoutAction:ScalingConfigurationInfo' :: ScalingConfigurationInfo -> Maybe Text
$sel:secondsUntilAutoPause:ScalingConfigurationInfo' :: ScalingConfigurationInfo -> Maybe Int
$sel:secondsBeforeTimeout:ScalingConfigurationInfo' :: ScalingConfigurationInfo -> Maybe Int
$sel:minCapacity:ScalingConfigurationInfo' :: ScalingConfigurationInfo -> Maybe Int
$sel:maxCapacity:ScalingConfigurationInfo' :: ScalingConfigurationInfo -> Maybe Int
$sel:autoPause:ScalingConfigurationInfo' :: ScalingConfigurationInfo -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
autoPause
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxCapacity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
minCapacity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
secondsBeforeTimeout
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
secondsUntilAutoPause
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
timeoutAction