{-# 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.ListGlobalTables
(
listGlobalTables
, ListGlobalTables
, lgtRegionName
, lgtExclusiveStartGlobalTableName
, lgtLimit
, listGlobalTablesResponse
, ListGlobalTablesResponse
, lgtrsLastEvaluatedGlobalTableName
, lgtrsGlobalTables
, lgtrsResponseStatus
) 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
data ListGlobalTables = ListGlobalTables'
{ _lgtRegionName :: !(Maybe Text)
, _lgtExclusiveStartGlobalTableName :: !(Maybe Text)
, _lgtLimit :: !(Maybe Nat)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listGlobalTables
:: ListGlobalTables
listGlobalTables =
ListGlobalTables'
{ _lgtRegionName = Nothing
, _lgtExclusiveStartGlobalTableName = Nothing
, _lgtLimit = Nothing
}
lgtRegionName :: Lens' ListGlobalTables (Maybe Text)
lgtRegionName = lens _lgtRegionName (\ s a -> s{_lgtRegionName = a})
lgtExclusiveStartGlobalTableName :: Lens' ListGlobalTables (Maybe Text)
lgtExclusiveStartGlobalTableName = lens _lgtExclusiveStartGlobalTableName (\ s a -> s{_lgtExclusiveStartGlobalTableName = a})
lgtLimit :: Lens' ListGlobalTables (Maybe Natural)
lgtLimit = lens _lgtLimit (\ s a -> s{_lgtLimit = a}) . mapping _Nat
instance AWSRequest ListGlobalTables where
type Rs ListGlobalTables = ListGlobalTablesResponse
request = postJSON dynamoDB
response
= receiveJSON
(\ s h x ->
ListGlobalTablesResponse' <$>
(x .?> "LastEvaluatedGlobalTableName") <*>
(x .?> "GlobalTables" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable ListGlobalTables where
instance NFData ListGlobalTables where
instance ToHeaders ListGlobalTables where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DynamoDB_20120810.ListGlobalTables" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.0" :: ByteString)])
instance ToJSON ListGlobalTables where
toJSON ListGlobalTables'{..}
= object
(catMaybes
[("RegionName" .=) <$> _lgtRegionName,
("ExclusiveStartGlobalTableName" .=) <$>
_lgtExclusiveStartGlobalTableName,
("Limit" .=) <$> _lgtLimit])
instance ToPath ListGlobalTables where
toPath = const "/"
instance ToQuery ListGlobalTables where
toQuery = const mempty
data ListGlobalTablesResponse = ListGlobalTablesResponse'
{ _lgtrsLastEvaluatedGlobalTableName :: !(Maybe Text)
, _lgtrsGlobalTables :: !(Maybe [GlobalTable])
, _lgtrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listGlobalTablesResponse
:: Int
-> ListGlobalTablesResponse
listGlobalTablesResponse pResponseStatus_ =
ListGlobalTablesResponse'
{ _lgtrsLastEvaluatedGlobalTableName = Nothing
, _lgtrsGlobalTables = Nothing
, _lgtrsResponseStatus = pResponseStatus_
}
lgtrsLastEvaluatedGlobalTableName :: Lens' ListGlobalTablesResponse (Maybe Text)
lgtrsLastEvaluatedGlobalTableName = lens _lgtrsLastEvaluatedGlobalTableName (\ s a -> s{_lgtrsLastEvaluatedGlobalTableName = a})
lgtrsGlobalTables :: Lens' ListGlobalTablesResponse [GlobalTable]
lgtrsGlobalTables = lens _lgtrsGlobalTables (\ s a -> s{_lgtrsGlobalTables = a}) . _Default . _Coerce
lgtrsResponseStatus :: Lens' ListGlobalTablesResponse Int
lgtrsResponseStatus = lens _lgtrsResponseStatus (\ s a -> s{_lgtrsResponseStatus = a})
instance NFData ListGlobalTablesResponse where