{-# 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.ElastiCache.TestFailover
(
TestFailover (..),
newTestFailover,
testFailover_replicationGroupId,
testFailover_nodeGroupId,
TestFailoverResponse (..),
newTestFailoverResponse,
testFailoverResponse_replicationGroup,
testFailoverResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ElastiCache.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
data TestFailover = TestFailover'
{
TestFailover -> Text
replicationGroupId :: Prelude.Text,
TestFailover -> Text
nodeGroupId :: Prelude.Text
}
deriving (TestFailover -> TestFailover -> Bool
(TestFailover -> TestFailover -> Bool)
-> (TestFailover -> TestFailover -> Bool) -> Eq TestFailover
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestFailover -> TestFailover -> Bool
$c/= :: TestFailover -> TestFailover -> Bool
== :: TestFailover -> TestFailover -> Bool
$c== :: TestFailover -> TestFailover -> Bool
Prelude.Eq, ReadPrec [TestFailover]
ReadPrec TestFailover
Int -> ReadS TestFailover
ReadS [TestFailover]
(Int -> ReadS TestFailover)
-> ReadS [TestFailover]
-> ReadPrec TestFailover
-> ReadPrec [TestFailover]
-> Read TestFailover
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TestFailover]
$creadListPrec :: ReadPrec [TestFailover]
readPrec :: ReadPrec TestFailover
$creadPrec :: ReadPrec TestFailover
readList :: ReadS [TestFailover]
$creadList :: ReadS [TestFailover]
readsPrec :: Int -> ReadS TestFailover
$creadsPrec :: Int -> ReadS TestFailover
Prelude.Read, Int -> TestFailover -> ShowS
[TestFailover] -> ShowS
TestFailover -> String
(Int -> TestFailover -> ShowS)
-> (TestFailover -> String)
-> ([TestFailover] -> ShowS)
-> Show TestFailover
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestFailover] -> ShowS
$cshowList :: [TestFailover] -> ShowS
show :: TestFailover -> String
$cshow :: TestFailover -> String
showsPrec :: Int -> TestFailover -> ShowS
$cshowsPrec :: Int -> TestFailover -> ShowS
Prelude.Show, (forall x. TestFailover -> Rep TestFailover x)
-> (forall x. Rep TestFailover x -> TestFailover)
-> Generic TestFailover
forall x. Rep TestFailover x -> TestFailover
forall x. TestFailover -> Rep TestFailover x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TestFailover x -> TestFailover
$cfrom :: forall x. TestFailover -> Rep TestFailover x
Prelude.Generic)
newTestFailover ::
Prelude.Text ->
Prelude.Text ->
TestFailover
newTestFailover :: Text -> Text -> TestFailover
newTestFailover Text
pReplicationGroupId_ Text
pNodeGroupId_ =
TestFailover' :: Text -> Text -> TestFailover
TestFailover'
{ $sel:replicationGroupId:TestFailover' :: Text
replicationGroupId =
Text
pReplicationGroupId_,
$sel:nodeGroupId:TestFailover' :: Text
nodeGroupId = Text
pNodeGroupId_
}
testFailover_replicationGroupId :: Lens.Lens' TestFailover Prelude.Text
testFailover_replicationGroupId :: (Text -> f Text) -> TestFailover -> f TestFailover
testFailover_replicationGroupId = (TestFailover -> Text)
-> (TestFailover -> Text -> TestFailover)
-> Lens TestFailover TestFailover Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestFailover' {Text
replicationGroupId :: Text
$sel:replicationGroupId:TestFailover' :: TestFailover -> Text
replicationGroupId} -> Text
replicationGroupId) (\s :: TestFailover
s@TestFailover' {} Text
a -> TestFailover
s {$sel:replicationGroupId:TestFailover' :: Text
replicationGroupId = Text
a} :: TestFailover)
testFailover_nodeGroupId :: Lens.Lens' TestFailover Prelude.Text
testFailover_nodeGroupId :: (Text -> f Text) -> TestFailover -> f TestFailover
testFailover_nodeGroupId = (TestFailover -> Text)
-> (TestFailover -> Text -> TestFailover)
-> Lens TestFailover TestFailover Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestFailover' {Text
nodeGroupId :: Text
$sel:nodeGroupId:TestFailover' :: TestFailover -> Text
nodeGroupId} -> Text
nodeGroupId) (\s :: TestFailover
s@TestFailover' {} Text
a -> TestFailover
s {$sel:nodeGroupId:TestFailover' :: Text
nodeGroupId = Text
a} :: TestFailover)
instance Core.AWSRequest TestFailover where
type AWSResponse TestFailover = TestFailoverResponse
request :: TestFailover -> Request TestFailover
request = Service -> TestFailover -> Request TestFailover
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy TestFailover
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TestFailover)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse TestFailover))
-> Logger
-> Service
-> Proxy TestFailover
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TestFailover)))
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
"TestFailoverResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe ReplicationGroup -> Int -> TestFailoverResponse
TestFailoverResponse'
(Maybe ReplicationGroup -> Int -> TestFailoverResponse)
-> Either String (Maybe ReplicationGroup)
-> Either String (Int -> TestFailoverResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ReplicationGroup)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ReplicationGroup")
Either String (Int -> TestFailoverResponse)
-> Either String Int -> Either String TestFailoverResponse
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 TestFailover
instance Prelude.NFData TestFailover
instance Core.ToHeaders TestFailover where
toHeaders :: TestFailover -> ResponseHeaders
toHeaders = ResponseHeaders -> TestFailover -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath TestFailover where
toPath :: TestFailover -> ByteString
toPath = ByteString -> TestFailover -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery TestFailover where
toQuery :: TestFailover -> QueryString
toQuery TestFailover' {Text
nodeGroupId :: Text
replicationGroupId :: Text
$sel:nodeGroupId:TestFailover' :: TestFailover -> Text
$sel:replicationGroupId:TestFailover' :: TestFailover -> 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
"TestFailover" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
ByteString
"ReplicationGroupId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
replicationGroupId,
ByteString
"NodeGroupId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
nodeGroupId
]
data TestFailoverResponse = TestFailoverResponse'
{ TestFailoverResponse -> Maybe ReplicationGroup
replicationGroup :: Prelude.Maybe ReplicationGroup,
TestFailoverResponse -> Int
httpStatus :: Prelude.Int
}
deriving (TestFailoverResponse -> TestFailoverResponse -> Bool
(TestFailoverResponse -> TestFailoverResponse -> Bool)
-> (TestFailoverResponse -> TestFailoverResponse -> Bool)
-> Eq TestFailoverResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestFailoverResponse -> TestFailoverResponse -> Bool
$c/= :: TestFailoverResponse -> TestFailoverResponse -> Bool
== :: TestFailoverResponse -> TestFailoverResponse -> Bool
$c== :: TestFailoverResponse -> TestFailoverResponse -> Bool
Prelude.Eq, ReadPrec [TestFailoverResponse]
ReadPrec TestFailoverResponse
Int -> ReadS TestFailoverResponse
ReadS [TestFailoverResponse]
(Int -> ReadS TestFailoverResponse)
-> ReadS [TestFailoverResponse]
-> ReadPrec TestFailoverResponse
-> ReadPrec [TestFailoverResponse]
-> Read TestFailoverResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TestFailoverResponse]
$creadListPrec :: ReadPrec [TestFailoverResponse]
readPrec :: ReadPrec TestFailoverResponse
$creadPrec :: ReadPrec TestFailoverResponse
readList :: ReadS [TestFailoverResponse]
$creadList :: ReadS [TestFailoverResponse]
readsPrec :: Int -> ReadS TestFailoverResponse
$creadsPrec :: Int -> ReadS TestFailoverResponse
Prelude.Read, Int -> TestFailoverResponse -> ShowS
[TestFailoverResponse] -> ShowS
TestFailoverResponse -> String
(Int -> TestFailoverResponse -> ShowS)
-> (TestFailoverResponse -> String)
-> ([TestFailoverResponse] -> ShowS)
-> Show TestFailoverResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestFailoverResponse] -> ShowS
$cshowList :: [TestFailoverResponse] -> ShowS
show :: TestFailoverResponse -> String
$cshow :: TestFailoverResponse -> String
showsPrec :: Int -> TestFailoverResponse -> ShowS
$cshowsPrec :: Int -> TestFailoverResponse -> ShowS
Prelude.Show, (forall x. TestFailoverResponse -> Rep TestFailoverResponse x)
-> (forall x. Rep TestFailoverResponse x -> TestFailoverResponse)
-> Generic TestFailoverResponse
forall x. Rep TestFailoverResponse x -> TestFailoverResponse
forall x. TestFailoverResponse -> Rep TestFailoverResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TestFailoverResponse x -> TestFailoverResponse
$cfrom :: forall x. TestFailoverResponse -> Rep TestFailoverResponse x
Prelude.Generic)
newTestFailoverResponse ::
Prelude.Int ->
TestFailoverResponse
newTestFailoverResponse :: Int -> TestFailoverResponse
newTestFailoverResponse Int
pHttpStatus_ =
TestFailoverResponse' :: Maybe ReplicationGroup -> Int -> TestFailoverResponse
TestFailoverResponse'
{ $sel:replicationGroup:TestFailoverResponse' :: Maybe ReplicationGroup
replicationGroup =
Maybe ReplicationGroup
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:TestFailoverResponse' :: Int
httpStatus = Int
pHttpStatus_
}
testFailoverResponse_replicationGroup :: Lens.Lens' TestFailoverResponse (Prelude.Maybe ReplicationGroup)
testFailoverResponse_replicationGroup :: (Maybe ReplicationGroup -> f (Maybe ReplicationGroup))
-> TestFailoverResponse -> f TestFailoverResponse
testFailoverResponse_replicationGroup = (TestFailoverResponse -> Maybe ReplicationGroup)
-> (TestFailoverResponse
-> Maybe ReplicationGroup -> TestFailoverResponse)
-> Lens
TestFailoverResponse
TestFailoverResponse
(Maybe ReplicationGroup)
(Maybe ReplicationGroup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestFailoverResponse' {Maybe ReplicationGroup
replicationGroup :: Maybe ReplicationGroup
$sel:replicationGroup:TestFailoverResponse' :: TestFailoverResponse -> Maybe ReplicationGroup
replicationGroup} -> Maybe ReplicationGroup
replicationGroup) (\s :: TestFailoverResponse
s@TestFailoverResponse' {} Maybe ReplicationGroup
a -> TestFailoverResponse
s {$sel:replicationGroup:TestFailoverResponse' :: Maybe ReplicationGroup
replicationGroup = Maybe ReplicationGroup
a} :: TestFailoverResponse)
testFailoverResponse_httpStatus :: Lens.Lens' TestFailoverResponse Prelude.Int
testFailoverResponse_httpStatus :: (Int -> f Int) -> TestFailoverResponse -> f TestFailoverResponse
testFailoverResponse_httpStatus = (TestFailoverResponse -> Int)
-> (TestFailoverResponse -> Int -> TestFailoverResponse)
-> Lens TestFailoverResponse TestFailoverResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestFailoverResponse' {Int
httpStatus :: Int
$sel:httpStatus:TestFailoverResponse' :: TestFailoverResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: TestFailoverResponse
s@TestFailoverResponse' {} Int
a -> TestFailoverResponse
s {$sel:httpStatus:TestFailoverResponse' :: Int
httpStatus = Int
a} :: TestFailoverResponse)
instance Prelude.NFData TestFailoverResponse