module Network.AWS.IoT.ListThingPrincipals
(
listThingPrincipals
, ListThingPrincipals
, ltpThingName
, listThingPrincipalsResponse
, ListThingPrincipalsResponse
, ltprsPrincipals
, ltprsResponseStatus
) 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
newtype ListThingPrincipals = ListThingPrincipals'
{ _ltpThingName :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listThingPrincipals
:: Text
-> ListThingPrincipals
listThingPrincipals pThingName_ =
ListThingPrincipals'
{ _ltpThingName = pThingName_
}
ltpThingName :: Lens' ListThingPrincipals Text
ltpThingName = lens _ltpThingName (\ s a -> s{_ltpThingName = a});
instance AWSRequest ListThingPrincipals where
type Rs ListThingPrincipals =
ListThingPrincipalsResponse
request = get ioT
response
= receiveJSON
(\ s h x ->
ListThingPrincipalsResponse' <$>
(x .?> "principals" .!@ mempty) <*>
(pure (fromEnum s)))
instance Hashable ListThingPrincipals
instance NFData ListThingPrincipals
instance ToHeaders ListThingPrincipals where
toHeaders = const mempty
instance ToPath ListThingPrincipals where
toPath ListThingPrincipals'{..}
= mconcat
["/things/", toBS _ltpThingName, "/principals"]
instance ToQuery ListThingPrincipals where
toQuery = const mempty
data ListThingPrincipalsResponse = ListThingPrincipalsResponse'
{ _ltprsPrincipals :: !(Maybe [Text])
, _ltprsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listThingPrincipalsResponse
:: Int
-> ListThingPrincipalsResponse
listThingPrincipalsResponse pResponseStatus_ =
ListThingPrincipalsResponse'
{ _ltprsPrincipals = Nothing
, _ltprsResponseStatus = pResponseStatus_
}
ltprsPrincipals :: Lens' ListThingPrincipalsResponse [Text]
ltprsPrincipals = lens _ltprsPrincipals (\ s a -> s{_ltprsPrincipals = a}) . _Default . _Coerce;
ltprsResponseStatus :: Lens' ListThingPrincipalsResponse Int
ltprsResponseStatus = lens _ltprsResponseStatus (\ s a -> s{_ltprsResponseStatus = a});
instance NFData ListThingPrincipalsResponse