{-# 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.FailoverDBCluster
(
FailoverDBCluster (..),
newFailoverDBCluster,
failoverDBCluster_targetDBInstanceIdentifier,
failoverDBCluster_dbClusterIdentifier,
FailoverDBClusterResponse (..),
newFailoverDBClusterResponse,
failoverDBClusterResponse_dbCluster,
failoverDBClusterResponse_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 FailoverDBCluster = FailoverDBCluster'
{
FailoverDBCluster -> Maybe Text
targetDBInstanceIdentifier :: Prelude.Maybe Prelude.Text,
FailoverDBCluster -> Text
dbClusterIdentifier :: Prelude.Text
}
deriving (FailoverDBCluster -> FailoverDBCluster -> Bool
(FailoverDBCluster -> FailoverDBCluster -> Bool)
-> (FailoverDBCluster -> FailoverDBCluster -> Bool)
-> Eq FailoverDBCluster
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FailoverDBCluster -> FailoverDBCluster -> Bool
$c/= :: FailoverDBCluster -> FailoverDBCluster -> Bool
== :: FailoverDBCluster -> FailoverDBCluster -> Bool
$c== :: FailoverDBCluster -> FailoverDBCluster -> Bool
Prelude.Eq, ReadPrec [FailoverDBCluster]
ReadPrec FailoverDBCluster
Int -> ReadS FailoverDBCluster
ReadS [FailoverDBCluster]
(Int -> ReadS FailoverDBCluster)
-> ReadS [FailoverDBCluster]
-> ReadPrec FailoverDBCluster
-> ReadPrec [FailoverDBCluster]
-> Read FailoverDBCluster
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FailoverDBCluster]
$creadListPrec :: ReadPrec [FailoverDBCluster]
readPrec :: ReadPrec FailoverDBCluster
$creadPrec :: ReadPrec FailoverDBCluster
readList :: ReadS [FailoverDBCluster]
$creadList :: ReadS [FailoverDBCluster]
readsPrec :: Int -> ReadS FailoverDBCluster
$creadsPrec :: Int -> ReadS FailoverDBCluster
Prelude.Read, Int -> FailoverDBCluster -> ShowS
[FailoverDBCluster] -> ShowS
FailoverDBCluster -> String
(Int -> FailoverDBCluster -> ShowS)
-> (FailoverDBCluster -> String)
-> ([FailoverDBCluster] -> ShowS)
-> Show FailoverDBCluster
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FailoverDBCluster] -> ShowS
$cshowList :: [FailoverDBCluster] -> ShowS
show :: FailoverDBCluster -> String
$cshow :: FailoverDBCluster -> String
showsPrec :: Int -> FailoverDBCluster -> ShowS
$cshowsPrec :: Int -> FailoverDBCluster -> ShowS
Prelude.Show, (forall x. FailoverDBCluster -> Rep FailoverDBCluster x)
-> (forall x. Rep FailoverDBCluster x -> FailoverDBCluster)
-> Generic FailoverDBCluster
forall x. Rep FailoverDBCluster x -> FailoverDBCluster
forall x. FailoverDBCluster -> Rep FailoverDBCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FailoverDBCluster x -> FailoverDBCluster
$cfrom :: forall x. FailoverDBCluster -> Rep FailoverDBCluster x
Prelude.Generic)
newFailoverDBCluster ::
Prelude.Text ->
FailoverDBCluster
newFailoverDBCluster :: Text -> FailoverDBCluster
newFailoverDBCluster Text
pDBClusterIdentifier_ =
FailoverDBCluster' :: Maybe Text -> Text -> FailoverDBCluster
FailoverDBCluster'
{ $sel:targetDBInstanceIdentifier:FailoverDBCluster' :: Maybe Text
targetDBInstanceIdentifier =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:dbClusterIdentifier:FailoverDBCluster' :: Text
dbClusterIdentifier = Text
pDBClusterIdentifier_
}
failoverDBCluster_targetDBInstanceIdentifier :: Lens.Lens' FailoverDBCluster (Prelude.Maybe Prelude.Text)
failoverDBCluster_targetDBInstanceIdentifier :: (Maybe Text -> f (Maybe Text))
-> FailoverDBCluster -> f FailoverDBCluster
failoverDBCluster_targetDBInstanceIdentifier = (FailoverDBCluster -> Maybe Text)
-> (FailoverDBCluster -> Maybe Text -> FailoverDBCluster)
-> Lens
FailoverDBCluster FailoverDBCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailoverDBCluster' {Maybe Text
targetDBInstanceIdentifier :: Maybe Text
$sel:targetDBInstanceIdentifier:FailoverDBCluster' :: FailoverDBCluster -> Maybe Text
targetDBInstanceIdentifier} -> Maybe Text
targetDBInstanceIdentifier) (\s :: FailoverDBCluster
s@FailoverDBCluster' {} Maybe Text
a -> FailoverDBCluster
s {$sel:targetDBInstanceIdentifier:FailoverDBCluster' :: Maybe Text
targetDBInstanceIdentifier = Maybe Text
a} :: FailoverDBCluster)
failoverDBCluster_dbClusterIdentifier :: Lens.Lens' FailoverDBCluster Prelude.Text
failoverDBCluster_dbClusterIdentifier :: (Text -> f Text) -> FailoverDBCluster -> f FailoverDBCluster
failoverDBCluster_dbClusterIdentifier = (FailoverDBCluster -> Text)
-> (FailoverDBCluster -> Text -> FailoverDBCluster)
-> Lens FailoverDBCluster FailoverDBCluster Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailoverDBCluster' {Text
dbClusterIdentifier :: Text
$sel:dbClusterIdentifier:FailoverDBCluster' :: FailoverDBCluster -> Text
dbClusterIdentifier} -> Text
dbClusterIdentifier) (\s :: FailoverDBCluster
s@FailoverDBCluster' {} Text
a -> FailoverDBCluster
s {$sel:dbClusterIdentifier:FailoverDBCluster' :: Text
dbClusterIdentifier = Text
a} :: FailoverDBCluster)
instance Core.AWSRequest FailoverDBCluster where
type
AWSResponse FailoverDBCluster =
FailoverDBClusterResponse
request :: FailoverDBCluster -> Request FailoverDBCluster
request = Service -> FailoverDBCluster -> Request FailoverDBCluster
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy FailoverDBCluster
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse FailoverDBCluster)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse FailoverDBCluster))
-> Logger
-> Service
-> Proxy FailoverDBCluster
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse FailoverDBCluster)))
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
"FailoverDBClusterResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe DBCluster -> Int -> FailoverDBClusterResponse
FailoverDBClusterResponse'
(Maybe DBCluster -> Int -> FailoverDBClusterResponse)
-> Either String (Maybe DBCluster)
-> Either String (Int -> FailoverDBClusterResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe DBCluster)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DBCluster")
Either String (Int -> FailoverDBClusterResponse)
-> Either String Int -> Either String FailoverDBClusterResponse
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 FailoverDBCluster
instance Prelude.NFData FailoverDBCluster
instance Core.ToHeaders FailoverDBCluster where
toHeaders :: FailoverDBCluster -> ResponseHeaders
toHeaders = ResponseHeaders -> FailoverDBCluster -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath FailoverDBCluster where
toPath :: FailoverDBCluster -> ByteString
toPath = ByteString -> FailoverDBCluster -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery FailoverDBCluster where
toQuery :: FailoverDBCluster -> QueryString
toQuery FailoverDBCluster' {Maybe Text
Text
dbClusterIdentifier :: Text
targetDBInstanceIdentifier :: Maybe Text
$sel:dbClusterIdentifier:FailoverDBCluster' :: FailoverDBCluster -> Text
$sel:targetDBInstanceIdentifier:FailoverDBCluster' :: FailoverDBCluster -> 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
"FailoverDBCluster" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
ByteString
"TargetDBInstanceIdentifier"
ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
targetDBInstanceIdentifier,
ByteString
"DBClusterIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbClusterIdentifier
]
data FailoverDBClusterResponse = FailoverDBClusterResponse'
{ FailoverDBClusterResponse -> Maybe DBCluster
dbCluster :: Prelude.Maybe DBCluster,
FailoverDBClusterResponse -> Int
httpStatus :: Prelude.Int
}
deriving (FailoverDBClusterResponse -> FailoverDBClusterResponse -> Bool
(FailoverDBClusterResponse -> FailoverDBClusterResponse -> Bool)
-> (FailoverDBClusterResponse -> FailoverDBClusterResponse -> Bool)
-> Eq FailoverDBClusterResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FailoverDBClusterResponse -> FailoverDBClusterResponse -> Bool
$c/= :: FailoverDBClusterResponse -> FailoverDBClusterResponse -> Bool
== :: FailoverDBClusterResponse -> FailoverDBClusterResponse -> Bool
$c== :: FailoverDBClusterResponse -> FailoverDBClusterResponse -> Bool
Prelude.Eq, ReadPrec [FailoverDBClusterResponse]
ReadPrec FailoverDBClusterResponse
Int -> ReadS FailoverDBClusterResponse
ReadS [FailoverDBClusterResponse]
(Int -> ReadS FailoverDBClusterResponse)
-> ReadS [FailoverDBClusterResponse]
-> ReadPrec FailoverDBClusterResponse
-> ReadPrec [FailoverDBClusterResponse]
-> Read FailoverDBClusterResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FailoverDBClusterResponse]
$creadListPrec :: ReadPrec [FailoverDBClusterResponse]
readPrec :: ReadPrec FailoverDBClusterResponse
$creadPrec :: ReadPrec FailoverDBClusterResponse
readList :: ReadS [FailoverDBClusterResponse]
$creadList :: ReadS [FailoverDBClusterResponse]
readsPrec :: Int -> ReadS FailoverDBClusterResponse
$creadsPrec :: Int -> ReadS FailoverDBClusterResponse
Prelude.Read, Int -> FailoverDBClusterResponse -> ShowS
[FailoverDBClusterResponse] -> ShowS
FailoverDBClusterResponse -> String
(Int -> FailoverDBClusterResponse -> ShowS)
-> (FailoverDBClusterResponse -> String)
-> ([FailoverDBClusterResponse] -> ShowS)
-> Show FailoverDBClusterResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FailoverDBClusterResponse] -> ShowS
$cshowList :: [FailoverDBClusterResponse] -> ShowS
show :: FailoverDBClusterResponse -> String
$cshow :: FailoverDBClusterResponse -> String
showsPrec :: Int -> FailoverDBClusterResponse -> ShowS
$cshowsPrec :: Int -> FailoverDBClusterResponse -> ShowS
Prelude.Show, (forall x.
FailoverDBClusterResponse -> Rep FailoverDBClusterResponse x)
-> (forall x.
Rep FailoverDBClusterResponse x -> FailoverDBClusterResponse)
-> Generic FailoverDBClusterResponse
forall x.
Rep FailoverDBClusterResponse x -> FailoverDBClusterResponse
forall x.
FailoverDBClusterResponse -> Rep FailoverDBClusterResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FailoverDBClusterResponse x -> FailoverDBClusterResponse
$cfrom :: forall x.
FailoverDBClusterResponse -> Rep FailoverDBClusterResponse x
Prelude.Generic)
newFailoverDBClusterResponse ::
Prelude.Int ->
FailoverDBClusterResponse
newFailoverDBClusterResponse :: Int -> FailoverDBClusterResponse
newFailoverDBClusterResponse Int
pHttpStatus_ =
FailoverDBClusterResponse' :: Maybe DBCluster -> Int -> FailoverDBClusterResponse
FailoverDBClusterResponse'
{ $sel:dbCluster:FailoverDBClusterResponse' :: Maybe DBCluster
dbCluster =
Maybe DBCluster
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:FailoverDBClusterResponse' :: Int
httpStatus = Int
pHttpStatus_
}
failoverDBClusterResponse_dbCluster :: Lens.Lens' FailoverDBClusterResponse (Prelude.Maybe DBCluster)
failoverDBClusterResponse_dbCluster :: (Maybe DBCluster -> f (Maybe DBCluster))
-> FailoverDBClusterResponse -> f FailoverDBClusterResponse
failoverDBClusterResponse_dbCluster = (FailoverDBClusterResponse -> Maybe DBCluster)
-> (FailoverDBClusterResponse
-> Maybe DBCluster -> FailoverDBClusterResponse)
-> Lens
FailoverDBClusterResponse
FailoverDBClusterResponse
(Maybe DBCluster)
(Maybe DBCluster)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailoverDBClusterResponse' {Maybe DBCluster
dbCluster :: Maybe DBCluster
$sel:dbCluster:FailoverDBClusterResponse' :: FailoverDBClusterResponse -> Maybe DBCluster
dbCluster} -> Maybe DBCluster
dbCluster) (\s :: FailoverDBClusterResponse
s@FailoverDBClusterResponse' {} Maybe DBCluster
a -> FailoverDBClusterResponse
s {$sel:dbCluster:FailoverDBClusterResponse' :: Maybe DBCluster
dbCluster = Maybe DBCluster
a} :: FailoverDBClusterResponse)
failoverDBClusterResponse_httpStatus :: Lens.Lens' FailoverDBClusterResponse Prelude.Int
failoverDBClusterResponse_httpStatus :: (Int -> f Int)
-> FailoverDBClusterResponse -> f FailoverDBClusterResponse
failoverDBClusterResponse_httpStatus = (FailoverDBClusterResponse -> Int)
-> (FailoverDBClusterResponse -> Int -> FailoverDBClusterResponse)
-> Lens FailoverDBClusterResponse FailoverDBClusterResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailoverDBClusterResponse' {Int
httpStatus :: Int
$sel:httpStatus:FailoverDBClusterResponse' :: FailoverDBClusterResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: FailoverDBClusterResponse
s@FailoverDBClusterResponse' {} Int
a -> FailoverDBClusterResponse
s {$sel:httpStatus:FailoverDBClusterResponse' :: Int
httpStatus = Int
a} :: FailoverDBClusterResponse)
instance Prelude.NFData FailoverDBClusterResponse