{-# 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.Rekognition.ListStreamProcessors
(
listStreamProcessors
, ListStreamProcessors
, lspNextToken
, lspMaxResults
, listStreamProcessorsResponse
, ListStreamProcessorsResponse
, lsprsStreamProcessors
, lsprsNextToken
, lsprsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Pager
import Network.AWS.Prelude
import Network.AWS.Rekognition.Types
import Network.AWS.Rekognition.Types.Product
import Network.AWS.Request
import Network.AWS.Response
data ListStreamProcessors = ListStreamProcessors'
{ _lspNextToken :: !(Maybe Text)
, _lspMaxResults :: !(Maybe Nat)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listStreamProcessors
:: ListStreamProcessors
listStreamProcessors =
ListStreamProcessors' {_lspNextToken = Nothing, _lspMaxResults = Nothing}
lspNextToken :: Lens' ListStreamProcessors (Maybe Text)
lspNextToken = lens _lspNextToken (\ s a -> s{_lspNextToken = a})
lspMaxResults :: Lens' ListStreamProcessors (Maybe Natural)
lspMaxResults = lens _lspMaxResults (\ s a -> s{_lspMaxResults = a}) . mapping _Nat
instance AWSPager ListStreamProcessors where
page rq rs
| stop (rs ^. lsprsNextToken) = Nothing
| stop (rs ^. lsprsStreamProcessors) = Nothing
| otherwise =
Just $ rq & lspNextToken .~ rs ^. lsprsNextToken
instance AWSRequest ListStreamProcessors where
type Rs ListStreamProcessors =
ListStreamProcessorsResponse
request = postJSON rekognition
response
= receiveJSON
(\ s h x ->
ListStreamProcessorsResponse' <$>
(x .?> "StreamProcessors" .!@ mempty) <*>
(x .?> "NextToken")
<*> (pure (fromEnum s)))
instance Hashable ListStreamProcessors where
instance NFData ListStreamProcessors where
instance ToHeaders ListStreamProcessors where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("RekognitionService.ListStreamProcessors" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListStreamProcessors where
toJSON ListStreamProcessors'{..}
= object
(catMaybes
[("NextToken" .=) <$> _lspNextToken,
("MaxResults" .=) <$> _lspMaxResults])
instance ToPath ListStreamProcessors where
toPath = const "/"
instance ToQuery ListStreamProcessors where
toQuery = const mempty
data ListStreamProcessorsResponse = ListStreamProcessorsResponse'
{ _lsprsStreamProcessors :: !(Maybe [StreamProcessor])
, _lsprsNextToken :: !(Maybe Text)
, _lsprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
listStreamProcessorsResponse
:: Int
-> ListStreamProcessorsResponse
listStreamProcessorsResponse pResponseStatus_ =
ListStreamProcessorsResponse'
{ _lsprsStreamProcessors = Nothing
, _lsprsNextToken = Nothing
, _lsprsResponseStatus = pResponseStatus_
}
lsprsStreamProcessors :: Lens' ListStreamProcessorsResponse [StreamProcessor]
lsprsStreamProcessors = lens _lsprsStreamProcessors (\ s a -> s{_lsprsStreamProcessors = a}) . _Default . _Coerce
lsprsNextToken :: Lens' ListStreamProcessorsResponse (Maybe Text)
lsprsNextToken = lens _lsprsNextToken (\ s a -> s{_lsprsNextToken = a})
lsprsResponseStatus :: Lens' ListStreamProcessorsResponse Int
lsprsResponseStatus = lens _lsprsResponseStatus (\ s a -> s{_lsprsResponseStatus = a})
instance NFData ListStreamProcessorsResponse where