{-# 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.FailoverGlobalCluster
(
FailoverGlobalCluster (..),
newFailoverGlobalCluster,
failoverGlobalCluster_globalClusterIdentifier,
failoverGlobalCluster_targetDbClusterIdentifier,
FailoverGlobalClusterResponse (..),
newFailoverGlobalClusterResponse,
failoverGlobalClusterResponse_globalCluster,
failoverGlobalClusterResponse_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 FailoverGlobalCluster = FailoverGlobalCluster'
{
FailoverGlobalCluster -> Text
globalClusterIdentifier :: Prelude.Text,
FailoverGlobalCluster -> Text
targetDbClusterIdentifier :: Prelude.Text
}
deriving (FailoverGlobalCluster -> FailoverGlobalCluster -> Bool
(FailoverGlobalCluster -> FailoverGlobalCluster -> Bool)
-> (FailoverGlobalCluster -> FailoverGlobalCluster -> Bool)
-> Eq FailoverGlobalCluster
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FailoverGlobalCluster -> FailoverGlobalCluster -> Bool
$c/= :: FailoverGlobalCluster -> FailoverGlobalCluster -> Bool
== :: FailoverGlobalCluster -> FailoverGlobalCluster -> Bool
$c== :: FailoverGlobalCluster -> FailoverGlobalCluster -> Bool
Prelude.Eq, ReadPrec [FailoverGlobalCluster]
ReadPrec FailoverGlobalCluster
Int -> ReadS FailoverGlobalCluster
ReadS [FailoverGlobalCluster]
(Int -> ReadS FailoverGlobalCluster)
-> ReadS [FailoverGlobalCluster]
-> ReadPrec FailoverGlobalCluster
-> ReadPrec [FailoverGlobalCluster]
-> Read FailoverGlobalCluster
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FailoverGlobalCluster]
$creadListPrec :: ReadPrec [FailoverGlobalCluster]
readPrec :: ReadPrec FailoverGlobalCluster
$creadPrec :: ReadPrec FailoverGlobalCluster
readList :: ReadS [FailoverGlobalCluster]
$creadList :: ReadS [FailoverGlobalCluster]
readsPrec :: Int -> ReadS FailoverGlobalCluster
$creadsPrec :: Int -> ReadS FailoverGlobalCluster
Prelude.Read, Int -> FailoverGlobalCluster -> ShowS
[FailoverGlobalCluster] -> ShowS
FailoverGlobalCluster -> String
(Int -> FailoverGlobalCluster -> ShowS)
-> (FailoverGlobalCluster -> String)
-> ([FailoverGlobalCluster] -> ShowS)
-> Show FailoverGlobalCluster
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FailoverGlobalCluster] -> ShowS
$cshowList :: [FailoverGlobalCluster] -> ShowS
show :: FailoverGlobalCluster -> String
$cshow :: FailoverGlobalCluster -> String
showsPrec :: Int -> FailoverGlobalCluster -> ShowS
$cshowsPrec :: Int -> FailoverGlobalCluster -> ShowS
Prelude.Show, (forall x. FailoverGlobalCluster -> Rep FailoverGlobalCluster x)
-> (forall x. Rep FailoverGlobalCluster x -> FailoverGlobalCluster)
-> Generic FailoverGlobalCluster
forall x. Rep FailoverGlobalCluster x -> FailoverGlobalCluster
forall x. FailoverGlobalCluster -> Rep FailoverGlobalCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FailoverGlobalCluster x -> FailoverGlobalCluster
$cfrom :: forall x. FailoverGlobalCluster -> Rep FailoverGlobalCluster x
Prelude.Generic)
newFailoverGlobalCluster ::
Prelude.Text ->
Prelude.Text ->
FailoverGlobalCluster
newFailoverGlobalCluster :: Text -> Text -> FailoverGlobalCluster
newFailoverGlobalCluster
Text
pGlobalClusterIdentifier_
Text
pTargetDbClusterIdentifier_ =
FailoverGlobalCluster' :: Text -> Text -> FailoverGlobalCluster
FailoverGlobalCluster'
{ $sel:globalClusterIdentifier:FailoverGlobalCluster' :: Text
globalClusterIdentifier =
Text
pGlobalClusterIdentifier_,
$sel:targetDbClusterIdentifier:FailoverGlobalCluster' :: Text
targetDbClusterIdentifier =
Text
pTargetDbClusterIdentifier_
}
failoverGlobalCluster_globalClusterIdentifier :: Lens.Lens' FailoverGlobalCluster Prelude.Text
failoverGlobalCluster_globalClusterIdentifier :: (Text -> f Text)
-> FailoverGlobalCluster -> f FailoverGlobalCluster
failoverGlobalCluster_globalClusterIdentifier = (FailoverGlobalCluster -> Text)
-> (FailoverGlobalCluster -> Text -> FailoverGlobalCluster)
-> Lens FailoverGlobalCluster FailoverGlobalCluster Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailoverGlobalCluster' {Text
globalClusterIdentifier :: Text
$sel:globalClusterIdentifier:FailoverGlobalCluster' :: FailoverGlobalCluster -> Text
globalClusterIdentifier} -> Text
globalClusterIdentifier) (\s :: FailoverGlobalCluster
s@FailoverGlobalCluster' {} Text
a -> FailoverGlobalCluster
s {$sel:globalClusterIdentifier:FailoverGlobalCluster' :: Text
globalClusterIdentifier = Text
a} :: FailoverGlobalCluster)
failoverGlobalCluster_targetDbClusterIdentifier :: Lens.Lens' FailoverGlobalCluster Prelude.Text
failoverGlobalCluster_targetDbClusterIdentifier :: (Text -> f Text)
-> FailoverGlobalCluster -> f FailoverGlobalCluster
failoverGlobalCluster_targetDbClusterIdentifier = (FailoverGlobalCluster -> Text)
-> (FailoverGlobalCluster -> Text -> FailoverGlobalCluster)
-> Lens FailoverGlobalCluster FailoverGlobalCluster Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailoverGlobalCluster' {Text
targetDbClusterIdentifier :: Text
$sel:targetDbClusterIdentifier:FailoverGlobalCluster' :: FailoverGlobalCluster -> Text
targetDbClusterIdentifier} -> Text
targetDbClusterIdentifier) (\s :: FailoverGlobalCluster
s@FailoverGlobalCluster' {} Text
a -> FailoverGlobalCluster
s {$sel:targetDbClusterIdentifier:FailoverGlobalCluster' :: Text
targetDbClusterIdentifier = Text
a} :: FailoverGlobalCluster)
instance Core.AWSRequest FailoverGlobalCluster where
type
AWSResponse FailoverGlobalCluster =
FailoverGlobalClusterResponse
request :: FailoverGlobalCluster -> Request FailoverGlobalCluster
request = Service -> FailoverGlobalCluster -> Request FailoverGlobalCluster
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy FailoverGlobalCluster
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse FailoverGlobalCluster)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse FailoverGlobalCluster))
-> Logger
-> Service
-> Proxy FailoverGlobalCluster
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse FailoverGlobalCluster)))
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
"FailoverGlobalClusterResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe GlobalCluster -> Int -> FailoverGlobalClusterResponse
FailoverGlobalClusterResponse'
(Maybe GlobalCluster -> Int -> FailoverGlobalClusterResponse)
-> Either String (Maybe GlobalCluster)
-> Either String (Int -> FailoverGlobalClusterResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe GlobalCluster)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"GlobalCluster")
Either String (Int -> FailoverGlobalClusterResponse)
-> Either String Int -> Either String FailoverGlobalClusterResponse
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 FailoverGlobalCluster
instance Prelude.NFData FailoverGlobalCluster
instance Core.ToHeaders FailoverGlobalCluster where
toHeaders :: FailoverGlobalCluster -> ResponseHeaders
toHeaders = ResponseHeaders -> FailoverGlobalCluster -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath FailoverGlobalCluster where
toPath :: FailoverGlobalCluster -> ByteString
toPath = ByteString -> FailoverGlobalCluster -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery FailoverGlobalCluster where
toQuery :: FailoverGlobalCluster -> QueryString
toQuery FailoverGlobalCluster' {Text
targetDbClusterIdentifier :: Text
globalClusterIdentifier :: Text
$sel:targetDbClusterIdentifier:FailoverGlobalCluster' :: FailoverGlobalCluster -> Text
$sel:globalClusterIdentifier:FailoverGlobalCluster' :: FailoverGlobalCluster -> 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
"FailoverGlobalCluster" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
ByteString
"GlobalClusterIdentifier"
ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
globalClusterIdentifier,
ByteString
"TargetDbClusterIdentifier"
ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
targetDbClusterIdentifier
]
data FailoverGlobalClusterResponse = FailoverGlobalClusterResponse'
{ FailoverGlobalClusterResponse -> Maybe GlobalCluster
globalCluster :: Prelude.Maybe GlobalCluster,
FailoverGlobalClusterResponse -> Int
httpStatus :: Prelude.Int
}
deriving (FailoverGlobalClusterResponse
-> FailoverGlobalClusterResponse -> Bool
(FailoverGlobalClusterResponse
-> FailoverGlobalClusterResponse -> Bool)
-> (FailoverGlobalClusterResponse
-> FailoverGlobalClusterResponse -> Bool)
-> Eq FailoverGlobalClusterResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FailoverGlobalClusterResponse
-> FailoverGlobalClusterResponse -> Bool
$c/= :: FailoverGlobalClusterResponse
-> FailoverGlobalClusterResponse -> Bool
== :: FailoverGlobalClusterResponse
-> FailoverGlobalClusterResponse -> Bool
$c== :: FailoverGlobalClusterResponse
-> FailoverGlobalClusterResponse -> Bool
Prelude.Eq, ReadPrec [FailoverGlobalClusterResponse]
ReadPrec FailoverGlobalClusterResponse
Int -> ReadS FailoverGlobalClusterResponse
ReadS [FailoverGlobalClusterResponse]
(Int -> ReadS FailoverGlobalClusterResponse)
-> ReadS [FailoverGlobalClusterResponse]
-> ReadPrec FailoverGlobalClusterResponse
-> ReadPrec [FailoverGlobalClusterResponse]
-> Read FailoverGlobalClusterResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FailoverGlobalClusterResponse]
$creadListPrec :: ReadPrec [FailoverGlobalClusterResponse]
readPrec :: ReadPrec FailoverGlobalClusterResponse
$creadPrec :: ReadPrec FailoverGlobalClusterResponse
readList :: ReadS [FailoverGlobalClusterResponse]
$creadList :: ReadS [FailoverGlobalClusterResponse]
readsPrec :: Int -> ReadS FailoverGlobalClusterResponse
$creadsPrec :: Int -> ReadS FailoverGlobalClusterResponse
Prelude.Read, Int -> FailoverGlobalClusterResponse -> ShowS
[FailoverGlobalClusterResponse] -> ShowS
FailoverGlobalClusterResponse -> String
(Int -> FailoverGlobalClusterResponse -> ShowS)
-> (FailoverGlobalClusterResponse -> String)
-> ([FailoverGlobalClusterResponse] -> ShowS)
-> Show FailoverGlobalClusterResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FailoverGlobalClusterResponse] -> ShowS
$cshowList :: [FailoverGlobalClusterResponse] -> ShowS
show :: FailoverGlobalClusterResponse -> String
$cshow :: FailoverGlobalClusterResponse -> String
showsPrec :: Int -> FailoverGlobalClusterResponse -> ShowS
$cshowsPrec :: Int -> FailoverGlobalClusterResponse -> ShowS
Prelude.Show, (forall x.
FailoverGlobalClusterResponse
-> Rep FailoverGlobalClusterResponse x)
-> (forall x.
Rep FailoverGlobalClusterResponse x
-> FailoverGlobalClusterResponse)
-> Generic FailoverGlobalClusterResponse
forall x.
Rep FailoverGlobalClusterResponse x
-> FailoverGlobalClusterResponse
forall x.
FailoverGlobalClusterResponse
-> Rep FailoverGlobalClusterResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FailoverGlobalClusterResponse x
-> FailoverGlobalClusterResponse
$cfrom :: forall x.
FailoverGlobalClusterResponse
-> Rep FailoverGlobalClusterResponse x
Prelude.Generic)
newFailoverGlobalClusterResponse ::
Prelude.Int ->
FailoverGlobalClusterResponse
newFailoverGlobalClusterResponse :: Int -> FailoverGlobalClusterResponse
newFailoverGlobalClusterResponse Int
pHttpStatus_ =
FailoverGlobalClusterResponse' :: Maybe GlobalCluster -> Int -> FailoverGlobalClusterResponse
FailoverGlobalClusterResponse'
{ $sel:globalCluster:FailoverGlobalClusterResponse' :: Maybe GlobalCluster
globalCluster =
Maybe GlobalCluster
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:FailoverGlobalClusterResponse' :: Int
httpStatus = Int
pHttpStatus_
}
failoverGlobalClusterResponse_globalCluster :: Lens.Lens' FailoverGlobalClusterResponse (Prelude.Maybe GlobalCluster)
failoverGlobalClusterResponse_globalCluster :: (Maybe GlobalCluster -> f (Maybe GlobalCluster))
-> FailoverGlobalClusterResponse -> f FailoverGlobalClusterResponse
failoverGlobalClusterResponse_globalCluster = (FailoverGlobalClusterResponse -> Maybe GlobalCluster)
-> (FailoverGlobalClusterResponse
-> Maybe GlobalCluster -> FailoverGlobalClusterResponse)
-> Lens
FailoverGlobalClusterResponse
FailoverGlobalClusterResponse
(Maybe GlobalCluster)
(Maybe GlobalCluster)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailoverGlobalClusterResponse' {Maybe GlobalCluster
globalCluster :: Maybe GlobalCluster
$sel:globalCluster:FailoverGlobalClusterResponse' :: FailoverGlobalClusterResponse -> Maybe GlobalCluster
globalCluster} -> Maybe GlobalCluster
globalCluster) (\s :: FailoverGlobalClusterResponse
s@FailoverGlobalClusterResponse' {} Maybe GlobalCluster
a -> FailoverGlobalClusterResponse
s {$sel:globalCluster:FailoverGlobalClusterResponse' :: Maybe GlobalCluster
globalCluster = Maybe GlobalCluster
a} :: FailoverGlobalClusterResponse)
failoverGlobalClusterResponse_httpStatus :: Lens.Lens' FailoverGlobalClusterResponse Prelude.Int
failoverGlobalClusterResponse_httpStatus :: (Int -> f Int)
-> FailoverGlobalClusterResponse -> f FailoverGlobalClusterResponse
failoverGlobalClusterResponse_httpStatus = (FailoverGlobalClusterResponse -> Int)
-> (FailoverGlobalClusterResponse
-> Int -> FailoverGlobalClusterResponse)
-> Lens
FailoverGlobalClusterResponse FailoverGlobalClusterResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FailoverGlobalClusterResponse' {Int
httpStatus :: Int
$sel:httpStatus:FailoverGlobalClusterResponse' :: FailoverGlobalClusterResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: FailoverGlobalClusterResponse
s@FailoverGlobalClusterResponse' {} Int
a -> FailoverGlobalClusterResponse
s {$sel:httpStatus:FailoverGlobalClusterResponse' :: Int
httpStatus = Int
a} :: FailoverGlobalClusterResponse)
instance Prelude.NFData FailoverGlobalClusterResponse