{-# 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.DMS.TestConnection
(
TestConnection (..),
newTestConnection,
testConnection_replicationInstanceArn,
testConnection_endpointArn,
TestConnectionResponse (..),
newTestConnectionResponse,
testConnectionResponse_connection,
testConnectionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DMS.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 TestConnection = TestConnection'
{
TestConnection -> Text
replicationInstanceArn :: Prelude.Text,
TestConnection -> Text
endpointArn :: Prelude.Text
}
deriving (TestConnection -> TestConnection -> Bool
(TestConnection -> TestConnection -> Bool)
-> (TestConnection -> TestConnection -> Bool) -> Eq TestConnection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestConnection -> TestConnection -> Bool
$c/= :: TestConnection -> TestConnection -> Bool
== :: TestConnection -> TestConnection -> Bool
$c== :: TestConnection -> TestConnection -> Bool
Prelude.Eq, ReadPrec [TestConnection]
ReadPrec TestConnection
Int -> ReadS TestConnection
ReadS [TestConnection]
(Int -> ReadS TestConnection)
-> ReadS [TestConnection]
-> ReadPrec TestConnection
-> ReadPrec [TestConnection]
-> Read TestConnection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TestConnection]
$creadListPrec :: ReadPrec [TestConnection]
readPrec :: ReadPrec TestConnection
$creadPrec :: ReadPrec TestConnection
readList :: ReadS [TestConnection]
$creadList :: ReadS [TestConnection]
readsPrec :: Int -> ReadS TestConnection
$creadsPrec :: Int -> ReadS TestConnection
Prelude.Read, Int -> TestConnection -> ShowS
[TestConnection] -> ShowS
TestConnection -> String
(Int -> TestConnection -> ShowS)
-> (TestConnection -> String)
-> ([TestConnection] -> ShowS)
-> Show TestConnection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestConnection] -> ShowS
$cshowList :: [TestConnection] -> ShowS
show :: TestConnection -> String
$cshow :: TestConnection -> String
showsPrec :: Int -> TestConnection -> ShowS
$cshowsPrec :: Int -> TestConnection -> ShowS
Prelude.Show, (forall x. TestConnection -> Rep TestConnection x)
-> (forall x. Rep TestConnection x -> TestConnection)
-> Generic TestConnection
forall x. Rep TestConnection x -> TestConnection
forall x. TestConnection -> Rep TestConnection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TestConnection x -> TestConnection
$cfrom :: forall x. TestConnection -> Rep TestConnection x
Prelude.Generic)
newTestConnection ::
Prelude.Text ->
Prelude.Text ->
TestConnection
newTestConnection :: Text -> Text -> TestConnection
newTestConnection
Text
pReplicationInstanceArn_
Text
pEndpointArn_ =
TestConnection' :: Text -> Text -> TestConnection
TestConnection'
{ $sel:replicationInstanceArn:TestConnection' :: Text
replicationInstanceArn =
Text
pReplicationInstanceArn_,
$sel:endpointArn:TestConnection' :: Text
endpointArn = Text
pEndpointArn_
}
testConnection_replicationInstanceArn :: Lens.Lens' TestConnection Prelude.Text
testConnection_replicationInstanceArn :: (Text -> f Text) -> TestConnection -> f TestConnection
testConnection_replicationInstanceArn = (TestConnection -> Text)
-> (TestConnection -> Text -> TestConnection)
-> Lens TestConnection TestConnection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestConnection' {Text
replicationInstanceArn :: Text
$sel:replicationInstanceArn:TestConnection' :: TestConnection -> Text
replicationInstanceArn} -> Text
replicationInstanceArn) (\s :: TestConnection
s@TestConnection' {} Text
a -> TestConnection
s {$sel:replicationInstanceArn:TestConnection' :: Text
replicationInstanceArn = Text
a} :: TestConnection)
testConnection_endpointArn :: Lens.Lens' TestConnection Prelude.Text
testConnection_endpointArn :: (Text -> f Text) -> TestConnection -> f TestConnection
testConnection_endpointArn = (TestConnection -> Text)
-> (TestConnection -> Text -> TestConnection)
-> Lens TestConnection TestConnection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestConnection' {Text
endpointArn :: Text
$sel:endpointArn:TestConnection' :: TestConnection -> Text
endpointArn} -> Text
endpointArn) (\s :: TestConnection
s@TestConnection' {} Text
a -> TestConnection
s {$sel:endpointArn:TestConnection' :: Text
endpointArn = Text
a} :: TestConnection)
instance Core.AWSRequest TestConnection where
type
AWSResponse TestConnection =
TestConnectionResponse
request :: TestConnection -> Request TestConnection
request = Service -> TestConnection -> Request TestConnection
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy TestConnection
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TestConnection)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse TestConnection))
-> Logger
-> Service
-> Proxy TestConnection
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TestConnection)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Connection -> Int -> TestConnectionResponse
TestConnectionResponse'
(Maybe Connection -> Int -> TestConnectionResponse)
-> Either String (Maybe Connection)
-> Either String (Int -> TestConnectionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Connection)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Connection")
Either String (Int -> TestConnectionResponse)
-> Either String Int -> Either String TestConnectionResponse
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 TestConnection
instance Prelude.NFData TestConnection
instance Core.ToHeaders TestConnection where
toHeaders :: TestConnection -> ResponseHeaders
toHeaders =
ResponseHeaders -> TestConnection -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AmazonDMSv20160101.TestConnection" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON TestConnection where
toJSON :: TestConnection -> Value
toJSON TestConnection' {Text
endpointArn :: Text
replicationInstanceArn :: Text
$sel:endpointArn:TestConnection' :: TestConnection -> Text
$sel:replicationInstanceArn:TestConnection' :: TestConnection -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"ReplicationInstanceArn"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
replicationInstanceArn
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"EndpointArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
endpointArn)
]
)
instance Core.ToPath TestConnection where
toPath :: TestConnection -> ByteString
toPath = ByteString -> TestConnection -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery TestConnection where
toQuery :: TestConnection -> QueryString
toQuery = QueryString -> TestConnection -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data TestConnectionResponse = TestConnectionResponse'
{
TestConnectionResponse -> Maybe Connection
connection :: Prelude.Maybe Connection,
TestConnectionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (TestConnectionResponse -> TestConnectionResponse -> Bool
(TestConnectionResponse -> TestConnectionResponse -> Bool)
-> (TestConnectionResponse -> TestConnectionResponse -> Bool)
-> Eq TestConnectionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestConnectionResponse -> TestConnectionResponse -> Bool
$c/= :: TestConnectionResponse -> TestConnectionResponse -> Bool
== :: TestConnectionResponse -> TestConnectionResponse -> Bool
$c== :: TestConnectionResponse -> TestConnectionResponse -> Bool
Prelude.Eq, ReadPrec [TestConnectionResponse]
ReadPrec TestConnectionResponse
Int -> ReadS TestConnectionResponse
ReadS [TestConnectionResponse]
(Int -> ReadS TestConnectionResponse)
-> ReadS [TestConnectionResponse]
-> ReadPrec TestConnectionResponse
-> ReadPrec [TestConnectionResponse]
-> Read TestConnectionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TestConnectionResponse]
$creadListPrec :: ReadPrec [TestConnectionResponse]
readPrec :: ReadPrec TestConnectionResponse
$creadPrec :: ReadPrec TestConnectionResponse
readList :: ReadS [TestConnectionResponse]
$creadList :: ReadS [TestConnectionResponse]
readsPrec :: Int -> ReadS TestConnectionResponse
$creadsPrec :: Int -> ReadS TestConnectionResponse
Prelude.Read, Int -> TestConnectionResponse -> ShowS
[TestConnectionResponse] -> ShowS
TestConnectionResponse -> String
(Int -> TestConnectionResponse -> ShowS)
-> (TestConnectionResponse -> String)
-> ([TestConnectionResponse] -> ShowS)
-> Show TestConnectionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestConnectionResponse] -> ShowS
$cshowList :: [TestConnectionResponse] -> ShowS
show :: TestConnectionResponse -> String
$cshow :: TestConnectionResponse -> String
showsPrec :: Int -> TestConnectionResponse -> ShowS
$cshowsPrec :: Int -> TestConnectionResponse -> ShowS
Prelude.Show, (forall x. TestConnectionResponse -> Rep TestConnectionResponse x)
-> (forall x.
Rep TestConnectionResponse x -> TestConnectionResponse)
-> Generic TestConnectionResponse
forall x. Rep TestConnectionResponse x -> TestConnectionResponse
forall x. TestConnectionResponse -> Rep TestConnectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TestConnectionResponse x -> TestConnectionResponse
$cfrom :: forall x. TestConnectionResponse -> Rep TestConnectionResponse x
Prelude.Generic)
newTestConnectionResponse ::
Prelude.Int ->
TestConnectionResponse
newTestConnectionResponse :: Int -> TestConnectionResponse
newTestConnectionResponse Int
pHttpStatus_ =
TestConnectionResponse' :: Maybe Connection -> Int -> TestConnectionResponse
TestConnectionResponse'
{ $sel:connection:TestConnectionResponse' :: Maybe Connection
connection =
Maybe Connection
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:TestConnectionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
testConnectionResponse_connection :: Lens.Lens' TestConnectionResponse (Prelude.Maybe Connection)
testConnectionResponse_connection :: (Maybe Connection -> f (Maybe Connection))
-> TestConnectionResponse -> f TestConnectionResponse
testConnectionResponse_connection = (TestConnectionResponse -> Maybe Connection)
-> (TestConnectionResponse
-> Maybe Connection -> TestConnectionResponse)
-> Lens
TestConnectionResponse
TestConnectionResponse
(Maybe Connection)
(Maybe Connection)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestConnectionResponse' {Maybe Connection
connection :: Maybe Connection
$sel:connection:TestConnectionResponse' :: TestConnectionResponse -> Maybe Connection
connection} -> Maybe Connection
connection) (\s :: TestConnectionResponse
s@TestConnectionResponse' {} Maybe Connection
a -> TestConnectionResponse
s {$sel:connection:TestConnectionResponse' :: Maybe Connection
connection = Maybe Connection
a} :: TestConnectionResponse)
testConnectionResponse_httpStatus :: Lens.Lens' TestConnectionResponse Prelude.Int
testConnectionResponse_httpStatus :: (Int -> f Int)
-> TestConnectionResponse -> f TestConnectionResponse
testConnectionResponse_httpStatus = (TestConnectionResponse -> Int)
-> (TestConnectionResponse -> Int -> TestConnectionResponse)
-> Lens TestConnectionResponse TestConnectionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestConnectionResponse' {Int
httpStatus :: Int
$sel:httpStatus:TestConnectionResponse' :: TestConnectionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: TestConnectionResponse
s@TestConnectionResponse' {} Int
a -> TestConnectionResponse
s {$sel:httpStatus:TestConnectionResponse' :: Int
httpStatus = Int
a} :: TestConnectionResponse)
instance Prelude.NFData TestConnectionResponse