{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.ModifyCurrentDBClusterCapacity
-- 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)
--
-- Set the capacity of an Aurora Serverless DB cluster to a specific value.
--
-- Aurora Serverless scales seamlessly based on the workload on the DB
-- cluster. In some cases, the capacity might not scale fast enough to meet
-- a sudden change in workload, such as a large number of new transactions.
-- Call @ModifyCurrentDBClusterCapacity@ to set the capacity explicitly.
--
-- After this call sets the DB cluster capacity, Aurora Serverless can
-- automatically scale the DB cluster based on the cooldown period for
-- scaling up and the cooldown period for scaling down.
--
-- For more information about Aurora Serverless, see
-- <https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.html Using Amazon Aurora Serverless>
-- in the /Amazon Aurora User Guide/.
--
-- If you call @ModifyCurrentDBClusterCapacity@ with the default
-- @TimeoutAction@, connections that prevent Aurora Serverless from finding
-- a scaling point might be dropped. For more information about scaling
-- points, see
-- <https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.how-it-works.html#aurora-serverless.how-it-works.auto-scaling Autoscaling for Aurora Serverless>
-- in the /Amazon Aurora User Guide/.
--
-- This action only applies to Aurora Serverless DB clusters.
module Amazonka.RDS.ModifyCurrentDBClusterCapacity
  ( -- * Creating a Request
    ModifyCurrentDBClusterCapacity (..),
    newModifyCurrentDBClusterCapacity,

    -- * Request Lenses
    modifyCurrentDBClusterCapacity_timeoutAction,
    modifyCurrentDBClusterCapacity_capacity,
    modifyCurrentDBClusterCapacity_secondsBeforeTimeout,
    modifyCurrentDBClusterCapacity_dbClusterIdentifier,

    -- * Destructuring the Response
    ModifyCurrentDBClusterCapacityResponse (..),
    newModifyCurrentDBClusterCapacityResponse,

    -- * Response Lenses
    modifyCurrentDBClusterCapacityResponse_dbClusterIdentifier,
    modifyCurrentDBClusterCapacityResponse_timeoutAction,
    modifyCurrentDBClusterCapacityResponse_currentCapacity,
    modifyCurrentDBClusterCapacityResponse_pendingCapacity,
    modifyCurrentDBClusterCapacityResponse_secondsBeforeTimeout,
    modifyCurrentDBClusterCapacityResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RDS.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newModifyCurrentDBClusterCapacity' smart constructor.
data ModifyCurrentDBClusterCapacity = ModifyCurrentDBClusterCapacity'
  { -- | The action to take when the timeout is reached, 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.
    ModifyCurrentDBClusterCapacity -> Maybe Text
timeoutAction :: Prelude.Maybe Prelude.Text,
    -- | The DB cluster capacity.
    --
    -- When you change the capacity of a paused Aurora Serverless DB cluster,
    -- it automatically resumes.
    --
    -- Constraints:
    --
    -- -   For Aurora MySQL, valid capacity values are @1@, @2@, @4@, @8@,
    --     @16@, @32@, @64@, @128@, and @256@.
    --
    -- -   For Aurora PostgreSQL, valid capacity values are @2@, @4@, @8@,
    --     @16@, @32@, @64@, @192@, and @384@.
    ModifyCurrentDBClusterCapacity -> Maybe Int
capacity :: Prelude.Maybe Prelude.Int,
    -- | The amount of time, in seconds, that Aurora Serverless tries to find a
    -- scaling point to perform seamless scaling before enforcing the timeout
    -- action. The default is 300.
    --
    -- Specify a value between 10 and 600 seconds.
    ModifyCurrentDBClusterCapacity -> Maybe Int
secondsBeforeTimeout :: Prelude.Maybe Prelude.Int,
    -- | The DB cluster identifier for the cluster being modified. This parameter
    -- isn\'t case-sensitive.
    --
    -- Constraints:
    --
    -- -   Must match the identifier of an existing DB cluster.
    ModifyCurrentDBClusterCapacity -> Text
dbClusterIdentifier :: Prelude.Text
  }
  deriving (ModifyCurrentDBClusterCapacity
-> ModifyCurrentDBClusterCapacity -> Bool
(ModifyCurrentDBClusterCapacity
 -> ModifyCurrentDBClusterCapacity -> Bool)
-> (ModifyCurrentDBClusterCapacity
    -> ModifyCurrentDBClusterCapacity -> Bool)
-> Eq ModifyCurrentDBClusterCapacity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyCurrentDBClusterCapacity
-> ModifyCurrentDBClusterCapacity -> Bool
$c/= :: ModifyCurrentDBClusterCapacity
-> ModifyCurrentDBClusterCapacity -> Bool
== :: ModifyCurrentDBClusterCapacity
-> ModifyCurrentDBClusterCapacity -> Bool
$c== :: ModifyCurrentDBClusterCapacity
-> ModifyCurrentDBClusterCapacity -> Bool
Prelude.Eq, ReadPrec [ModifyCurrentDBClusterCapacity]
ReadPrec ModifyCurrentDBClusterCapacity
Int -> ReadS ModifyCurrentDBClusterCapacity
ReadS [ModifyCurrentDBClusterCapacity]
(Int -> ReadS ModifyCurrentDBClusterCapacity)
-> ReadS [ModifyCurrentDBClusterCapacity]
-> ReadPrec ModifyCurrentDBClusterCapacity
-> ReadPrec [ModifyCurrentDBClusterCapacity]
-> Read ModifyCurrentDBClusterCapacity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyCurrentDBClusterCapacity]
$creadListPrec :: ReadPrec [ModifyCurrentDBClusterCapacity]
readPrec :: ReadPrec ModifyCurrentDBClusterCapacity
$creadPrec :: ReadPrec ModifyCurrentDBClusterCapacity
readList :: ReadS [ModifyCurrentDBClusterCapacity]
$creadList :: ReadS [ModifyCurrentDBClusterCapacity]
readsPrec :: Int -> ReadS ModifyCurrentDBClusterCapacity
$creadsPrec :: Int -> ReadS ModifyCurrentDBClusterCapacity
Prelude.Read, Int -> ModifyCurrentDBClusterCapacity -> ShowS
[ModifyCurrentDBClusterCapacity] -> ShowS
ModifyCurrentDBClusterCapacity -> String
(Int -> ModifyCurrentDBClusterCapacity -> ShowS)
-> (ModifyCurrentDBClusterCapacity -> String)
-> ([ModifyCurrentDBClusterCapacity] -> ShowS)
-> Show ModifyCurrentDBClusterCapacity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyCurrentDBClusterCapacity] -> ShowS
$cshowList :: [ModifyCurrentDBClusterCapacity] -> ShowS
show :: ModifyCurrentDBClusterCapacity -> String
$cshow :: ModifyCurrentDBClusterCapacity -> String
showsPrec :: Int -> ModifyCurrentDBClusterCapacity -> ShowS
$cshowsPrec :: Int -> ModifyCurrentDBClusterCapacity -> ShowS
Prelude.Show, (forall x.
 ModifyCurrentDBClusterCapacity
 -> Rep ModifyCurrentDBClusterCapacity x)
-> (forall x.
    Rep ModifyCurrentDBClusterCapacity x
    -> ModifyCurrentDBClusterCapacity)
-> Generic ModifyCurrentDBClusterCapacity
forall x.
Rep ModifyCurrentDBClusterCapacity x
-> ModifyCurrentDBClusterCapacity
forall x.
ModifyCurrentDBClusterCapacity
-> Rep ModifyCurrentDBClusterCapacity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ModifyCurrentDBClusterCapacity x
-> ModifyCurrentDBClusterCapacity
$cfrom :: forall x.
ModifyCurrentDBClusterCapacity
-> Rep ModifyCurrentDBClusterCapacity x
Prelude.Generic)

-- |
-- Create a value of 'ModifyCurrentDBClusterCapacity' 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:
--
-- 'timeoutAction', 'modifyCurrentDBClusterCapacity_timeoutAction' - The action to take when the timeout is reached, 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.
--
-- 'capacity', 'modifyCurrentDBClusterCapacity_capacity' - The DB cluster capacity.
--
-- When you change the capacity of a paused Aurora Serverless DB cluster,
-- it automatically resumes.
--
-- Constraints:
--
-- -   For Aurora MySQL, valid capacity values are @1@, @2@, @4@, @8@,
--     @16@, @32@, @64@, @128@, and @256@.
--
-- -   For Aurora PostgreSQL, valid capacity values are @2@, @4@, @8@,
--     @16@, @32@, @64@, @192@, and @384@.
--
-- 'secondsBeforeTimeout', 'modifyCurrentDBClusterCapacity_secondsBeforeTimeout' - The amount of time, in seconds, that Aurora Serverless tries to find a
-- scaling point to perform seamless scaling before enforcing the timeout
-- action. The default is 300.
--
-- Specify a value between 10 and 600 seconds.
--
-- 'dbClusterIdentifier', 'modifyCurrentDBClusterCapacity_dbClusterIdentifier' - The DB cluster identifier for the cluster being modified. This parameter
-- isn\'t case-sensitive.
--
-- Constraints:
--
-- -   Must match the identifier of an existing DB cluster.
newModifyCurrentDBClusterCapacity ::
  -- | 'dbClusterIdentifier'
  Prelude.Text ->
  ModifyCurrentDBClusterCapacity
newModifyCurrentDBClusterCapacity :: Text -> ModifyCurrentDBClusterCapacity
newModifyCurrentDBClusterCapacity
  Text
pDBClusterIdentifier_ =
    ModifyCurrentDBClusterCapacity' :: Maybe Text
-> Maybe Int -> Maybe Int -> Text -> ModifyCurrentDBClusterCapacity
ModifyCurrentDBClusterCapacity'
      { $sel:timeoutAction:ModifyCurrentDBClusterCapacity' :: Maybe Text
timeoutAction =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:capacity:ModifyCurrentDBClusterCapacity' :: Maybe Int
capacity = Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:secondsBeforeTimeout:ModifyCurrentDBClusterCapacity' :: Maybe Int
secondsBeforeTimeout = Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:dbClusterIdentifier:ModifyCurrentDBClusterCapacity' :: Text
dbClusterIdentifier = Text
pDBClusterIdentifier_
      }

-- | The action to take when the timeout is reached, 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.
modifyCurrentDBClusterCapacity_timeoutAction :: Lens.Lens' ModifyCurrentDBClusterCapacity (Prelude.Maybe Prelude.Text)
modifyCurrentDBClusterCapacity_timeoutAction :: (Maybe Text -> f (Maybe Text))
-> ModifyCurrentDBClusterCapacity
-> f ModifyCurrentDBClusterCapacity
modifyCurrentDBClusterCapacity_timeoutAction = (ModifyCurrentDBClusterCapacity -> Maybe Text)
-> (ModifyCurrentDBClusterCapacity
    -> Maybe Text -> ModifyCurrentDBClusterCapacity)
-> Lens
     ModifyCurrentDBClusterCapacity
     ModifyCurrentDBClusterCapacity
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyCurrentDBClusterCapacity' {Maybe Text
timeoutAction :: Maybe Text
$sel:timeoutAction:ModifyCurrentDBClusterCapacity' :: ModifyCurrentDBClusterCapacity -> Maybe Text
timeoutAction} -> Maybe Text
timeoutAction) (\s :: ModifyCurrentDBClusterCapacity
s@ModifyCurrentDBClusterCapacity' {} Maybe Text
a -> ModifyCurrentDBClusterCapacity
s {$sel:timeoutAction:ModifyCurrentDBClusterCapacity' :: Maybe Text
timeoutAction = Maybe Text
a} :: ModifyCurrentDBClusterCapacity)

-- | The DB cluster capacity.
--
-- When you change the capacity of a paused Aurora Serverless DB cluster,
-- it automatically resumes.
--
-- Constraints:
--
-- -   For Aurora MySQL, valid capacity values are @1@, @2@, @4@, @8@,
--     @16@, @32@, @64@, @128@, and @256@.
--
-- -   For Aurora PostgreSQL, valid capacity values are @2@, @4@, @8@,
--     @16@, @32@, @64@, @192@, and @384@.
modifyCurrentDBClusterCapacity_capacity :: Lens.Lens' ModifyCurrentDBClusterCapacity (Prelude.Maybe Prelude.Int)
modifyCurrentDBClusterCapacity_capacity :: (Maybe Int -> f (Maybe Int))
-> ModifyCurrentDBClusterCapacity
-> f ModifyCurrentDBClusterCapacity
modifyCurrentDBClusterCapacity_capacity = (ModifyCurrentDBClusterCapacity -> Maybe Int)
-> (ModifyCurrentDBClusterCapacity
    -> Maybe Int -> ModifyCurrentDBClusterCapacity)
-> Lens
     ModifyCurrentDBClusterCapacity
     ModifyCurrentDBClusterCapacity
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyCurrentDBClusterCapacity' {Maybe Int
capacity :: Maybe Int
$sel:capacity:ModifyCurrentDBClusterCapacity' :: ModifyCurrentDBClusterCapacity -> Maybe Int
capacity} -> Maybe Int
capacity) (\s :: ModifyCurrentDBClusterCapacity
s@ModifyCurrentDBClusterCapacity' {} Maybe Int
a -> ModifyCurrentDBClusterCapacity
s {$sel:capacity:ModifyCurrentDBClusterCapacity' :: Maybe Int
capacity = Maybe Int
a} :: ModifyCurrentDBClusterCapacity)

-- | The amount of time, in seconds, that Aurora Serverless tries to find a
-- scaling point to perform seamless scaling before enforcing the timeout
-- action. The default is 300.
--
-- Specify a value between 10 and 600 seconds.
modifyCurrentDBClusterCapacity_secondsBeforeTimeout :: Lens.Lens' ModifyCurrentDBClusterCapacity (Prelude.Maybe Prelude.Int)
modifyCurrentDBClusterCapacity_secondsBeforeTimeout :: (Maybe Int -> f (Maybe Int))
-> ModifyCurrentDBClusterCapacity
-> f ModifyCurrentDBClusterCapacity
modifyCurrentDBClusterCapacity_secondsBeforeTimeout = (ModifyCurrentDBClusterCapacity -> Maybe Int)
-> (ModifyCurrentDBClusterCapacity
    -> Maybe Int -> ModifyCurrentDBClusterCapacity)
-> Lens
     ModifyCurrentDBClusterCapacity
     ModifyCurrentDBClusterCapacity
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyCurrentDBClusterCapacity' {Maybe Int
secondsBeforeTimeout :: Maybe Int
$sel:secondsBeforeTimeout:ModifyCurrentDBClusterCapacity' :: ModifyCurrentDBClusterCapacity -> Maybe Int
secondsBeforeTimeout} -> Maybe Int
secondsBeforeTimeout) (\s :: ModifyCurrentDBClusterCapacity
s@ModifyCurrentDBClusterCapacity' {} Maybe Int
a -> ModifyCurrentDBClusterCapacity
s {$sel:secondsBeforeTimeout:ModifyCurrentDBClusterCapacity' :: Maybe Int
secondsBeforeTimeout = Maybe Int
a} :: ModifyCurrentDBClusterCapacity)

-- | The DB cluster identifier for the cluster being modified. This parameter
-- isn\'t case-sensitive.
--
-- Constraints:
--
-- -   Must match the identifier of an existing DB cluster.
modifyCurrentDBClusterCapacity_dbClusterIdentifier :: Lens.Lens' ModifyCurrentDBClusterCapacity Prelude.Text
modifyCurrentDBClusterCapacity_dbClusterIdentifier :: (Text -> f Text)
-> ModifyCurrentDBClusterCapacity
-> f ModifyCurrentDBClusterCapacity
modifyCurrentDBClusterCapacity_dbClusterIdentifier = (ModifyCurrentDBClusterCapacity -> Text)
-> (ModifyCurrentDBClusterCapacity
    -> Text -> ModifyCurrentDBClusterCapacity)
-> Lens
     ModifyCurrentDBClusterCapacity
     ModifyCurrentDBClusterCapacity
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyCurrentDBClusterCapacity' {Text
dbClusterIdentifier :: Text
$sel:dbClusterIdentifier:ModifyCurrentDBClusterCapacity' :: ModifyCurrentDBClusterCapacity -> Text
dbClusterIdentifier} -> Text
dbClusterIdentifier) (\s :: ModifyCurrentDBClusterCapacity
s@ModifyCurrentDBClusterCapacity' {} Text
a -> ModifyCurrentDBClusterCapacity
s {$sel:dbClusterIdentifier:ModifyCurrentDBClusterCapacity' :: Text
dbClusterIdentifier = Text
a} :: ModifyCurrentDBClusterCapacity)

instance
  Core.AWSRequest
    ModifyCurrentDBClusterCapacity
  where
  type
    AWSResponse ModifyCurrentDBClusterCapacity =
      ModifyCurrentDBClusterCapacityResponse
  request :: ModifyCurrentDBClusterCapacity
-> Request ModifyCurrentDBClusterCapacity
request = Service
-> ModifyCurrentDBClusterCapacity
-> Request ModifyCurrentDBClusterCapacity
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy ModifyCurrentDBClusterCapacity
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ModifyCurrentDBClusterCapacity)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse ModifyCurrentDBClusterCapacity))
-> Logger
-> Service
-> Proxy ModifyCurrentDBClusterCapacity
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ModifyCurrentDBClusterCapacity)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"ModifyCurrentDBClusterCapacityResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Int
-> ModifyCurrentDBClusterCapacityResponse
ModifyCurrentDBClusterCapacityResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> Int
 -> ModifyCurrentDBClusterCapacityResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Int
      -> ModifyCurrentDBClusterCapacityResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DBClusterIdentifier")
            Either
  String
  (Maybe Text
   -> Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Int
   -> ModifyCurrentDBClusterCapacityResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Int
      -> ModifyCurrentDBClusterCapacityResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"TimeoutAction")
            Either
  String
  (Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Int
   -> ModifyCurrentDBClusterCapacityResponse)
-> Either String (Maybe Int)
-> Either
     String
     (Maybe Int
      -> Maybe Int -> Int -> ModifyCurrentDBClusterCapacityResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"CurrentCapacity")
            Either
  String
  (Maybe Int
   -> Maybe Int -> Int -> ModifyCurrentDBClusterCapacityResponse)
-> Either String (Maybe Int)
-> Either
     String (Maybe Int -> Int -> ModifyCurrentDBClusterCapacityResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PendingCapacity")
            Either
  String (Maybe Int -> Int -> ModifyCurrentDBClusterCapacityResponse)
-> Either String (Maybe Int)
-> Either String (Int -> ModifyCurrentDBClusterCapacityResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SecondsBeforeTimeout")
            Either String (Int -> ModifyCurrentDBClusterCapacityResponse)
-> Either String Int
-> Either String ModifyCurrentDBClusterCapacityResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    ModifyCurrentDBClusterCapacity

instance
  Prelude.NFData
    ModifyCurrentDBClusterCapacity

instance
  Core.ToHeaders
    ModifyCurrentDBClusterCapacity
  where
  toHeaders :: ModifyCurrentDBClusterCapacity -> ResponseHeaders
toHeaders = ResponseHeaders
-> ModifyCurrentDBClusterCapacity -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath ModifyCurrentDBClusterCapacity where
  toPath :: ModifyCurrentDBClusterCapacity -> ByteString
toPath = ByteString -> ModifyCurrentDBClusterCapacity -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery ModifyCurrentDBClusterCapacity where
  toQuery :: ModifyCurrentDBClusterCapacity -> QueryString
toQuery ModifyCurrentDBClusterCapacity' {Maybe Int
Maybe Text
Text
dbClusterIdentifier :: Text
secondsBeforeTimeout :: Maybe Int
capacity :: Maybe Int
timeoutAction :: Maybe Text
$sel:dbClusterIdentifier:ModifyCurrentDBClusterCapacity' :: ModifyCurrentDBClusterCapacity -> Text
$sel:secondsBeforeTimeout:ModifyCurrentDBClusterCapacity' :: ModifyCurrentDBClusterCapacity -> Maybe Int
$sel:capacity:ModifyCurrentDBClusterCapacity' :: ModifyCurrentDBClusterCapacity -> Maybe Int
$sel:timeoutAction:ModifyCurrentDBClusterCapacity' :: ModifyCurrentDBClusterCapacity -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ( ByteString
"ModifyCurrentDBClusterCapacity" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"TimeoutAction" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
timeoutAction,
        ByteString
"Capacity" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
capacity,
        ByteString
"SecondsBeforeTimeout" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
secondsBeforeTimeout,
        ByteString
"DBClusterIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbClusterIdentifier
      ]

-- | /See:/ 'newModifyCurrentDBClusterCapacityResponse' smart constructor.
data ModifyCurrentDBClusterCapacityResponse = ModifyCurrentDBClusterCapacityResponse'
  { -- | A user-supplied DB cluster identifier. This identifier is the unique key
    -- that identifies a DB cluster.
    ModifyCurrentDBClusterCapacityResponse -> Maybe Text
dbClusterIdentifier :: Prelude.Maybe Prelude.Text,
    -- | The timeout action of a call to @ModifyCurrentDBClusterCapacity@, either
    -- @ForceApplyCapacityChange@ or @RollbackCapacityChange@.
    ModifyCurrentDBClusterCapacityResponse -> Maybe Text
timeoutAction :: Prelude.Maybe Prelude.Text,
    -- | The current capacity of the DB cluster.
    ModifyCurrentDBClusterCapacityResponse -> Maybe Int
currentCapacity :: Prelude.Maybe Prelude.Int,
    -- | A value that specifies the capacity that the DB cluster scales to next.
    ModifyCurrentDBClusterCapacityResponse -> Maybe Int
pendingCapacity :: Prelude.Maybe Prelude.Int,
    -- | The number of seconds before a call to @ModifyCurrentDBClusterCapacity@
    -- times out.
    ModifyCurrentDBClusterCapacityResponse -> Maybe Int
secondsBeforeTimeout :: Prelude.Maybe Prelude.Int,
    -- | The response's http status code.
    ModifyCurrentDBClusterCapacityResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ModifyCurrentDBClusterCapacityResponse
-> ModifyCurrentDBClusterCapacityResponse -> Bool
(ModifyCurrentDBClusterCapacityResponse
 -> ModifyCurrentDBClusterCapacityResponse -> Bool)
-> (ModifyCurrentDBClusterCapacityResponse
    -> ModifyCurrentDBClusterCapacityResponse -> Bool)
-> Eq ModifyCurrentDBClusterCapacityResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyCurrentDBClusterCapacityResponse
-> ModifyCurrentDBClusterCapacityResponse -> Bool
$c/= :: ModifyCurrentDBClusterCapacityResponse
-> ModifyCurrentDBClusterCapacityResponse -> Bool
== :: ModifyCurrentDBClusterCapacityResponse
-> ModifyCurrentDBClusterCapacityResponse -> Bool
$c== :: ModifyCurrentDBClusterCapacityResponse
-> ModifyCurrentDBClusterCapacityResponse -> Bool
Prelude.Eq, ReadPrec [ModifyCurrentDBClusterCapacityResponse]
ReadPrec ModifyCurrentDBClusterCapacityResponse
Int -> ReadS ModifyCurrentDBClusterCapacityResponse
ReadS [ModifyCurrentDBClusterCapacityResponse]
(Int -> ReadS ModifyCurrentDBClusterCapacityResponse)
-> ReadS [ModifyCurrentDBClusterCapacityResponse]
-> ReadPrec ModifyCurrentDBClusterCapacityResponse
-> ReadPrec [ModifyCurrentDBClusterCapacityResponse]
-> Read ModifyCurrentDBClusterCapacityResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyCurrentDBClusterCapacityResponse]
$creadListPrec :: ReadPrec [ModifyCurrentDBClusterCapacityResponse]
readPrec :: ReadPrec ModifyCurrentDBClusterCapacityResponse
$creadPrec :: ReadPrec ModifyCurrentDBClusterCapacityResponse
readList :: ReadS [ModifyCurrentDBClusterCapacityResponse]
$creadList :: ReadS [ModifyCurrentDBClusterCapacityResponse]
readsPrec :: Int -> ReadS ModifyCurrentDBClusterCapacityResponse
$creadsPrec :: Int -> ReadS ModifyCurrentDBClusterCapacityResponse
Prelude.Read, Int -> ModifyCurrentDBClusterCapacityResponse -> ShowS
[ModifyCurrentDBClusterCapacityResponse] -> ShowS
ModifyCurrentDBClusterCapacityResponse -> String
(Int -> ModifyCurrentDBClusterCapacityResponse -> ShowS)
-> (ModifyCurrentDBClusterCapacityResponse -> String)
-> ([ModifyCurrentDBClusterCapacityResponse] -> ShowS)
-> Show ModifyCurrentDBClusterCapacityResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyCurrentDBClusterCapacityResponse] -> ShowS
$cshowList :: [ModifyCurrentDBClusterCapacityResponse] -> ShowS
show :: ModifyCurrentDBClusterCapacityResponse -> String
$cshow :: ModifyCurrentDBClusterCapacityResponse -> String
showsPrec :: Int -> ModifyCurrentDBClusterCapacityResponse -> ShowS
$cshowsPrec :: Int -> ModifyCurrentDBClusterCapacityResponse -> ShowS
Prelude.Show, (forall x.
 ModifyCurrentDBClusterCapacityResponse
 -> Rep ModifyCurrentDBClusterCapacityResponse x)
-> (forall x.
    Rep ModifyCurrentDBClusterCapacityResponse x
    -> ModifyCurrentDBClusterCapacityResponse)
-> Generic ModifyCurrentDBClusterCapacityResponse
forall x.
Rep ModifyCurrentDBClusterCapacityResponse x
-> ModifyCurrentDBClusterCapacityResponse
forall x.
ModifyCurrentDBClusterCapacityResponse
-> Rep ModifyCurrentDBClusterCapacityResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ModifyCurrentDBClusterCapacityResponse x
-> ModifyCurrentDBClusterCapacityResponse
$cfrom :: forall x.
ModifyCurrentDBClusterCapacityResponse
-> Rep ModifyCurrentDBClusterCapacityResponse x
Prelude.Generic)

-- |
-- Create a value of 'ModifyCurrentDBClusterCapacityResponse' 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:
--
-- 'dbClusterIdentifier', 'modifyCurrentDBClusterCapacityResponse_dbClusterIdentifier' - A user-supplied DB cluster identifier. This identifier is the unique key
-- that identifies a DB cluster.
--
-- 'timeoutAction', 'modifyCurrentDBClusterCapacityResponse_timeoutAction' - The timeout action of a call to @ModifyCurrentDBClusterCapacity@, either
-- @ForceApplyCapacityChange@ or @RollbackCapacityChange@.
--
-- 'currentCapacity', 'modifyCurrentDBClusterCapacityResponse_currentCapacity' - The current capacity of the DB cluster.
--
-- 'pendingCapacity', 'modifyCurrentDBClusterCapacityResponse_pendingCapacity' - A value that specifies the capacity that the DB cluster scales to next.
--
-- 'secondsBeforeTimeout', 'modifyCurrentDBClusterCapacityResponse_secondsBeforeTimeout' - The number of seconds before a call to @ModifyCurrentDBClusterCapacity@
-- times out.
--
-- 'httpStatus', 'modifyCurrentDBClusterCapacityResponse_httpStatus' - The response's http status code.
newModifyCurrentDBClusterCapacityResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ModifyCurrentDBClusterCapacityResponse
newModifyCurrentDBClusterCapacityResponse :: Int -> ModifyCurrentDBClusterCapacityResponse
newModifyCurrentDBClusterCapacityResponse
  Int
pHttpStatus_ =
    ModifyCurrentDBClusterCapacityResponse' :: Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Int
-> ModifyCurrentDBClusterCapacityResponse
ModifyCurrentDBClusterCapacityResponse'
      { $sel:dbClusterIdentifier:ModifyCurrentDBClusterCapacityResponse' :: Maybe Text
dbClusterIdentifier =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:timeoutAction:ModifyCurrentDBClusterCapacityResponse' :: Maybe Text
timeoutAction = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:currentCapacity:ModifyCurrentDBClusterCapacityResponse' :: Maybe Int
currentCapacity = Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:pendingCapacity:ModifyCurrentDBClusterCapacityResponse' :: Maybe Int
pendingCapacity = Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:secondsBeforeTimeout:ModifyCurrentDBClusterCapacityResponse' :: Maybe Int
secondsBeforeTimeout =
          Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ModifyCurrentDBClusterCapacityResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | A user-supplied DB cluster identifier. This identifier is the unique key
-- that identifies a DB cluster.
modifyCurrentDBClusterCapacityResponse_dbClusterIdentifier :: Lens.Lens' ModifyCurrentDBClusterCapacityResponse (Prelude.Maybe Prelude.Text)
modifyCurrentDBClusterCapacityResponse_dbClusterIdentifier :: (Maybe Text -> f (Maybe Text))
-> ModifyCurrentDBClusterCapacityResponse
-> f ModifyCurrentDBClusterCapacityResponse
modifyCurrentDBClusterCapacityResponse_dbClusterIdentifier = (ModifyCurrentDBClusterCapacityResponse -> Maybe Text)
-> (ModifyCurrentDBClusterCapacityResponse
    -> Maybe Text -> ModifyCurrentDBClusterCapacityResponse)
-> Lens
     ModifyCurrentDBClusterCapacityResponse
     ModifyCurrentDBClusterCapacityResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyCurrentDBClusterCapacityResponse' {Maybe Text
dbClusterIdentifier :: Maybe Text
$sel:dbClusterIdentifier:ModifyCurrentDBClusterCapacityResponse' :: ModifyCurrentDBClusterCapacityResponse -> Maybe Text
dbClusterIdentifier} -> Maybe Text
dbClusterIdentifier) (\s :: ModifyCurrentDBClusterCapacityResponse
s@ModifyCurrentDBClusterCapacityResponse' {} Maybe Text
a -> ModifyCurrentDBClusterCapacityResponse
s {$sel:dbClusterIdentifier:ModifyCurrentDBClusterCapacityResponse' :: Maybe Text
dbClusterIdentifier = Maybe Text
a} :: ModifyCurrentDBClusterCapacityResponse)

-- | The timeout action of a call to @ModifyCurrentDBClusterCapacity@, either
-- @ForceApplyCapacityChange@ or @RollbackCapacityChange@.
modifyCurrentDBClusterCapacityResponse_timeoutAction :: Lens.Lens' ModifyCurrentDBClusterCapacityResponse (Prelude.Maybe Prelude.Text)
modifyCurrentDBClusterCapacityResponse_timeoutAction :: (Maybe Text -> f (Maybe Text))
-> ModifyCurrentDBClusterCapacityResponse
-> f ModifyCurrentDBClusterCapacityResponse
modifyCurrentDBClusterCapacityResponse_timeoutAction = (ModifyCurrentDBClusterCapacityResponse -> Maybe Text)
-> (ModifyCurrentDBClusterCapacityResponse
    -> Maybe Text -> ModifyCurrentDBClusterCapacityResponse)
-> Lens
     ModifyCurrentDBClusterCapacityResponse
     ModifyCurrentDBClusterCapacityResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyCurrentDBClusterCapacityResponse' {Maybe Text
timeoutAction :: Maybe Text
$sel:timeoutAction:ModifyCurrentDBClusterCapacityResponse' :: ModifyCurrentDBClusterCapacityResponse -> Maybe Text
timeoutAction} -> Maybe Text
timeoutAction) (\s :: ModifyCurrentDBClusterCapacityResponse
s@ModifyCurrentDBClusterCapacityResponse' {} Maybe Text
a -> ModifyCurrentDBClusterCapacityResponse
s {$sel:timeoutAction:ModifyCurrentDBClusterCapacityResponse' :: Maybe Text
timeoutAction = Maybe Text
a} :: ModifyCurrentDBClusterCapacityResponse)

-- | The current capacity of the DB cluster.
modifyCurrentDBClusterCapacityResponse_currentCapacity :: Lens.Lens' ModifyCurrentDBClusterCapacityResponse (Prelude.Maybe Prelude.Int)
modifyCurrentDBClusterCapacityResponse_currentCapacity :: (Maybe Int -> f (Maybe Int))
-> ModifyCurrentDBClusterCapacityResponse
-> f ModifyCurrentDBClusterCapacityResponse
modifyCurrentDBClusterCapacityResponse_currentCapacity = (ModifyCurrentDBClusterCapacityResponse -> Maybe Int)
-> (ModifyCurrentDBClusterCapacityResponse
    -> Maybe Int -> ModifyCurrentDBClusterCapacityResponse)
-> Lens
     ModifyCurrentDBClusterCapacityResponse
     ModifyCurrentDBClusterCapacityResponse
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyCurrentDBClusterCapacityResponse' {Maybe Int
currentCapacity :: Maybe Int
$sel:currentCapacity:ModifyCurrentDBClusterCapacityResponse' :: ModifyCurrentDBClusterCapacityResponse -> Maybe Int
currentCapacity} -> Maybe Int
currentCapacity) (\s :: ModifyCurrentDBClusterCapacityResponse
s@ModifyCurrentDBClusterCapacityResponse' {} Maybe Int
a -> ModifyCurrentDBClusterCapacityResponse
s {$sel:currentCapacity:ModifyCurrentDBClusterCapacityResponse' :: Maybe Int
currentCapacity = Maybe Int
a} :: ModifyCurrentDBClusterCapacityResponse)

-- | A value that specifies the capacity that the DB cluster scales to next.
modifyCurrentDBClusterCapacityResponse_pendingCapacity :: Lens.Lens' ModifyCurrentDBClusterCapacityResponse (Prelude.Maybe Prelude.Int)
modifyCurrentDBClusterCapacityResponse_pendingCapacity :: (Maybe Int -> f (Maybe Int))
-> ModifyCurrentDBClusterCapacityResponse
-> f ModifyCurrentDBClusterCapacityResponse
modifyCurrentDBClusterCapacityResponse_pendingCapacity = (ModifyCurrentDBClusterCapacityResponse -> Maybe Int)
-> (ModifyCurrentDBClusterCapacityResponse
    -> Maybe Int -> ModifyCurrentDBClusterCapacityResponse)
-> Lens
     ModifyCurrentDBClusterCapacityResponse
     ModifyCurrentDBClusterCapacityResponse
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyCurrentDBClusterCapacityResponse' {Maybe Int
pendingCapacity :: Maybe Int
$sel:pendingCapacity:ModifyCurrentDBClusterCapacityResponse' :: ModifyCurrentDBClusterCapacityResponse -> Maybe Int
pendingCapacity} -> Maybe Int
pendingCapacity) (\s :: ModifyCurrentDBClusterCapacityResponse
s@ModifyCurrentDBClusterCapacityResponse' {} Maybe Int
a -> ModifyCurrentDBClusterCapacityResponse
s {$sel:pendingCapacity:ModifyCurrentDBClusterCapacityResponse' :: Maybe Int
pendingCapacity = Maybe Int
a} :: ModifyCurrentDBClusterCapacityResponse)

-- | The number of seconds before a call to @ModifyCurrentDBClusterCapacity@
-- times out.
modifyCurrentDBClusterCapacityResponse_secondsBeforeTimeout :: Lens.Lens' ModifyCurrentDBClusterCapacityResponse (Prelude.Maybe Prelude.Int)
modifyCurrentDBClusterCapacityResponse_secondsBeforeTimeout :: (Maybe Int -> f (Maybe Int))
-> ModifyCurrentDBClusterCapacityResponse
-> f ModifyCurrentDBClusterCapacityResponse
modifyCurrentDBClusterCapacityResponse_secondsBeforeTimeout = (ModifyCurrentDBClusterCapacityResponse -> Maybe Int)
-> (ModifyCurrentDBClusterCapacityResponse
    -> Maybe Int -> ModifyCurrentDBClusterCapacityResponse)
-> Lens
     ModifyCurrentDBClusterCapacityResponse
     ModifyCurrentDBClusterCapacityResponse
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyCurrentDBClusterCapacityResponse' {Maybe Int
secondsBeforeTimeout :: Maybe Int
$sel:secondsBeforeTimeout:ModifyCurrentDBClusterCapacityResponse' :: ModifyCurrentDBClusterCapacityResponse -> Maybe Int
secondsBeforeTimeout} -> Maybe Int
secondsBeforeTimeout) (\s :: ModifyCurrentDBClusterCapacityResponse
s@ModifyCurrentDBClusterCapacityResponse' {} Maybe Int
a -> ModifyCurrentDBClusterCapacityResponse
s {$sel:secondsBeforeTimeout:ModifyCurrentDBClusterCapacityResponse' :: Maybe Int
secondsBeforeTimeout = Maybe Int
a} :: ModifyCurrentDBClusterCapacityResponse)

-- | The response's http status code.
modifyCurrentDBClusterCapacityResponse_httpStatus :: Lens.Lens' ModifyCurrentDBClusterCapacityResponse Prelude.Int
modifyCurrentDBClusterCapacityResponse_httpStatus :: (Int -> f Int)
-> ModifyCurrentDBClusterCapacityResponse
-> f ModifyCurrentDBClusterCapacityResponse
modifyCurrentDBClusterCapacityResponse_httpStatus = (ModifyCurrentDBClusterCapacityResponse -> Int)
-> (ModifyCurrentDBClusterCapacityResponse
    -> Int -> ModifyCurrentDBClusterCapacityResponse)
-> Lens
     ModifyCurrentDBClusterCapacityResponse
     ModifyCurrentDBClusterCapacityResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyCurrentDBClusterCapacityResponse' {Int
httpStatus :: Int
$sel:httpStatus:ModifyCurrentDBClusterCapacityResponse' :: ModifyCurrentDBClusterCapacityResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ModifyCurrentDBClusterCapacityResponse
s@ModifyCurrentDBClusterCapacityResponse' {} Int
a -> ModifyCurrentDBClusterCapacityResponse
s {$sel:httpStatus:ModifyCurrentDBClusterCapacityResponse' :: Int
httpStatus = Int
a} :: ModifyCurrentDBClusterCapacityResponse)

instance
  Prelude.NFData
    ModifyCurrentDBClusterCapacityResponse