{-# 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.DocumentDB.ModifyDBInstance
-- 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)
--
-- Modifies settings for an instance. You can change one or more database
-- configuration parameters by specifying these parameters and the new
-- values in the request.
module Amazonka.DocumentDB.ModifyDBInstance
  ( -- * Creating a Request
    ModifyDBInstance (..),
    newModifyDBInstance,

    -- * Request Lenses
    modifyDBInstance_autoMinorVersionUpgrade,
    modifyDBInstance_newDBInstanceIdentifier,
    modifyDBInstance_dbInstanceClass,
    modifyDBInstance_promotionTier,
    modifyDBInstance_preferredMaintenanceWindow,
    modifyDBInstance_cACertificateIdentifier,
    modifyDBInstance_applyImmediately,
    modifyDBInstance_dbInstanceIdentifier,

    -- * Destructuring the Response
    ModifyDBInstanceResponse (..),
    newModifyDBInstanceResponse,

    -- * Response Lenses
    modifyDBInstanceResponse_dbInstance,
    modifyDBInstanceResponse_httpStatus,
  )
where

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

-- | Represents the input to ModifyDBInstance.
--
-- /See:/ 'newModifyDBInstance' smart constructor.
data ModifyDBInstance = ModifyDBInstance'
  { -- | This parameter does not apply to Amazon DocumentDB. Amazon DocumentDB
    -- does not perform minor version upgrades regardless of the value set.
    ModifyDBInstance -> Maybe Bool
autoMinorVersionUpgrade :: Prelude.Maybe Prelude.Bool,
    -- | The new instance identifier for the instance when renaming an instance.
    -- When you change the instance identifier, an instance reboot occurs
    -- immediately if you set @Apply Immediately@ to @true@. It occurs during
    -- the next maintenance window if you set @Apply Immediately@ to @false@.
    -- This value is stored as a lowercase string.
    --
    -- Constraints:
    --
    -- -   Must contain from 1 to 63 letters, numbers, or hyphens.
    --
    -- -   The first character must be a letter.
    --
    -- -   Cannot end with a hyphen or contain two consecutive hyphens.
    --
    -- Example: @mydbinstance@
    ModifyDBInstance -> Maybe Text
newDBInstanceIdentifier' :: Prelude.Maybe Prelude.Text,
    -- | The new compute and memory capacity of the instance; for example,
    -- @db.r5.large@. Not all instance classes are available in all Regions.
    --
    -- If you modify the instance class, an outage occurs during the change.
    -- The change is applied during the next maintenance window, unless
    -- @ApplyImmediately@ is specified as @true@ for this request.
    --
    -- Default: Uses existing setting.
    ModifyDBInstance -> Maybe Text
dbInstanceClass :: Prelude.Maybe Prelude.Text,
    -- | A value that specifies the order in which an Amazon DocumentDB replica
    -- is promoted to the primary instance after a failure of the existing
    -- primary instance.
    --
    -- Default: 1
    --
    -- Valid values: 0-15
    ModifyDBInstance -> Maybe Int
promotionTier :: Prelude.Maybe Prelude.Int,
    -- | The weekly time range (in UTC) during which system maintenance can
    -- occur, which might result in an outage. Changing this parameter doesn\'t
    -- result in an outage except in the following situation, and the change is
    -- asynchronously applied as soon as possible. If there are pending actions
    -- that cause a reboot, and the maintenance window is changed to include
    -- the current time, changing this parameter causes a reboot of the
    -- instance. If you are moving this window to the current time, there must
    -- be at least 30 minutes between the current time and end of the window to
    -- ensure that pending changes are applied.
    --
    -- Default: Uses existing setting.
    --
    -- Format: @ddd:hh24:mi-ddd:hh24:mi@
    --
    -- Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun
    --
    -- Constraints: Must be at least 30 minutes.
    ModifyDBInstance -> Maybe Text
preferredMaintenanceWindow :: Prelude.Maybe Prelude.Text,
    -- | Indicates the certificate that needs to be associated with the instance.
    ModifyDBInstance -> Maybe Text
cACertificateIdentifier :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether the modifications in this request and any pending
    -- modifications are asynchronously applied as soon as possible, regardless
    -- of the @PreferredMaintenanceWindow@ setting for the instance.
    --
    -- If this parameter is set to @false@, changes to the instance are applied
    -- during the next maintenance window. Some parameter changes can cause an
    -- outage and are applied on the next reboot.
    --
    -- Default: @false@
    ModifyDBInstance -> Maybe Bool
applyImmediately :: Prelude.Maybe Prelude.Bool,
    -- | The instance identifier. This value is stored as a lowercase string.
    --
    -- Constraints:
    --
    -- -   Must match the identifier of an existing @DBInstance@.
    ModifyDBInstance -> Text
dbInstanceIdentifier :: Prelude.Text
  }
  deriving (ModifyDBInstance -> ModifyDBInstance -> Bool
(ModifyDBInstance -> ModifyDBInstance -> Bool)
-> (ModifyDBInstance -> ModifyDBInstance -> Bool)
-> Eq ModifyDBInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyDBInstance -> ModifyDBInstance -> Bool
$c/= :: ModifyDBInstance -> ModifyDBInstance -> Bool
== :: ModifyDBInstance -> ModifyDBInstance -> Bool
$c== :: ModifyDBInstance -> ModifyDBInstance -> Bool
Prelude.Eq, ReadPrec [ModifyDBInstance]
ReadPrec ModifyDBInstance
Int -> ReadS ModifyDBInstance
ReadS [ModifyDBInstance]
(Int -> ReadS ModifyDBInstance)
-> ReadS [ModifyDBInstance]
-> ReadPrec ModifyDBInstance
-> ReadPrec [ModifyDBInstance]
-> Read ModifyDBInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyDBInstance]
$creadListPrec :: ReadPrec [ModifyDBInstance]
readPrec :: ReadPrec ModifyDBInstance
$creadPrec :: ReadPrec ModifyDBInstance
readList :: ReadS [ModifyDBInstance]
$creadList :: ReadS [ModifyDBInstance]
readsPrec :: Int -> ReadS ModifyDBInstance
$creadsPrec :: Int -> ReadS ModifyDBInstance
Prelude.Read, Int -> ModifyDBInstance -> ShowS
[ModifyDBInstance] -> ShowS
ModifyDBInstance -> String
(Int -> ModifyDBInstance -> ShowS)
-> (ModifyDBInstance -> String)
-> ([ModifyDBInstance] -> ShowS)
-> Show ModifyDBInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyDBInstance] -> ShowS
$cshowList :: [ModifyDBInstance] -> ShowS
show :: ModifyDBInstance -> String
$cshow :: ModifyDBInstance -> String
showsPrec :: Int -> ModifyDBInstance -> ShowS
$cshowsPrec :: Int -> ModifyDBInstance -> ShowS
Prelude.Show, (forall x. ModifyDBInstance -> Rep ModifyDBInstance x)
-> (forall x. Rep ModifyDBInstance x -> ModifyDBInstance)
-> Generic ModifyDBInstance
forall x. Rep ModifyDBInstance x -> ModifyDBInstance
forall x. ModifyDBInstance -> Rep ModifyDBInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModifyDBInstance x -> ModifyDBInstance
$cfrom :: forall x. ModifyDBInstance -> Rep ModifyDBInstance x
Prelude.Generic)

-- |
-- Create a value of 'ModifyDBInstance' 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:
--
-- 'autoMinorVersionUpgrade', 'modifyDBInstance_autoMinorVersionUpgrade' - This parameter does not apply to Amazon DocumentDB. Amazon DocumentDB
-- does not perform minor version upgrades regardless of the value set.
--
-- 'newDBInstanceIdentifier'', 'modifyDBInstance_newDBInstanceIdentifier' - The new instance identifier for the instance when renaming an instance.
-- When you change the instance identifier, an instance reboot occurs
-- immediately if you set @Apply Immediately@ to @true@. It occurs during
-- the next maintenance window if you set @Apply Immediately@ to @false@.
-- This value is stored as a lowercase string.
--
-- Constraints:
--
-- -   Must contain from 1 to 63 letters, numbers, or hyphens.
--
-- -   The first character must be a letter.
--
-- -   Cannot end with a hyphen or contain two consecutive hyphens.
--
-- Example: @mydbinstance@
--
-- 'dbInstanceClass', 'modifyDBInstance_dbInstanceClass' - The new compute and memory capacity of the instance; for example,
-- @db.r5.large@. Not all instance classes are available in all Regions.
--
-- If you modify the instance class, an outage occurs during the change.
-- The change is applied during the next maintenance window, unless
-- @ApplyImmediately@ is specified as @true@ for this request.
--
-- Default: Uses existing setting.
--
-- 'promotionTier', 'modifyDBInstance_promotionTier' - A value that specifies the order in which an Amazon DocumentDB replica
-- is promoted to the primary instance after a failure of the existing
-- primary instance.
--
-- Default: 1
--
-- Valid values: 0-15
--
-- 'preferredMaintenanceWindow', 'modifyDBInstance_preferredMaintenanceWindow' - The weekly time range (in UTC) during which system maintenance can
-- occur, which might result in an outage. Changing this parameter doesn\'t
-- result in an outage except in the following situation, and the change is
-- asynchronously applied as soon as possible. If there are pending actions
-- that cause a reboot, and the maintenance window is changed to include
-- the current time, changing this parameter causes a reboot of the
-- instance. If you are moving this window to the current time, there must
-- be at least 30 minutes between the current time and end of the window to
-- ensure that pending changes are applied.
--
-- Default: Uses existing setting.
--
-- Format: @ddd:hh24:mi-ddd:hh24:mi@
--
-- Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun
--
-- Constraints: Must be at least 30 minutes.
--
-- 'cACertificateIdentifier', 'modifyDBInstance_cACertificateIdentifier' - Indicates the certificate that needs to be associated with the instance.
--
-- 'applyImmediately', 'modifyDBInstance_applyImmediately' - Specifies whether the modifications in this request and any pending
-- modifications are asynchronously applied as soon as possible, regardless
-- of the @PreferredMaintenanceWindow@ setting for the instance.
--
-- If this parameter is set to @false@, changes to the instance are applied
-- during the next maintenance window. Some parameter changes can cause an
-- outage and are applied on the next reboot.
--
-- Default: @false@
--
-- 'dbInstanceIdentifier', 'modifyDBInstance_dbInstanceIdentifier' - The instance identifier. This value is stored as a lowercase string.
--
-- Constraints:
--
-- -   Must match the identifier of an existing @DBInstance@.
newModifyDBInstance ::
  -- | 'dbInstanceIdentifier'
  Prelude.Text ->
  ModifyDBInstance
newModifyDBInstance :: Text -> ModifyDBInstance
newModifyDBInstance Text
pDBInstanceIdentifier_ =
  ModifyDBInstance' :: Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Text
-> ModifyDBInstance
ModifyDBInstance'
    { $sel:autoMinorVersionUpgrade:ModifyDBInstance' :: Maybe Bool
autoMinorVersionUpgrade =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:newDBInstanceIdentifier':ModifyDBInstance' :: Maybe Text
newDBInstanceIdentifier' = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dbInstanceClass:ModifyDBInstance' :: Maybe Text
dbInstanceClass = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:promotionTier:ModifyDBInstance' :: Maybe Int
promotionTier = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:preferredMaintenanceWindow:ModifyDBInstance' :: Maybe Text
preferredMaintenanceWindow = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cACertificateIdentifier:ModifyDBInstance' :: Maybe Text
cACertificateIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:applyImmediately:ModifyDBInstance' :: Maybe Bool
applyImmediately = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:dbInstanceIdentifier:ModifyDBInstance' :: Text
dbInstanceIdentifier = Text
pDBInstanceIdentifier_
    }

-- | This parameter does not apply to Amazon DocumentDB. Amazon DocumentDB
-- does not perform minor version upgrades regardless of the value set.
modifyDBInstance_autoMinorVersionUpgrade :: Lens.Lens' ModifyDBInstance (Prelude.Maybe Prelude.Bool)
modifyDBInstance_autoMinorVersionUpgrade :: (Maybe Bool -> f (Maybe Bool))
-> ModifyDBInstance -> f ModifyDBInstance
modifyDBInstance_autoMinorVersionUpgrade = (ModifyDBInstance -> Maybe Bool)
-> (ModifyDBInstance -> Maybe Bool -> ModifyDBInstance)
-> Lens ModifyDBInstance ModifyDBInstance (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyDBInstance' {Maybe Bool
autoMinorVersionUpgrade :: Maybe Bool
$sel:autoMinorVersionUpgrade:ModifyDBInstance' :: ModifyDBInstance -> Maybe Bool
autoMinorVersionUpgrade} -> Maybe Bool
autoMinorVersionUpgrade) (\s :: ModifyDBInstance
s@ModifyDBInstance' {} Maybe Bool
a -> ModifyDBInstance
s {$sel:autoMinorVersionUpgrade:ModifyDBInstance' :: Maybe Bool
autoMinorVersionUpgrade = Maybe Bool
a} :: ModifyDBInstance)

-- | The new instance identifier for the instance when renaming an instance.
-- When you change the instance identifier, an instance reboot occurs
-- immediately if you set @Apply Immediately@ to @true@. It occurs during
-- the next maintenance window if you set @Apply Immediately@ to @false@.
-- This value is stored as a lowercase string.
--
-- Constraints:
--
-- -   Must contain from 1 to 63 letters, numbers, or hyphens.
--
-- -   The first character must be a letter.
--
-- -   Cannot end with a hyphen or contain two consecutive hyphens.
--
-- Example: @mydbinstance@
modifyDBInstance_newDBInstanceIdentifier :: Lens.Lens' ModifyDBInstance (Prelude.Maybe Prelude.Text)
modifyDBInstance_newDBInstanceIdentifier :: (Maybe Text -> f (Maybe Text))
-> ModifyDBInstance -> f ModifyDBInstance
modifyDBInstance_newDBInstanceIdentifier = (ModifyDBInstance -> Maybe Text)
-> (ModifyDBInstance -> Maybe Text -> ModifyDBInstance)
-> Lens ModifyDBInstance ModifyDBInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyDBInstance' {Maybe Text
newDBInstanceIdentifier' :: Maybe Text
$sel:newDBInstanceIdentifier':ModifyDBInstance' :: ModifyDBInstance -> Maybe Text
newDBInstanceIdentifier'} -> Maybe Text
newDBInstanceIdentifier') (\s :: ModifyDBInstance
s@ModifyDBInstance' {} Maybe Text
a -> ModifyDBInstance
s {$sel:newDBInstanceIdentifier':ModifyDBInstance' :: Maybe Text
newDBInstanceIdentifier' = Maybe Text
a} :: ModifyDBInstance)

-- | The new compute and memory capacity of the instance; for example,
-- @db.r5.large@. Not all instance classes are available in all Regions.
--
-- If you modify the instance class, an outage occurs during the change.
-- The change is applied during the next maintenance window, unless
-- @ApplyImmediately@ is specified as @true@ for this request.
--
-- Default: Uses existing setting.
modifyDBInstance_dbInstanceClass :: Lens.Lens' ModifyDBInstance (Prelude.Maybe Prelude.Text)
modifyDBInstance_dbInstanceClass :: (Maybe Text -> f (Maybe Text))
-> ModifyDBInstance -> f ModifyDBInstance
modifyDBInstance_dbInstanceClass = (ModifyDBInstance -> Maybe Text)
-> (ModifyDBInstance -> Maybe Text -> ModifyDBInstance)
-> Lens ModifyDBInstance ModifyDBInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyDBInstance' {Maybe Text
dbInstanceClass :: Maybe Text
$sel:dbInstanceClass:ModifyDBInstance' :: ModifyDBInstance -> Maybe Text
dbInstanceClass} -> Maybe Text
dbInstanceClass) (\s :: ModifyDBInstance
s@ModifyDBInstance' {} Maybe Text
a -> ModifyDBInstance
s {$sel:dbInstanceClass:ModifyDBInstance' :: Maybe Text
dbInstanceClass = Maybe Text
a} :: ModifyDBInstance)

-- | A value that specifies the order in which an Amazon DocumentDB replica
-- is promoted to the primary instance after a failure of the existing
-- primary instance.
--
-- Default: 1
--
-- Valid values: 0-15
modifyDBInstance_promotionTier :: Lens.Lens' ModifyDBInstance (Prelude.Maybe Prelude.Int)
modifyDBInstance_promotionTier :: (Maybe Int -> f (Maybe Int))
-> ModifyDBInstance -> f ModifyDBInstance
modifyDBInstance_promotionTier = (ModifyDBInstance -> Maybe Int)
-> (ModifyDBInstance -> Maybe Int -> ModifyDBInstance)
-> Lens ModifyDBInstance ModifyDBInstance (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyDBInstance' {Maybe Int
promotionTier :: Maybe Int
$sel:promotionTier:ModifyDBInstance' :: ModifyDBInstance -> Maybe Int
promotionTier} -> Maybe Int
promotionTier) (\s :: ModifyDBInstance
s@ModifyDBInstance' {} Maybe Int
a -> ModifyDBInstance
s {$sel:promotionTier:ModifyDBInstance' :: Maybe Int
promotionTier = Maybe Int
a} :: ModifyDBInstance)

-- | The weekly time range (in UTC) during which system maintenance can
-- occur, which might result in an outage. Changing this parameter doesn\'t
-- result in an outage except in the following situation, and the change is
-- asynchronously applied as soon as possible. If there are pending actions
-- that cause a reboot, and the maintenance window is changed to include
-- the current time, changing this parameter causes a reboot of the
-- instance. If you are moving this window to the current time, there must
-- be at least 30 minutes between the current time and end of the window to
-- ensure that pending changes are applied.
--
-- Default: Uses existing setting.
--
-- Format: @ddd:hh24:mi-ddd:hh24:mi@
--
-- Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun
--
-- Constraints: Must be at least 30 minutes.
modifyDBInstance_preferredMaintenanceWindow :: Lens.Lens' ModifyDBInstance (Prelude.Maybe Prelude.Text)
modifyDBInstance_preferredMaintenanceWindow :: (Maybe Text -> f (Maybe Text))
-> ModifyDBInstance -> f ModifyDBInstance
modifyDBInstance_preferredMaintenanceWindow = (ModifyDBInstance -> Maybe Text)
-> (ModifyDBInstance -> Maybe Text -> ModifyDBInstance)
-> Lens ModifyDBInstance ModifyDBInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyDBInstance' {Maybe Text
preferredMaintenanceWindow :: Maybe Text
$sel:preferredMaintenanceWindow:ModifyDBInstance' :: ModifyDBInstance -> Maybe Text
preferredMaintenanceWindow} -> Maybe Text
preferredMaintenanceWindow) (\s :: ModifyDBInstance
s@ModifyDBInstance' {} Maybe Text
a -> ModifyDBInstance
s {$sel:preferredMaintenanceWindow:ModifyDBInstance' :: Maybe Text
preferredMaintenanceWindow = Maybe Text
a} :: ModifyDBInstance)

-- | Indicates the certificate that needs to be associated with the instance.
modifyDBInstance_cACertificateIdentifier :: Lens.Lens' ModifyDBInstance (Prelude.Maybe Prelude.Text)
modifyDBInstance_cACertificateIdentifier :: (Maybe Text -> f (Maybe Text))
-> ModifyDBInstance -> f ModifyDBInstance
modifyDBInstance_cACertificateIdentifier = (ModifyDBInstance -> Maybe Text)
-> (ModifyDBInstance -> Maybe Text -> ModifyDBInstance)
-> Lens ModifyDBInstance ModifyDBInstance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyDBInstance' {Maybe Text
cACertificateIdentifier :: Maybe Text
$sel:cACertificateIdentifier:ModifyDBInstance' :: ModifyDBInstance -> Maybe Text
cACertificateIdentifier} -> Maybe Text
cACertificateIdentifier) (\s :: ModifyDBInstance
s@ModifyDBInstance' {} Maybe Text
a -> ModifyDBInstance
s {$sel:cACertificateIdentifier:ModifyDBInstance' :: Maybe Text
cACertificateIdentifier = Maybe Text
a} :: ModifyDBInstance)

-- | Specifies whether the modifications in this request and any pending
-- modifications are asynchronously applied as soon as possible, regardless
-- of the @PreferredMaintenanceWindow@ setting for the instance.
--
-- If this parameter is set to @false@, changes to the instance are applied
-- during the next maintenance window. Some parameter changes can cause an
-- outage and are applied on the next reboot.
--
-- Default: @false@
modifyDBInstance_applyImmediately :: Lens.Lens' ModifyDBInstance (Prelude.Maybe Prelude.Bool)
modifyDBInstance_applyImmediately :: (Maybe Bool -> f (Maybe Bool))
-> ModifyDBInstance -> f ModifyDBInstance
modifyDBInstance_applyImmediately = (ModifyDBInstance -> Maybe Bool)
-> (ModifyDBInstance -> Maybe Bool -> ModifyDBInstance)
-> Lens ModifyDBInstance ModifyDBInstance (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyDBInstance' {Maybe Bool
applyImmediately :: Maybe Bool
$sel:applyImmediately:ModifyDBInstance' :: ModifyDBInstance -> Maybe Bool
applyImmediately} -> Maybe Bool
applyImmediately) (\s :: ModifyDBInstance
s@ModifyDBInstance' {} Maybe Bool
a -> ModifyDBInstance
s {$sel:applyImmediately:ModifyDBInstance' :: Maybe Bool
applyImmediately = Maybe Bool
a} :: ModifyDBInstance)

-- | The instance identifier. This value is stored as a lowercase string.
--
-- Constraints:
--
-- -   Must match the identifier of an existing @DBInstance@.
modifyDBInstance_dbInstanceIdentifier :: Lens.Lens' ModifyDBInstance Prelude.Text
modifyDBInstance_dbInstanceIdentifier :: (Text -> f Text) -> ModifyDBInstance -> f ModifyDBInstance
modifyDBInstance_dbInstanceIdentifier = (ModifyDBInstance -> Text)
-> (ModifyDBInstance -> Text -> ModifyDBInstance)
-> Lens ModifyDBInstance ModifyDBInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyDBInstance' {Text
dbInstanceIdentifier :: Text
$sel:dbInstanceIdentifier:ModifyDBInstance' :: ModifyDBInstance -> Text
dbInstanceIdentifier} -> Text
dbInstanceIdentifier) (\s :: ModifyDBInstance
s@ModifyDBInstance' {} Text
a -> ModifyDBInstance
s {$sel:dbInstanceIdentifier:ModifyDBInstance' :: Text
dbInstanceIdentifier = Text
a} :: ModifyDBInstance)

instance Core.AWSRequest ModifyDBInstance where
  type
    AWSResponse ModifyDBInstance =
      ModifyDBInstanceResponse
  request :: ModifyDBInstance -> Request ModifyDBInstance
request = Service -> ModifyDBInstance -> Request ModifyDBInstance
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy ModifyDBInstance
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ModifyDBInstance)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse ModifyDBInstance))
-> Logger
-> Service
-> Proxy ModifyDBInstance
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ModifyDBInstance)))
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
"ModifyDBInstanceResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe DBInstance -> Int -> ModifyDBInstanceResponse
ModifyDBInstanceResponse'
            (Maybe DBInstance -> Int -> ModifyDBInstanceResponse)
-> Either String (Maybe DBInstance)
-> Either String (Int -> ModifyDBInstanceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe DBInstance)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DBInstance")
            Either String (Int -> ModifyDBInstanceResponse)
-> Either String Int -> Either String ModifyDBInstanceResponse
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 ModifyDBInstance

instance Prelude.NFData ModifyDBInstance

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

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

instance Core.ToQuery ModifyDBInstance where
  toQuery :: ModifyDBInstance -> QueryString
toQuery ModifyDBInstance' {Maybe Bool
Maybe Int
Maybe Text
Text
dbInstanceIdentifier :: Text
applyImmediately :: Maybe Bool
cACertificateIdentifier :: Maybe Text
preferredMaintenanceWindow :: Maybe Text
promotionTier :: Maybe Int
dbInstanceClass :: Maybe Text
newDBInstanceIdentifier' :: Maybe Text
autoMinorVersionUpgrade :: Maybe Bool
$sel:dbInstanceIdentifier:ModifyDBInstance' :: ModifyDBInstance -> Text
$sel:applyImmediately:ModifyDBInstance' :: ModifyDBInstance -> Maybe Bool
$sel:cACertificateIdentifier:ModifyDBInstance' :: ModifyDBInstance -> Maybe Text
$sel:preferredMaintenanceWindow:ModifyDBInstance' :: ModifyDBInstance -> Maybe Text
$sel:promotionTier:ModifyDBInstance' :: ModifyDBInstance -> Maybe Int
$sel:dbInstanceClass:ModifyDBInstance' :: ModifyDBInstance -> Maybe Text
$sel:newDBInstanceIdentifier':ModifyDBInstance' :: ModifyDBInstance -> Maybe Text
$sel:autoMinorVersionUpgrade:ModifyDBInstance' :: ModifyDBInstance -> Maybe Bool
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"ModifyDBInstance" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"AutoMinorVersionUpgrade"
          ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
autoMinorVersionUpgrade,
        ByteString
"NewDBInstanceIdentifier"
          ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
newDBInstanceIdentifier',
        ByteString
"DBInstanceClass" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
dbInstanceClass,
        ByteString
"PromotionTier" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
promotionTier,
        ByteString
"PreferredMaintenanceWindow"
          ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
preferredMaintenanceWindow,
        ByteString
"CACertificateIdentifier"
          ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
cACertificateIdentifier,
        ByteString
"ApplyImmediately" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
applyImmediately,
        ByteString
"DBInstanceIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbInstanceIdentifier
      ]

-- | /See:/ 'newModifyDBInstanceResponse' smart constructor.
data ModifyDBInstanceResponse = ModifyDBInstanceResponse'
  { ModifyDBInstanceResponse -> Maybe DBInstance
dbInstance :: Prelude.Maybe DBInstance,
    -- | The response's http status code.
    ModifyDBInstanceResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ModifyDBInstanceResponse -> ModifyDBInstanceResponse -> Bool
(ModifyDBInstanceResponse -> ModifyDBInstanceResponse -> Bool)
-> (ModifyDBInstanceResponse -> ModifyDBInstanceResponse -> Bool)
-> Eq ModifyDBInstanceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyDBInstanceResponse -> ModifyDBInstanceResponse -> Bool
$c/= :: ModifyDBInstanceResponse -> ModifyDBInstanceResponse -> Bool
== :: ModifyDBInstanceResponse -> ModifyDBInstanceResponse -> Bool
$c== :: ModifyDBInstanceResponse -> ModifyDBInstanceResponse -> Bool
Prelude.Eq, ReadPrec [ModifyDBInstanceResponse]
ReadPrec ModifyDBInstanceResponse
Int -> ReadS ModifyDBInstanceResponse
ReadS [ModifyDBInstanceResponse]
(Int -> ReadS ModifyDBInstanceResponse)
-> ReadS [ModifyDBInstanceResponse]
-> ReadPrec ModifyDBInstanceResponse
-> ReadPrec [ModifyDBInstanceResponse]
-> Read ModifyDBInstanceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyDBInstanceResponse]
$creadListPrec :: ReadPrec [ModifyDBInstanceResponse]
readPrec :: ReadPrec ModifyDBInstanceResponse
$creadPrec :: ReadPrec ModifyDBInstanceResponse
readList :: ReadS [ModifyDBInstanceResponse]
$creadList :: ReadS [ModifyDBInstanceResponse]
readsPrec :: Int -> ReadS ModifyDBInstanceResponse
$creadsPrec :: Int -> ReadS ModifyDBInstanceResponse
Prelude.Read, Int -> ModifyDBInstanceResponse -> ShowS
[ModifyDBInstanceResponse] -> ShowS
ModifyDBInstanceResponse -> String
(Int -> ModifyDBInstanceResponse -> ShowS)
-> (ModifyDBInstanceResponse -> String)
-> ([ModifyDBInstanceResponse] -> ShowS)
-> Show ModifyDBInstanceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyDBInstanceResponse] -> ShowS
$cshowList :: [ModifyDBInstanceResponse] -> ShowS
show :: ModifyDBInstanceResponse -> String
$cshow :: ModifyDBInstanceResponse -> String
showsPrec :: Int -> ModifyDBInstanceResponse -> ShowS
$cshowsPrec :: Int -> ModifyDBInstanceResponse -> ShowS
Prelude.Show, (forall x.
 ModifyDBInstanceResponse -> Rep ModifyDBInstanceResponse x)
-> (forall x.
    Rep ModifyDBInstanceResponse x -> ModifyDBInstanceResponse)
-> Generic ModifyDBInstanceResponse
forall x.
Rep ModifyDBInstanceResponse x -> ModifyDBInstanceResponse
forall x.
ModifyDBInstanceResponse -> Rep ModifyDBInstanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ModifyDBInstanceResponse x -> ModifyDBInstanceResponse
$cfrom :: forall x.
ModifyDBInstanceResponse -> Rep ModifyDBInstanceResponse x
Prelude.Generic)

-- |
-- Create a value of 'ModifyDBInstanceResponse' 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:
--
-- 'dbInstance', 'modifyDBInstanceResponse_dbInstance' - Undocumented member.
--
-- 'httpStatus', 'modifyDBInstanceResponse_httpStatus' - The response's http status code.
newModifyDBInstanceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ModifyDBInstanceResponse
newModifyDBInstanceResponse :: Int -> ModifyDBInstanceResponse
newModifyDBInstanceResponse Int
pHttpStatus_ =
  ModifyDBInstanceResponse' :: Maybe DBInstance -> Int -> ModifyDBInstanceResponse
ModifyDBInstanceResponse'
    { $sel:dbInstance:ModifyDBInstanceResponse' :: Maybe DBInstance
dbInstance =
        Maybe DBInstance
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ModifyDBInstanceResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
modifyDBInstanceResponse_dbInstance :: Lens.Lens' ModifyDBInstanceResponse (Prelude.Maybe DBInstance)
modifyDBInstanceResponse_dbInstance :: (Maybe DBInstance -> f (Maybe DBInstance))
-> ModifyDBInstanceResponse -> f ModifyDBInstanceResponse
modifyDBInstanceResponse_dbInstance = (ModifyDBInstanceResponse -> Maybe DBInstance)
-> (ModifyDBInstanceResponse
    -> Maybe DBInstance -> ModifyDBInstanceResponse)
-> Lens
     ModifyDBInstanceResponse
     ModifyDBInstanceResponse
     (Maybe DBInstance)
     (Maybe DBInstance)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyDBInstanceResponse' {Maybe DBInstance
dbInstance :: Maybe DBInstance
$sel:dbInstance:ModifyDBInstanceResponse' :: ModifyDBInstanceResponse -> Maybe DBInstance
dbInstance} -> Maybe DBInstance
dbInstance) (\s :: ModifyDBInstanceResponse
s@ModifyDBInstanceResponse' {} Maybe DBInstance
a -> ModifyDBInstanceResponse
s {$sel:dbInstance:ModifyDBInstanceResponse' :: Maybe DBInstance
dbInstance = Maybe DBInstance
a} :: ModifyDBInstanceResponse)

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

instance Prelude.NFData ModifyDBInstanceResponse