module Network.AWS.DynamoDBStreams.ListStreams
(
listStreams
, ListStreams
, lsExclusiveStartStreamARN
, lsLimit
, lsTableName
, listStreamsResponse
, ListStreamsResponse
, lsrsLastEvaluatedStreamARN
, lsrsStreams
, lsrsResponseStatus
) where
import Network.AWS.DynamoDBStreams.Types
import Network.AWS.DynamoDBStreams.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListStreams = ListStreams'
{ _lsExclusiveStartStreamARN :: !(Maybe Text)
, _lsLimit :: !(Maybe Nat)
, _lsTableName :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listStreams
:: ListStreams
listStreams =
ListStreams'
{ _lsExclusiveStartStreamARN = Nothing
, _lsLimit = Nothing
, _lsTableName = Nothing
}
lsExclusiveStartStreamARN :: Lens' ListStreams (Maybe Text)
lsExclusiveStartStreamARN = lens _lsExclusiveStartStreamARN (\ s a -> s{_lsExclusiveStartStreamARN = a});
lsLimit :: Lens' ListStreams (Maybe Natural)
lsLimit = lens _lsLimit (\ s a -> s{_lsLimit = a}) . mapping _Nat;
lsTableName :: Lens' ListStreams (Maybe Text)
lsTableName = lens _lsTableName (\ s a -> s{_lsTableName = a});
instance AWSRequest ListStreams where
type Rs ListStreams = ListStreamsResponse
request = postJSON dynamoDBStreams
response
= receiveJSON
(\ s h x ->
ListStreamsResponse' <$>
(x .?> "LastEvaluatedStreamArn") <*>
(x .?> "Streams" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable ListStreams
instance ToHeaders ListStreams where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("DynamoDBStreams_20120810.ListStreams" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.0" :: ByteString)])
instance ToJSON ListStreams where
toJSON ListStreams'{..}
= object
(catMaybes
[("ExclusiveStartStreamArn" .=) <$>
_lsExclusiveStartStreamARN,
("Limit" .=) <$> _lsLimit,
("TableName" .=) <$> _lsTableName])
instance ToPath ListStreams where
toPath = const "/"
instance ToQuery ListStreams where
toQuery = const mempty
data ListStreamsResponse = ListStreamsResponse'
{ _lsrsLastEvaluatedStreamARN :: !(Maybe Text)
, _lsrsStreams :: !(Maybe [Stream])
, _lsrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listStreamsResponse
:: Int
-> ListStreamsResponse
listStreamsResponse pResponseStatus_ =
ListStreamsResponse'
{ _lsrsLastEvaluatedStreamARN = Nothing
, _lsrsStreams = Nothing
, _lsrsResponseStatus = pResponseStatus_
}
lsrsLastEvaluatedStreamARN :: Lens' ListStreamsResponse (Maybe Text)
lsrsLastEvaluatedStreamARN = lens _lsrsLastEvaluatedStreamARN (\ s a -> s{_lsrsLastEvaluatedStreamARN = a});
lsrsStreams :: Lens' ListStreamsResponse [Stream]
lsrsStreams = lens _lsrsStreams (\ s a -> s{_lsrsStreams = a}) . _Default . _Coerce;
lsrsResponseStatus :: Lens' ListStreamsResponse Int
lsrsResponseStatus = lens _lsrsResponseStatus (\ s a -> s{_lsrsResponseStatus = a});