module Network.AWS.IoTDataPlane.GetThingShadow
(
getThingShadow
, GetThingShadow
, gtsThingName
, getThingShadowResponse
, GetThingShadowResponse
, gtsrsPayload
, gtsrsResponseStatus
) where
import Network.AWS.IoTDataPlane.Types
import Network.AWS.IoTDataPlane.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype GetThingShadow = GetThingShadow'
{ _gtsThingName :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getThingShadow
:: Text
-> GetThingShadow
getThingShadow pThingName_ =
GetThingShadow'
{ _gtsThingName = pThingName_
}
gtsThingName :: Lens' GetThingShadow Text
gtsThingName = lens _gtsThingName (\ s a -> s{_gtsThingName = a});
instance AWSRequest GetThingShadow where
type Rs GetThingShadow = GetThingShadowResponse
request = get ioTDataPlane
response
= receiveJSON
(\ s h x ->
GetThingShadowResponse' <$>
(pure (Just x)) <*> (pure (fromEnum s)))
instance Hashable GetThingShadow
instance ToHeaders GetThingShadow where
toHeaders = const mempty
instance ToPath GetThingShadow where
toPath GetThingShadow'{..}
= mconcat ["/things/", toBS _gtsThingName, "/shadow"]
instance ToQuery GetThingShadow where
toQuery = const mempty
data GetThingShadowResponse = GetThingShadowResponse'
{ _gtsrsPayload :: !(Maybe (HashMap Text Value))
, _gtsrsResponseStatus :: !Int
} deriving (Eq,Show,Data,Typeable,Generic)
getThingShadowResponse
:: Int
-> GetThingShadowResponse
getThingShadowResponse pResponseStatus_ =
GetThingShadowResponse'
{ _gtsrsPayload = Nothing
, _gtsrsResponseStatus = pResponseStatus_
}
gtsrsPayload :: Lens' GetThingShadowResponse (Maybe (HashMap Text Value))
gtsrsPayload = lens _gtsrsPayload (\ s a -> s{_gtsrsPayload = a});
gtsrsResponseStatus :: Lens' GetThingShadowResponse Int
gtsrsResponseStatus = lens _gtsrsResponseStatus (\ s a -> s{_gtsrsResponseStatus = a});