{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.DMS.TestConnection
(
testConnection
, TestConnection
, tcReplicationInstanceARN
, tcEndpointARN
, testConnectionResponse
, TestConnectionResponse
, tcrsConnection
, tcrsResponseStatus
) where
import Network.AWS.DMS.Types
import Network.AWS.DMS.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data TestConnection = TestConnection'
{ _tcReplicationInstanceARN :: !Text
, _tcEndpointARN :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
testConnection
:: Text
-> Text
-> TestConnection
testConnection pReplicationInstanceARN_ pEndpointARN_ =
TestConnection'
{ _tcReplicationInstanceARN = pReplicationInstanceARN_
, _tcEndpointARN = pEndpointARN_
}
tcReplicationInstanceARN :: Lens' TestConnection Text
tcReplicationInstanceARN = lens _tcReplicationInstanceARN (\ s a -> s{_tcReplicationInstanceARN = a})
tcEndpointARN :: Lens' TestConnection Text
tcEndpointARN = lens _tcEndpointARN (\ s a -> s{_tcEndpointARN = a})
instance AWSRequest TestConnection where
type Rs TestConnection = TestConnectionResponse
request = postJSON dms
response
= receiveJSON
(\ s h x ->
TestConnectionResponse' <$>
(x .?> "Connection") <*> (pure (fromEnum s)))
instance Hashable TestConnection where
instance NFData TestConnection where
instance ToHeaders TestConnection where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonDMSv20160101.TestConnection" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON TestConnection where
toJSON TestConnection'{..}
= object
(catMaybes
[Just
("ReplicationInstanceArn" .=
_tcReplicationInstanceARN),
Just ("EndpointArn" .= _tcEndpointARN)])
instance ToPath TestConnection where
toPath = const "/"
instance ToQuery TestConnection where
toQuery = const mempty
data TestConnectionResponse = TestConnectionResponse'
{ _tcrsConnection :: !(Maybe Connection)
, _tcrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
testConnectionResponse
:: Int
-> TestConnectionResponse
testConnectionResponse pResponseStatus_ =
TestConnectionResponse'
{_tcrsConnection = Nothing, _tcrsResponseStatus = pResponseStatus_}
tcrsConnection :: Lens' TestConnectionResponse (Maybe Connection)
tcrsConnection = lens _tcrsConnection (\ s a -> s{_tcrsConnection = a})
tcrsResponseStatus :: Lens' TestConnectionResponse Int
tcrsResponseStatus = lens _tcrsResponseStatus (\ s a -> s{_tcrsResponseStatus = a})
instance NFData TestConnectionResponse where