{-# 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.GetTable
(
getTable
, GetTable
, gttCatalogId
, gttDatabaseName
, gttName
, getTableResponse
, GetTableResponse
, ggrsTable
, ggrsResponseStatus
) 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 GetTable = GetTable'
{ _gttCatalogId :: !(Maybe Text)
, _gttDatabaseName :: !Text
, _gttName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getTable
:: Text
-> Text
-> GetTable
getTable pDatabaseName_ pName_ =
GetTable'
{ _gttCatalogId = Nothing
, _gttDatabaseName = pDatabaseName_
, _gttName = pName_
}
gttCatalogId :: Lens' GetTable (Maybe Text)
gttCatalogId = lens _gttCatalogId (\ s a -> s{_gttCatalogId = a})
gttDatabaseName :: Lens' GetTable Text
gttDatabaseName = lens _gttDatabaseName (\ s a -> s{_gttDatabaseName = a})
gttName :: Lens' GetTable Text
gttName = lens _gttName (\ s a -> s{_gttName = a})
instance AWSRequest GetTable where
type Rs GetTable = GetTableResponse
request = postJSON glue
response
= receiveJSON
(\ s h x ->
GetTableResponse' <$>
(x .?> "Table") <*> (pure (fromEnum s)))
instance Hashable GetTable where
instance NFData GetTable where
instance ToHeaders GetTable where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSGlue.GetTable" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetTable where
toJSON GetTable'{..}
= object
(catMaybes
[("CatalogId" .=) <$> _gttCatalogId,
Just ("DatabaseName" .= _gttDatabaseName),
Just ("Name" .= _gttName)])
instance ToPath GetTable where
toPath = const "/"
instance ToQuery GetTable where
toQuery = const mempty
data GetTableResponse = GetTableResponse'
{ _ggrsTable :: !(Maybe Table)
, _ggrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getTableResponse
:: Int
-> GetTableResponse
getTableResponse pResponseStatus_ =
GetTableResponse'
{_ggrsTable = Nothing, _ggrsResponseStatus = pResponseStatus_}
ggrsTable :: Lens' GetTableResponse (Maybe Table)
ggrsTable = lens _ggrsTable (\ s a -> s{_ggrsTable = a})
ggrsResponseStatus :: Lens' GetTableResponse Int
ggrsResponseStatus = lens _ggrsResponseStatus (\ s a -> s{_ggrsResponseStatus = a})
instance NFData GetTableResponse where