{-# 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 #-}
module Amazonka.RDS.PromoteReadReplica
(
PromoteReadReplica (..),
newPromoteReadReplica,
promoteReadReplica_preferredBackupWindow,
promoteReadReplica_backupRetentionPeriod,
promoteReadReplica_dbInstanceIdentifier,
PromoteReadReplicaResponse (..),
newPromoteReadReplicaResponse,
promoteReadReplicaResponse_dbInstance,
promoteReadReplicaResponse_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
data PromoteReadReplica = PromoteReadReplica'
{
PromoteReadReplica -> Maybe Text
preferredBackupWindow :: Prelude.Maybe Prelude.Text,
PromoteReadReplica -> Maybe Int
backupRetentionPeriod :: Prelude.Maybe Prelude.Int,
PromoteReadReplica -> Text
dbInstanceIdentifier :: Prelude.Text
}
deriving (PromoteReadReplica -> PromoteReadReplica -> Bool
(PromoteReadReplica -> PromoteReadReplica -> Bool)
-> (PromoteReadReplica -> PromoteReadReplica -> Bool)
-> Eq PromoteReadReplica
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PromoteReadReplica -> PromoteReadReplica -> Bool
$c/= :: PromoteReadReplica -> PromoteReadReplica -> Bool
== :: PromoteReadReplica -> PromoteReadReplica -> Bool
$c== :: PromoteReadReplica -> PromoteReadReplica -> Bool
Prelude.Eq, ReadPrec [PromoteReadReplica]
ReadPrec PromoteReadReplica
Int -> ReadS PromoteReadReplica
ReadS [PromoteReadReplica]
(Int -> ReadS PromoteReadReplica)
-> ReadS [PromoteReadReplica]
-> ReadPrec PromoteReadReplica
-> ReadPrec [PromoteReadReplica]
-> Read PromoteReadReplica
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PromoteReadReplica]
$creadListPrec :: ReadPrec [PromoteReadReplica]
readPrec :: ReadPrec PromoteReadReplica
$creadPrec :: ReadPrec PromoteReadReplica
readList :: ReadS [PromoteReadReplica]
$creadList :: ReadS [PromoteReadReplica]
readsPrec :: Int -> ReadS PromoteReadReplica
$creadsPrec :: Int -> ReadS PromoteReadReplica
Prelude.Read, Int -> PromoteReadReplica -> ShowS
[PromoteReadReplica] -> ShowS
PromoteReadReplica -> String
(Int -> PromoteReadReplica -> ShowS)
-> (PromoteReadReplica -> String)
-> ([PromoteReadReplica] -> ShowS)
-> Show PromoteReadReplica
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PromoteReadReplica] -> ShowS
$cshowList :: [PromoteReadReplica] -> ShowS
show :: PromoteReadReplica -> String
$cshow :: PromoteReadReplica -> String
showsPrec :: Int -> PromoteReadReplica -> ShowS
$cshowsPrec :: Int -> PromoteReadReplica -> ShowS
Prelude.Show, (forall x. PromoteReadReplica -> Rep PromoteReadReplica x)
-> (forall x. Rep PromoteReadReplica x -> PromoteReadReplica)
-> Generic PromoteReadReplica
forall x. Rep PromoteReadReplica x -> PromoteReadReplica
forall x. PromoteReadReplica -> Rep PromoteReadReplica x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PromoteReadReplica x -> PromoteReadReplica
$cfrom :: forall x. PromoteReadReplica -> Rep PromoteReadReplica x
Prelude.Generic)
newPromoteReadReplica ::
Prelude.Text ->
PromoteReadReplica
newPromoteReadReplica :: Text -> PromoteReadReplica
newPromoteReadReplica Text
pDBInstanceIdentifier_ =
PromoteReadReplica' :: Maybe Text -> Maybe Int -> Text -> PromoteReadReplica
PromoteReadReplica'
{ $sel:preferredBackupWindow:PromoteReadReplica' :: Maybe Text
preferredBackupWindow =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:backupRetentionPeriod:PromoteReadReplica' :: Maybe Int
backupRetentionPeriod = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:dbInstanceIdentifier:PromoteReadReplica' :: Text
dbInstanceIdentifier = Text
pDBInstanceIdentifier_
}
promoteReadReplica_preferredBackupWindow :: Lens.Lens' PromoteReadReplica (Prelude.Maybe Prelude.Text)
promoteReadReplica_preferredBackupWindow :: (Maybe Text -> f (Maybe Text))
-> PromoteReadReplica -> f PromoteReadReplica
promoteReadReplica_preferredBackupWindow = (PromoteReadReplica -> Maybe Text)
-> (PromoteReadReplica -> Maybe Text -> PromoteReadReplica)
-> Lens
PromoteReadReplica PromoteReadReplica (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PromoteReadReplica' {Maybe Text
preferredBackupWindow :: Maybe Text
$sel:preferredBackupWindow:PromoteReadReplica' :: PromoteReadReplica -> Maybe Text
preferredBackupWindow} -> Maybe Text
preferredBackupWindow) (\s :: PromoteReadReplica
s@PromoteReadReplica' {} Maybe Text
a -> PromoteReadReplica
s {$sel:preferredBackupWindow:PromoteReadReplica' :: Maybe Text
preferredBackupWindow = Maybe Text
a} :: PromoteReadReplica)
promoteReadReplica_backupRetentionPeriod :: Lens.Lens' PromoteReadReplica (Prelude.Maybe Prelude.Int)
promoteReadReplica_backupRetentionPeriod :: (Maybe Int -> f (Maybe Int))
-> PromoteReadReplica -> f PromoteReadReplica
promoteReadReplica_backupRetentionPeriod = (PromoteReadReplica -> Maybe Int)
-> (PromoteReadReplica -> Maybe Int -> PromoteReadReplica)
-> Lens
PromoteReadReplica PromoteReadReplica (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PromoteReadReplica' {Maybe Int
backupRetentionPeriod :: Maybe Int
$sel:backupRetentionPeriod:PromoteReadReplica' :: PromoteReadReplica -> Maybe Int
backupRetentionPeriod} -> Maybe Int
backupRetentionPeriod) (\s :: PromoteReadReplica
s@PromoteReadReplica' {} Maybe Int
a -> PromoteReadReplica
s {$sel:backupRetentionPeriod:PromoteReadReplica' :: Maybe Int
backupRetentionPeriod = Maybe Int
a} :: PromoteReadReplica)
promoteReadReplica_dbInstanceIdentifier :: Lens.Lens' PromoteReadReplica Prelude.Text
promoteReadReplica_dbInstanceIdentifier :: (Text -> f Text) -> PromoteReadReplica -> f PromoteReadReplica
promoteReadReplica_dbInstanceIdentifier = (PromoteReadReplica -> Text)
-> (PromoteReadReplica -> Text -> PromoteReadReplica)
-> Lens PromoteReadReplica PromoteReadReplica Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PromoteReadReplica' {Text
dbInstanceIdentifier :: Text
$sel:dbInstanceIdentifier:PromoteReadReplica' :: PromoteReadReplica -> Text
dbInstanceIdentifier} -> Text
dbInstanceIdentifier) (\s :: PromoteReadReplica
s@PromoteReadReplica' {} Text
a -> PromoteReadReplica
s {$sel:dbInstanceIdentifier:PromoteReadReplica' :: Text
dbInstanceIdentifier = Text
a} :: PromoteReadReplica)
instance Core.AWSRequest PromoteReadReplica where
type
AWSResponse PromoteReadReplica =
PromoteReadReplicaResponse
request :: PromoteReadReplica -> Request PromoteReadReplica
request = Service -> PromoteReadReplica -> Request PromoteReadReplica
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy PromoteReadReplica
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PromoteReadReplica)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse PromoteReadReplica))
-> Logger
-> Service
-> Proxy PromoteReadReplica
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PromoteReadReplica)))
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
"PromoteReadReplicaResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe DBInstance -> Int -> PromoteReadReplicaResponse
PromoteReadReplicaResponse'
(Maybe DBInstance -> Int -> PromoteReadReplicaResponse)
-> Either String (Maybe DBInstance)
-> Either String (Int -> PromoteReadReplicaResponse)
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 -> PromoteReadReplicaResponse)
-> Either String Int -> Either String PromoteReadReplicaResponse
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 PromoteReadReplica
instance Prelude.NFData PromoteReadReplica
instance Core.ToHeaders PromoteReadReplica where
toHeaders :: PromoteReadReplica -> ResponseHeaders
toHeaders = ResponseHeaders -> PromoteReadReplica -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath PromoteReadReplica where
toPath :: PromoteReadReplica -> ByteString
toPath = ByteString -> PromoteReadReplica -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PromoteReadReplica where
toQuery :: PromoteReadReplica -> QueryString
toQuery PromoteReadReplica' {Maybe Int
Maybe Text
Text
dbInstanceIdentifier :: Text
backupRetentionPeriod :: Maybe Int
preferredBackupWindow :: Maybe Text
$sel:dbInstanceIdentifier:PromoteReadReplica' :: PromoteReadReplica -> Text
$sel:backupRetentionPeriod:PromoteReadReplica' :: PromoteReadReplica -> Maybe Int
$sel:preferredBackupWindow:PromoteReadReplica' :: PromoteReadReplica -> 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
"PromoteReadReplica" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
ByteString
"PreferredBackupWindow"
ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
preferredBackupWindow,
ByteString
"BackupRetentionPeriod"
ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
backupRetentionPeriod,
ByteString
"DBInstanceIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbInstanceIdentifier
]
data PromoteReadReplicaResponse = PromoteReadReplicaResponse'
{ PromoteReadReplicaResponse -> Maybe DBInstance
dbInstance :: Prelude.Maybe DBInstance,
PromoteReadReplicaResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PromoteReadReplicaResponse -> PromoteReadReplicaResponse -> Bool
(PromoteReadReplicaResponse -> PromoteReadReplicaResponse -> Bool)
-> (PromoteReadReplicaResponse
-> PromoteReadReplicaResponse -> Bool)
-> Eq PromoteReadReplicaResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PromoteReadReplicaResponse -> PromoteReadReplicaResponse -> Bool
$c/= :: PromoteReadReplicaResponse -> PromoteReadReplicaResponse -> Bool
== :: PromoteReadReplicaResponse -> PromoteReadReplicaResponse -> Bool
$c== :: PromoteReadReplicaResponse -> PromoteReadReplicaResponse -> Bool
Prelude.Eq, ReadPrec [PromoteReadReplicaResponse]
ReadPrec PromoteReadReplicaResponse
Int -> ReadS PromoteReadReplicaResponse
ReadS [PromoteReadReplicaResponse]
(Int -> ReadS PromoteReadReplicaResponse)
-> ReadS [PromoteReadReplicaResponse]
-> ReadPrec PromoteReadReplicaResponse
-> ReadPrec [PromoteReadReplicaResponse]
-> Read PromoteReadReplicaResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PromoteReadReplicaResponse]
$creadListPrec :: ReadPrec [PromoteReadReplicaResponse]
readPrec :: ReadPrec PromoteReadReplicaResponse
$creadPrec :: ReadPrec PromoteReadReplicaResponse
readList :: ReadS [PromoteReadReplicaResponse]
$creadList :: ReadS [PromoteReadReplicaResponse]
readsPrec :: Int -> ReadS PromoteReadReplicaResponse
$creadsPrec :: Int -> ReadS PromoteReadReplicaResponse
Prelude.Read, Int -> PromoteReadReplicaResponse -> ShowS
[PromoteReadReplicaResponse] -> ShowS
PromoteReadReplicaResponse -> String
(Int -> PromoteReadReplicaResponse -> ShowS)
-> (PromoteReadReplicaResponse -> String)
-> ([PromoteReadReplicaResponse] -> ShowS)
-> Show PromoteReadReplicaResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PromoteReadReplicaResponse] -> ShowS
$cshowList :: [PromoteReadReplicaResponse] -> ShowS
show :: PromoteReadReplicaResponse -> String
$cshow :: PromoteReadReplicaResponse -> String
showsPrec :: Int -> PromoteReadReplicaResponse -> ShowS
$cshowsPrec :: Int -> PromoteReadReplicaResponse -> ShowS
Prelude.Show, (forall x.
PromoteReadReplicaResponse -> Rep PromoteReadReplicaResponse x)
-> (forall x.
Rep PromoteReadReplicaResponse x -> PromoteReadReplicaResponse)
-> Generic PromoteReadReplicaResponse
forall x.
Rep PromoteReadReplicaResponse x -> PromoteReadReplicaResponse
forall x.
PromoteReadReplicaResponse -> Rep PromoteReadReplicaResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PromoteReadReplicaResponse x -> PromoteReadReplicaResponse
$cfrom :: forall x.
PromoteReadReplicaResponse -> Rep PromoteReadReplicaResponse x
Prelude.Generic)
newPromoteReadReplicaResponse ::
Prelude.Int ->
PromoteReadReplicaResponse
newPromoteReadReplicaResponse :: Int -> PromoteReadReplicaResponse
newPromoteReadReplicaResponse Int
pHttpStatus_ =
PromoteReadReplicaResponse' :: Maybe DBInstance -> Int -> PromoteReadReplicaResponse
PromoteReadReplicaResponse'
{ $sel:dbInstance:PromoteReadReplicaResponse' :: Maybe DBInstance
dbInstance =
Maybe DBInstance
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PromoteReadReplicaResponse' :: Int
httpStatus = Int
pHttpStatus_
}
promoteReadReplicaResponse_dbInstance :: Lens.Lens' PromoteReadReplicaResponse (Prelude.Maybe DBInstance)
promoteReadReplicaResponse_dbInstance :: (Maybe DBInstance -> f (Maybe DBInstance))
-> PromoteReadReplicaResponse -> f PromoteReadReplicaResponse
promoteReadReplicaResponse_dbInstance = (PromoteReadReplicaResponse -> Maybe DBInstance)
-> (PromoteReadReplicaResponse
-> Maybe DBInstance -> PromoteReadReplicaResponse)
-> Lens
PromoteReadReplicaResponse
PromoteReadReplicaResponse
(Maybe DBInstance)
(Maybe DBInstance)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PromoteReadReplicaResponse' {Maybe DBInstance
dbInstance :: Maybe DBInstance
$sel:dbInstance:PromoteReadReplicaResponse' :: PromoteReadReplicaResponse -> Maybe DBInstance
dbInstance} -> Maybe DBInstance
dbInstance) (\s :: PromoteReadReplicaResponse
s@PromoteReadReplicaResponse' {} Maybe DBInstance
a -> PromoteReadReplicaResponse
s {$sel:dbInstance:PromoteReadReplicaResponse' :: Maybe DBInstance
dbInstance = Maybe DBInstance
a} :: PromoteReadReplicaResponse)
promoteReadReplicaResponse_httpStatus :: Lens.Lens' PromoteReadReplicaResponse Prelude.Int
promoteReadReplicaResponse_httpStatus :: (Int -> f Int)
-> PromoteReadReplicaResponse -> f PromoteReadReplicaResponse
promoteReadReplicaResponse_httpStatus = (PromoteReadReplicaResponse -> Int)
-> (PromoteReadReplicaResponse
-> Int -> PromoteReadReplicaResponse)
-> Lens
PromoteReadReplicaResponse PromoteReadReplicaResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PromoteReadReplicaResponse' {Int
httpStatus :: Int
$sel:httpStatus:PromoteReadReplicaResponse' :: PromoteReadReplicaResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PromoteReadReplicaResponse
s@PromoteReadReplicaResponse' {} Int
a -> PromoteReadReplicaResponse
s {$sel:httpStatus:PromoteReadReplicaResponse' :: Int
httpStatus = Int
a} :: PromoteReadReplicaResponse)
instance Prelude.NFData PromoteReadReplicaResponse