{-# 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.Glue.GetConnection
(
getConnection
, GetConnection
, gCatalogId
, gName
, getConnectionResponse
, GetConnectionResponse
, getrsConnection
, getrsResponseStatus
) where
import Network.AWS.Glue.Types
import Network.AWS.Glue.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetConnection = GetConnection'
{ _gCatalogId :: !(Maybe Text)
, _gName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getConnection
:: Text
-> GetConnection
getConnection pName_ = GetConnection' {_gCatalogId = Nothing, _gName = pName_}
gCatalogId :: Lens' GetConnection (Maybe Text)
gCatalogId = lens _gCatalogId (\ s a -> s{_gCatalogId = a})
gName :: Lens' GetConnection Text
gName = lens _gName (\ s a -> s{_gName = a})
instance AWSRequest GetConnection where
type Rs GetConnection = GetConnectionResponse
request = postJSON glue
response
= receiveJSON
(\ s h x ->
GetConnectionResponse' <$>
(x .?> "Connection") <*> (pure (fromEnum s)))
instance Hashable GetConnection where
instance NFData GetConnection where
instance ToHeaders GetConnection where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSGlue.GetConnection" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetConnection where
toJSON GetConnection'{..}
= object
(catMaybes
[("CatalogId" .=) <$> _gCatalogId,
Just ("Name" .= _gName)])
instance ToPath GetConnection where
toPath = const "/"
instance ToQuery GetConnection where
toQuery = const mempty
data GetConnectionResponse = GetConnectionResponse'
{ _getrsConnection :: !(Maybe Connection)
, _getrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getConnectionResponse
:: Int
-> GetConnectionResponse
getConnectionResponse pResponseStatus_ =
GetConnectionResponse'
{_getrsConnection = Nothing, _getrsResponseStatus = pResponseStatus_}
getrsConnection :: Lens' GetConnectionResponse (Maybe Connection)
getrsConnection = lens _getrsConnection (\ s a -> s{_getrsConnection = a})
getrsResponseStatus :: Lens' GetConnectionResponse Int
getrsResponseStatus = lens _getrsResponseStatus (\ s a -> s{_getrsResponseStatus = a})
instance NFData GetConnectionResponse where