module Network.AWS.IoT.ListThings
(
listThings
, ListThings
, ltAttributeValue
, ltNextToken
, ltAttributeName
, ltMaxResults
, listThingsResponse
, ListThingsResponse
, ltrsNextToken
, ltrsThings
, ltrsResponseStatus
) 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 ListThings = ListThings'
{ _ltAttributeValue :: !(Maybe Text)
, _ltNextToken :: !(Maybe Text)
, _ltAttributeName :: !(Maybe Text)
, _ltMaxResults :: !(Maybe Nat)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listThings
:: ListThings
listThings =
ListThings'
{ _ltAttributeValue = Nothing
, _ltNextToken = Nothing
, _ltAttributeName = Nothing
, _ltMaxResults = Nothing
}
ltAttributeValue :: Lens' ListThings (Maybe Text)
ltAttributeValue = lens _ltAttributeValue (\ s a -> s{_ltAttributeValue = a});
ltNextToken :: Lens' ListThings (Maybe Text)
ltNextToken = lens _ltNextToken (\ s a -> s{_ltNextToken = a});
ltAttributeName :: Lens' ListThings (Maybe Text)
ltAttributeName = lens _ltAttributeName (\ s a -> s{_ltAttributeName = a});
ltMaxResults :: Lens' ListThings (Maybe Natural)
ltMaxResults = lens _ltMaxResults (\ s a -> s{_ltMaxResults = a}) . mapping _Nat;
instance AWSRequest ListThings where
type Rs ListThings = ListThingsResponse
request = get ioT
response
= receiveJSON
(\ s h x ->
ListThingsResponse' <$>
(x .?> "nextToken") <*> (x .?> "things" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable ListThings
instance NFData ListThings
instance ToHeaders ListThings where
toHeaders = const mempty
instance ToPath ListThings where
toPath = const "/things"
instance ToQuery ListThings where
toQuery ListThings'{..}
= mconcat
["attributeValue" =: _ltAttributeValue,
"nextToken" =: _ltNextToken,
"attributeName" =: _ltAttributeName,
"maxResults" =: _ltMaxResults]
data ListThingsResponse = ListThingsResponse'
{ _ltrsNextToken :: !(Maybe Text)
, _ltrsThings :: !(Maybe [ThingAttribute])
, _ltrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listThingsResponse
:: Int
-> ListThingsResponse
listThingsResponse pResponseStatus_ =
ListThingsResponse'
{ _ltrsNextToken = Nothing
, _ltrsThings = Nothing
, _ltrsResponseStatus = pResponseStatus_
}
ltrsNextToken :: Lens' ListThingsResponse (Maybe Text)
ltrsNextToken = lens _ltrsNextToken (\ s a -> s{_ltrsNextToken = a});
ltrsThings :: Lens' ListThingsResponse [ThingAttribute]
ltrsThings = lens _ltrsThings (\ s a -> s{_ltrsThings = a}) . _Default . _Coerce;
ltrsResponseStatus :: Lens' ListThingsResponse Int
ltrsResponseStatus = lens _ltrsResponseStatus (\ s a -> s{_ltrsResponseStatus = a});
instance NFData ListThingsResponse