{-# 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.DrS.StopReplication
(
StopReplication (..),
newStopReplication,
stopReplication_sourceServerID,
StopReplicationResponse (..),
newStopReplicationResponse,
stopReplicationResponse_sourceServer,
stopReplicationResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DrS.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data StopReplication = StopReplication'
{
StopReplication -> Text
sourceServerID :: Prelude.Text
}
deriving (StopReplication -> StopReplication -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopReplication -> StopReplication -> Bool
$c/= :: StopReplication -> StopReplication -> Bool
== :: StopReplication -> StopReplication -> Bool
$c== :: StopReplication -> StopReplication -> Bool
Prelude.Eq, ReadPrec [StopReplication]
ReadPrec StopReplication
Int -> ReadS StopReplication
ReadS [StopReplication]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopReplication]
$creadListPrec :: ReadPrec [StopReplication]
readPrec :: ReadPrec StopReplication
$creadPrec :: ReadPrec StopReplication
readList :: ReadS [StopReplication]
$creadList :: ReadS [StopReplication]
readsPrec :: Int -> ReadS StopReplication
$creadsPrec :: Int -> ReadS StopReplication
Prelude.Read, Int -> StopReplication -> ShowS
[StopReplication] -> ShowS
StopReplication -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopReplication] -> ShowS
$cshowList :: [StopReplication] -> ShowS
show :: StopReplication -> String
$cshow :: StopReplication -> String
showsPrec :: Int -> StopReplication -> ShowS
$cshowsPrec :: Int -> StopReplication -> ShowS
Prelude.Show, forall x. Rep StopReplication x -> StopReplication
forall x. StopReplication -> Rep StopReplication x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopReplication x -> StopReplication
$cfrom :: forall x. StopReplication -> Rep StopReplication x
Prelude.Generic)
newStopReplication ::
Prelude.Text ->
StopReplication
newStopReplication :: Text -> StopReplication
newStopReplication Text
pSourceServerID_ =
StopReplication' {$sel:sourceServerID:StopReplication' :: Text
sourceServerID = Text
pSourceServerID_}
stopReplication_sourceServerID :: Lens.Lens' StopReplication Prelude.Text
stopReplication_sourceServerID :: Lens' StopReplication Text
stopReplication_sourceServerID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopReplication' {Text
sourceServerID :: Text
$sel:sourceServerID:StopReplication' :: StopReplication -> Text
sourceServerID} -> Text
sourceServerID) (\s :: StopReplication
s@StopReplication' {} Text
a -> StopReplication
s {$sel:sourceServerID:StopReplication' :: Text
sourceServerID = Text
a} :: StopReplication)
instance Core.AWSRequest StopReplication where
type
AWSResponse StopReplication =
StopReplicationResponse
request :: (Service -> Service) -> StopReplication -> Request StopReplication
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy StopReplication
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopReplication)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe SourceServer -> Int -> StopReplicationResponse
StopReplicationResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"sourceServer")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable StopReplication where
hashWithSalt :: Int -> StopReplication -> Int
hashWithSalt Int
_salt StopReplication' {Text
sourceServerID :: Text
$sel:sourceServerID:StopReplication' :: StopReplication -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sourceServerID
instance Prelude.NFData StopReplication where
rnf :: StopReplication -> ()
rnf StopReplication' {Text
sourceServerID :: Text
$sel:sourceServerID:StopReplication' :: StopReplication -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
sourceServerID
instance Data.ToHeaders StopReplication where
toHeaders :: StopReplication -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON StopReplication where
toJSON :: StopReplication -> Value
toJSON StopReplication' {Text
sourceServerID :: Text
$sel:sourceServerID:StopReplication' :: StopReplication -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"sourceServerID" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
sourceServerID)
]
)
instance Data.ToPath StopReplication where
toPath :: StopReplication -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/StopReplication"
instance Data.ToQuery StopReplication where
toQuery :: StopReplication -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data StopReplicationResponse = StopReplicationResponse'
{
StopReplicationResponse -> Maybe SourceServer
sourceServer :: Prelude.Maybe SourceServer,
StopReplicationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StopReplicationResponse -> StopReplicationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopReplicationResponse -> StopReplicationResponse -> Bool
$c/= :: StopReplicationResponse -> StopReplicationResponse -> Bool
== :: StopReplicationResponse -> StopReplicationResponse -> Bool
$c== :: StopReplicationResponse -> StopReplicationResponse -> Bool
Prelude.Eq, Int -> StopReplicationResponse -> ShowS
[StopReplicationResponse] -> ShowS
StopReplicationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopReplicationResponse] -> ShowS
$cshowList :: [StopReplicationResponse] -> ShowS
show :: StopReplicationResponse -> String
$cshow :: StopReplicationResponse -> String
showsPrec :: Int -> StopReplicationResponse -> ShowS
$cshowsPrec :: Int -> StopReplicationResponse -> ShowS
Prelude.Show, forall x. Rep StopReplicationResponse x -> StopReplicationResponse
forall x. StopReplicationResponse -> Rep StopReplicationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopReplicationResponse x -> StopReplicationResponse
$cfrom :: forall x. StopReplicationResponse -> Rep StopReplicationResponse x
Prelude.Generic)
newStopReplicationResponse ::
Prelude.Int ->
StopReplicationResponse
newStopReplicationResponse :: Int -> StopReplicationResponse
newStopReplicationResponse Int
pHttpStatus_ =
StopReplicationResponse'
{ $sel:sourceServer:StopReplicationResponse' :: Maybe SourceServer
sourceServer =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StopReplicationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
stopReplicationResponse_sourceServer :: Lens.Lens' StopReplicationResponse (Prelude.Maybe SourceServer)
stopReplicationResponse_sourceServer :: Lens' StopReplicationResponse (Maybe SourceServer)
stopReplicationResponse_sourceServer = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopReplicationResponse' {Maybe SourceServer
sourceServer :: Maybe SourceServer
$sel:sourceServer:StopReplicationResponse' :: StopReplicationResponse -> Maybe SourceServer
sourceServer} -> Maybe SourceServer
sourceServer) (\s :: StopReplicationResponse
s@StopReplicationResponse' {} Maybe SourceServer
a -> StopReplicationResponse
s {$sel:sourceServer:StopReplicationResponse' :: Maybe SourceServer
sourceServer = Maybe SourceServer
a} :: StopReplicationResponse)
stopReplicationResponse_httpStatus :: Lens.Lens' StopReplicationResponse Prelude.Int
stopReplicationResponse_httpStatus :: Lens' StopReplicationResponse Int
stopReplicationResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopReplicationResponse' {Int
httpStatus :: Int
$sel:httpStatus:StopReplicationResponse' :: StopReplicationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StopReplicationResponse
s@StopReplicationResponse' {} Int
a -> StopReplicationResponse
s {$sel:httpStatus:StopReplicationResponse' :: Int
httpStatus = Int
a} :: StopReplicationResponse)
instance Prelude.NFData StopReplicationResponse where
rnf :: StopReplicationResponse -> ()
rnf StopReplicationResponse' {Int
Maybe SourceServer
httpStatus :: Int
sourceServer :: Maybe SourceServer
$sel:httpStatus:StopReplicationResponse' :: StopReplicationResponse -> Int
$sel:sourceServer:StopReplicationResponse' :: StopReplicationResponse -> Maybe SourceServer
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe SourceServer
sourceServer
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus