{-# 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.UpdateThingShadow
(
updateThingShadow
, UpdateThingShadow
, utsThingName
, utsPayload
, updateThingShadowResponse
, UpdateThingShadowResponse
, utsrsPayload
, utsrsResponseStatus
) 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
data UpdateThingShadow = UpdateThingShadow'
{ _utsThingName :: !Text
, _utsPayload :: !ByteString
} deriving (Eq, Show, Data, Typeable, Generic)
updateThingShadow
:: Text
-> ByteString
-> UpdateThingShadow
updateThingShadow pThingName_ pPayload_ =
UpdateThingShadow' {_utsThingName = pThingName_, _utsPayload = pPayload_}
utsThingName :: Lens' UpdateThingShadow Text
utsThingName = lens _utsThingName (\ s a -> s{_utsThingName = a})
utsPayload :: Lens' UpdateThingShadow ByteString
utsPayload = lens _utsPayload (\ s a -> s{_utsPayload = a})
instance AWSRequest UpdateThingShadow where
type Rs UpdateThingShadow = UpdateThingShadowResponse
request = postBody ioTData
response
= receiveBytes
(\ s h x ->
UpdateThingShadowResponse' <$>
(pure (Just x)) <*> (pure (fromEnum s)))
instance Hashable UpdateThingShadow where
instance NFData UpdateThingShadow where
instance ToBody UpdateThingShadow where
toBody = toBody . _utsPayload
instance ToHeaders UpdateThingShadow where
toHeaders = const mempty
instance ToPath UpdateThingShadow where
toPath UpdateThingShadow'{..}
= mconcat ["/things/", toBS _utsThingName, "/shadow"]
instance ToQuery UpdateThingShadow where
toQuery = const mempty
data UpdateThingShadowResponse = UpdateThingShadowResponse'
{ _utsrsPayload :: !(Maybe ByteString)
, _utsrsResponseStatus :: !Int
} deriving (Eq, Show, Data, Typeable, Generic)
updateThingShadowResponse
:: Int
-> UpdateThingShadowResponse
updateThingShadowResponse pResponseStatus_ =
UpdateThingShadowResponse'
{_utsrsPayload = Nothing, _utsrsResponseStatus = pResponseStatus_}
utsrsPayload :: Lens' UpdateThingShadowResponse (Maybe ByteString)
utsrsPayload = lens _utsrsPayload (\ s a -> s{_utsrsPayload = a})
utsrsResponseStatus :: Lens' UpdateThingShadowResponse Int
utsrsResponseStatus = lens _utsrsResponseStatus (\ s a -> s{_utsrsResponseStatus = a})
instance NFData UpdateThingShadowResponse where