{-# 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.IoTData.GetThingShadow
(
getThingShadow
, GetThingShadow
, gtsThingName
, getThingShadowResponse
, GetThingShadowResponse
, gtsrsPayload
, gtsrsResponseStatus
) where
import Network.AWS.IoTData.Types
import Network.AWS.IoTData.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 ioTData
response
= receiveBytes
(\ s h x ->
GetThingShadowResponse' <$>
(pure (Just x)) <*> (pure (fromEnum s)))
instance Hashable GetThingShadow where
instance NFData GetThingShadow where
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 ByteString)
, _gtsrsResponseStatus :: !Int
} deriving (Eq, Show, Data, Typeable, Generic)
getThingShadowResponse
:: Int
-> GetThingShadowResponse
getThingShadowResponse pResponseStatus_ =
GetThingShadowResponse'
{_gtsrsPayload = Nothing, _gtsrsResponseStatus = pResponseStatus_}
gtsrsPayload :: Lens' GetThingShadowResponse (Maybe ByteString)
gtsrsPayload = lens _gtsrsPayload (\ s a -> s{_gtsrsPayload = a})
gtsrsResponseStatus :: Lens' GetThingShadowResponse Int
gtsrsResponseStatus = lens _gtsrsResponseStatus (\ s a -> s{_gtsrsResponseStatus = a})
instance NFData GetThingShadowResponse where