module Network.AWS.IoT.DescribeThing
(
describeThing
, DescribeThing
, dThingName
, describeThingResponse
, DescribeThingResponse
, dtrsDefaultClientId
, dtrsAttributes
, dtrsThingName
, dtrsResponseStatus
) 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 DescribeThing = DescribeThing'
{ _dThingName :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeThing
:: Text
-> DescribeThing
describeThing pThingName_ =
DescribeThing'
{ _dThingName = pThingName_
}
dThingName :: Lens' DescribeThing Text
dThingName = lens _dThingName (\ s a -> s{_dThingName = a});
instance AWSRequest DescribeThing where
type Rs DescribeThing = DescribeThingResponse
request = get ioT
response
= receiveJSON
(\ s h x ->
DescribeThingResponse' <$>
(x .?> "defaultClientId") <*>
(x .?> "attributes" .!@ mempty)
<*> (x .?> "thingName")
<*> (pure (fromEnum s)))
instance Hashable DescribeThing
instance NFData DescribeThing
instance ToHeaders DescribeThing where
toHeaders = const mempty
instance ToPath DescribeThing where
toPath DescribeThing'{..}
= mconcat ["/things/", toBS _dThingName]
instance ToQuery DescribeThing where
toQuery = const mempty
data DescribeThingResponse = DescribeThingResponse'
{ _dtrsDefaultClientId :: !(Maybe Text)
, _dtrsAttributes :: !(Maybe (Map Text Text))
, _dtrsThingName :: !(Maybe Text)
, _dtrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeThingResponse
:: Int
-> DescribeThingResponse
describeThingResponse pResponseStatus_ =
DescribeThingResponse'
{ _dtrsDefaultClientId = Nothing
, _dtrsAttributes = Nothing
, _dtrsThingName = Nothing
, _dtrsResponseStatus = pResponseStatus_
}
dtrsDefaultClientId :: Lens' DescribeThingResponse (Maybe Text)
dtrsDefaultClientId = lens _dtrsDefaultClientId (\ s a -> s{_dtrsDefaultClientId = a});
dtrsAttributes :: Lens' DescribeThingResponse (HashMap Text Text)
dtrsAttributes = lens _dtrsAttributes (\ s a -> s{_dtrsAttributes = a}) . _Default . _Map;
dtrsThingName :: Lens' DescribeThingResponse (Maybe Text)
dtrsThingName = lens _dtrsThingName (\ s a -> s{_dtrsThingName = a});
dtrsResponseStatus :: Lens' DescribeThingResponse Int
dtrsResponseStatus = lens _dtrsResponseStatus (\ s a -> s{_dtrsResponseStatus = a});
instance NFData DescribeThingResponse