{-# 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.DynamoDB.DescribeTable
(
describeTable
, DescribeTable
, dTableName
, describeTableResponse
, DescribeTableResponse
, drsTable
, drsResponseStatus
) where
import Network.AWS.DynamoDB.Types
import Network.AWS.DynamoDB.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype DescribeTable = DescribeTable'
{ _dTableName :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeTable
:: Text
-> DescribeTable
describeTable pTableName_ = DescribeTable' {_dTableName = pTableName_}
dTableName :: Lens' DescribeTable Text
dTableName = lens _dTableName (\ s a -> s{_dTableName = a})
instance AWSRequest DescribeTable where
type Rs DescribeTable = DescribeTableResponse
request = postJSON dynamoDB
response
= receiveJSON
(\ s h x ->
DescribeTableResponse' <$>
(x .?> "Table") <*> (pure (fromEnum s)))
instance Hashable DescribeTable where
instance NFData DescribeTable where
instance ToHeaders DescribeTable where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DynamoDB_20120810.DescribeTable" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.0" :: ByteString)])
instance ToJSON DescribeTable where
toJSON DescribeTable'{..}
= object
(catMaybes [Just ("TableName" .= _dTableName)])
instance ToPath DescribeTable where
toPath = const "/"
instance ToQuery DescribeTable where
toQuery = const mempty
data DescribeTableResponse = DescribeTableResponse'
{ _drsTable :: !(Maybe TableDescription)
, _drsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeTableResponse
:: Int
-> DescribeTableResponse
describeTableResponse pResponseStatus_ =
DescribeTableResponse'
{_drsTable = Nothing, _drsResponseStatus = pResponseStatus_}
drsTable :: Lens' DescribeTableResponse (Maybe TableDescription)
drsTable = lens _drsTable (\ s a -> s{_drsTable = a})
drsResponseStatus :: Lens' DescribeTableResponse Int
drsResponseStatus = lens _drsResponseStatus (\ s a -> s{_drsResponseStatus = a})
instance NFData DescribeTableResponse where