{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.DMS.Types
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:replicationInstanceArn:TestConnection' :: Text
replicationInstanceArn =
Text
pReplicationInstanceArn_,
$sel:endpointArn:TestConnection' :: Text
endpointArn = Text
pEndpointArn_
}
testConnection_replicationInstanceArn :: Lens.Lens' TestConnection Prelude.Text
testConnection_replicationInstanceArn :: Lens' TestConnection Text
testConnection_replicationInstanceArn = 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 :: Lens' TestConnection Text
testConnection_endpointArn = 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 :: (Service -> Service) -> TestConnection -> Request TestConnection
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 TestConnection
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TestConnection)))
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 Connection -> Int -> TestConnectionResponse
TestConnectionResponse'
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
"Connection")
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 TestConnection where
hashWithSalt :: Int -> TestConnection -> Int
hashWithSalt Int
_salt TestConnection' {Text
endpointArn :: Text
replicationInstanceArn :: Text
$sel:endpointArn:TestConnection' :: TestConnection -> Text
$sel:replicationInstanceArn:TestConnection' :: TestConnection -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
replicationInstanceArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
endpointArn
instance Prelude.NFData TestConnection where
rnf :: TestConnection -> ()
rnf TestConnection' {Text
endpointArn :: Text
replicationInstanceArn :: Text
$sel:endpointArn:TestConnection' :: TestConnection -> Text
$sel:replicationInstanceArn:TestConnection' :: TestConnection -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
replicationInstanceArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
endpointArn
instance Data.ToHeaders TestConnection where
toHeaders :: TestConnection -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AmazonDMSv20160101.TestConnection" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
( Key
"ReplicationInstanceArn"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
replicationInstanceArn
),
forall a. a -> Maybe a
Prelude.Just (Key
"EndpointArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
endpointArn)
]
)
instance Data.ToPath TestConnection where
toPath :: TestConnection -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery TestConnection where
toQuery :: TestConnection -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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. 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'
{ $sel:connection:TestConnectionResponse' :: Maybe Connection
connection =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:TestConnectionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
testConnectionResponse_connection :: Lens.Lens' TestConnectionResponse (Prelude.Maybe Connection)
testConnectionResponse_connection :: Lens' TestConnectionResponse (Maybe Connection)
testConnectionResponse_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 :: Lens' TestConnectionResponse Int
testConnectionResponse_httpStatus = 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 where
rnf :: TestConnectionResponse -> ()
rnf TestConnectionResponse' {Int
Maybe Connection
httpStatus :: Int
connection :: Maybe Connection
$sel:httpStatus:TestConnectionResponse' :: TestConnectionResponse -> Int
$sel:connection:TestConnectionResponse' :: TestConnectionResponse -> Maybe Connection
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Connection
connection
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus