{-# 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.GetUserDefinedFunction
(
getUserDefinedFunction
, GetUserDefinedFunction
, getCatalogId
, getDatabaseName
, getFunctionName
, getUserDefinedFunctionResponse
, GetUserDefinedFunctionResponse
, gudfursUserDefinedFunction
, gudfursResponseStatus
) 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 GetUserDefinedFunction = GetUserDefinedFunction'
{ _getCatalogId :: !(Maybe Text)
, _getDatabaseName :: !Text
, _getFunctionName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getUserDefinedFunction
:: Text
-> Text
-> GetUserDefinedFunction
getUserDefinedFunction pDatabaseName_ pFunctionName_ =
GetUserDefinedFunction'
{ _getCatalogId = Nothing
, _getDatabaseName = pDatabaseName_
, _getFunctionName = pFunctionName_
}
getCatalogId :: Lens' GetUserDefinedFunction (Maybe Text)
getCatalogId = lens _getCatalogId (\ s a -> s{_getCatalogId = a})
getDatabaseName :: Lens' GetUserDefinedFunction Text
getDatabaseName = lens _getDatabaseName (\ s a -> s{_getDatabaseName = a})
getFunctionName :: Lens' GetUserDefinedFunction Text
getFunctionName = lens _getFunctionName (\ s a -> s{_getFunctionName = a})
instance AWSRequest GetUserDefinedFunction where
type Rs GetUserDefinedFunction =
GetUserDefinedFunctionResponse
request = postJSON glue
response
= receiveJSON
(\ s h x ->
GetUserDefinedFunctionResponse' <$>
(x .?> "UserDefinedFunction") <*>
(pure (fromEnum s)))
instance Hashable GetUserDefinedFunction where
instance NFData GetUserDefinedFunction where
instance ToHeaders GetUserDefinedFunction where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSGlue.GetUserDefinedFunction" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetUserDefinedFunction where
toJSON GetUserDefinedFunction'{..}
= object
(catMaybes
[("CatalogId" .=) <$> _getCatalogId,
Just ("DatabaseName" .= _getDatabaseName),
Just ("FunctionName" .= _getFunctionName)])
instance ToPath GetUserDefinedFunction where
toPath = const "/"
instance ToQuery GetUserDefinedFunction where
toQuery = const mempty
data GetUserDefinedFunctionResponse = GetUserDefinedFunctionResponse'
{ _gudfursUserDefinedFunction :: !(Maybe UserDefinedFunction)
, _gudfursResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getUserDefinedFunctionResponse
:: Int
-> GetUserDefinedFunctionResponse
getUserDefinedFunctionResponse pResponseStatus_ =
GetUserDefinedFunctionResponse'
{ _gudfursUserDefinedFunction = Nothing
, _gudfursResponseStatus = pResponseStatus_
}
gudfursUserDefinedFunction :: Lens' GetUserDefinedFunctionResponse (Maybe UserDefinedFunction)
gudfursUserDefinedFunction = lens _gudfursUserDefinedFunction (\ s a -> s{_gudfursUserDefinedFunction = a})
gudfursResponseStatus :: Lens' GetUserDefinedFunctionResponse Int
gudfursResponseStatus = lens _gudfursResponseStatus (\ s a -> s{_gudfursResponseStatus = a})
instance NFData GetUserDefinedFunctionResponse where