module Network.AWS.IoT.ListPrincipalThings
(
listPrincipalThings
, ListPrincipalThings
, lptNextToken
, lptMaxResults
, lptPrincipal
, listPrincipalThingsResponse
, ListPrincipalThingsResponse
, lptrsNextToken
, lptrsThings
, lptrsResponseStatus
) where
import Network.AWS.IoT.Types
import Network.AWS.IoT.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListPrincipalThings = ListPrincipalThings'
{ _lptNextToken :: !(Maybe Text)
, _lptMaxResults :: !(Maybe Nat)
, _lptPrincipal :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listPrincipalThings
:: Text
-> ListPrincipalThings
listPrincipalThings pPrincipal_ =
ListPrincipalThings'
{ _lptNextToken = Nothing
, _lptMaxResults = Nothing
, _lptPrincipal = pPrincipal_
}
lptNextToken :: Lens' ListPrincipalThings (Maybe Text)
lptNextToken = lens _lptNextToken (\ s a -> s{_lptNextToken = a});
lptMaxResults :: Lens' ListPrincipalThings (Maybe Natural)
lptMaxResults = lens _lptMaxResults (\ s a -> s{_lptMaxResults = a}) . mapping _Nat;
lptPrincipal :: Lens' ListPrincipalThings Text
lptPrincipal = lens _lptPrincipal (\ s a -> s{_lptPrincipal = a});
instance AWSRequest ListPrincipalThings where
type Rs ListPrincipalThings =
ListPrincipalThingsResponse
request = get ioT
response
= receiveJSON
(\ s h x ->
ListPrincipalThingsResponse' <$>
(x .?> "nextToken") <*> (x .?> "things" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable ListPrincipalThings
instance NFData ListPrincipalThings
instance ToHeaders ListPrincipalThings where
toHeaders ListPrincipalThings'{..}
= mconcat ["x-amzn-principal" =# _lptPrincipal]
instance ToPath ListPrincipalThings where
toPath = const "/principals/things"
instance ToQuery ListPrincipalThings where
toQuery ListPrincipalThings'{..}
= mconcat
["nextToken" =: _lptNextToken,
"maxResults" =: _lptMaxResults]
data ListPrincipalThingsResponse = ListPrincipalThingsResponse'
{ _lptrsNextToken :: !(Maybe Text)
, _lptrsThings :: !(Maybe [Text])
, _lptrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listPrincipalThingsResponse
:: Int
-> ListPrincipalThingsResponse
listPrincipalThingsResponse pResponseStatus_ =
ListPrincipalThingsResponse'
{ _lptrsNextToken = Nothing
, _lptrsThings = Nothing
, _lptrsResponseStatus = pResponseStatus_
}
lptrsNextToken :: Lens' ListPrincipalThingsResponse (Maybe Text)
lptrsNextToken = lens _lptrsNextToken (\ s a -> s{_lptrsNextToken = a});
lptrsThings :: Lens' ListPrincipalThingsResponse [Text]
lptrsThings = lens _lptrsThings (\ s a -> s{_lptrsThings = a}) . _Default . _Coerce;
lptrsResponseStatus :: Lens' ListPrincipalThingsResponse Int
lptrsResponseStatus = lens _lptrsResponseStatus (\ s a -> s{_lptrsResponseStatus = a});
instance NFData ListPrincipalThingsResponse