{-# 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.IoT.ListThingTypes
(
listThingTypes
, ListThingTypes
, lttThingTypeName
, lttNextToken
, lttMaxResults
, listThingTypesResponse
, ListThingTypesResponse
, lttrsThingTypes
, lttrsNextToken
, lttrsResponseStatus
) 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 ListThingTypes = ListThingTypes'
{ _lttThingTypeName :: !(Maybe Text)
, _lttNextToken :: !(Maybe Text)
, _lttMaxResults :: !(Maybe Nat)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listThingTypes
:: ListThingTypes
listThingTypes =
ListThingTypes'
{ _lttThingTypeName = Nothing
, _lttNextToken = Nothing
, _lttMaxResults = Nothing
}
lttThingTypeName :: Lens' ListThingTypes (Maybe Text)
lttThingTypeName = lens _lttThingTypeName (\ s a -> s{_lttThingTypeName = a});
lttNextToken :: Lens' ListThingTypes (Maybe Text)
lttNextToken = lens _lttNextToken (\ s a -> s{_lttNextToken = a});
lttMaxResults :: Lens' ListThingTypes (Maybe Natural)
lttMaxResults = lens _lttMaxResults (\ s a -> s{_lttMaxResults = a}) . mapping _Nat;
instance AWSRequest ListThingTypes where
type Rs ListThingTypes = ListThingTypesResponse
request = get ioT
response
= receiveJSON
(\ s h x ->
ListThingTypesResponse' <$>
(x .?> "thingTypes" .!@ mempty) <*>
(x .?> "nextToken")
<*> (pure (fromEnum s)))
instance Hashable ListThingTypes
instance NFData ListThingTypes
instance ToHeaders ListThingTypes where
toHeaders = const mempty
instance ToPath ListThingTypes where
toPath = const "/thing-types"
instance ToQuery ListThingTypes where
toQuery ListThingTypes'{..}
= mconcat
["thingTypeName" =: _lttThingTypeName,
"nextToken" =: _lttNextToken,
"maxResults" =: _lttMaxResults]
data ListThingTypesResponse = ListThingTypesResponse'
{ _lttrsThingTypes :: !(Maybe [ThingTypeDefinition])
, _lttrsNextToken :: !(Maybe Text)
, _lttrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listThingTypesResponse
:: Int
-> ListThingTypesResponse
listThingTypesResponse pResponseStatus_ =
ListThingTypesResponse'
{ _lttrsThingTypes = Nothing
, _lttrsNextToken = Nothing
, _lttrsResponseStatus = pResponseStatus_
}
lttrsThingTypes :: Lens' ListThingTypesResponse [ThingTypeDefinition]
lttrsThingTypes = lens _lttrsThingTypes (\ s a -> s{_lttrsThingTypes = a}) . _Default . _Coerce;
lttrsNextToken :: Lens' ListThingTypesResponse (Maybe Text)
lttrsNextToken = lens _lttrsNextToken (\ s a -> s{_lttrsNextToken = a});
lttrsResponseStatus :: Lens' ListThingTypesResponse Int
lttrsResponseStatus = lens _lttrsResponseStatus (\ s a -> s{_lttrsResponseStatus = a});
instance NFData ListThingTypesResponse