{-# 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.IoT.UpdateThing
(
updateThing
, UpdateThing
, utRemoveThingType
, utThingTypeName
, utExpectedVersion
, utAttributePayload
, utThingName
, updateThingResponse
, UpdateThingResponse
, utrsResponseStatus
) 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
data UpdateThing = UpdateThing'
{ _utRemoveThingType :: !(Maybe Bool)
, _utThingTypeName :: !(Maybe Text)
, _utExpectedVersion :: !(Maybe Integer)
, _utAttributePayload :: !(Maybe AttributePayload)
, _utThingName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateThing
:: Text
-> UpdateThing
updateThing pThingName_ =
UpdateThing'
{ _utRemoveThingType = Nothing
, _utThingTypeName = Nothing
, _utExpectedVersion = Nothing
, _utAttributePayload = Nothing
, _utThingName = pThingName_
}
utRemoveThingType :: Lens' UpdateThing (Maybe Bool)
utRemoveThingType = lens _utRemoveThingType (\ s a -> s{_utRemoveThingType = a})
utThingTypeName :: Lens' UpdateThing (Maybe Text)
utThingTypeName = lens _utThingTypeName (\ s a -> s{_utThingTypeName = a})
utExpectedVersion :: Lens' UpdateThing (Maybe Integer)
utExpectedVersion = lens _utExpectedVersion (\ s a -> s{_utExpectedVersion = a})
utAttributePayload :: Lens' UpdateThing (Maybe AttributePayload)
utAttributePayload = lens _utAttributePayload (\ s a -> s{_utAttributePayload = a})
utThingName :: Lens' UpdateThing Text
utThingName = lens _utThingName (\ s a -> s{_utThingName = a})
instance AWSRequest UpdateThing where
type Rs UpdateThing = UpdateThingResponse
request = patchJSON ioT
response
= receiveEmpty
(\ s h x ->
UpdateThingResponse' <$> (pure (fromEnum s)))
instance Hashable UpdateThing where
instance NFData UpdateThing where
instance ToHeaders UpdateThing where
toHeaders = const mempty
instance ToJSON UpdateThing where
toJSON UpdateThing'{..}
= object
(catMaybes
[("removeThingType" .=) <$> _utRemoveThingType,
("thingTypeName" .=) <$> _utThingTypeName,
("expectedVersion" .=) <$> _utExpectedVersion,
("attributePayload" .=) <$> _utAttributePayload])
instance ToPath UpdateThing where
toPath UpdateThing'{..}
= mconcat ["/things/", toBS _utThingName]
instance ToQuery UpdateThing where
toQuery = const mempty
newtype UpdateThingResponse = UpdateThingResponse'
{ _utrsResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateThingResponse
:: Int
-> UpdateThingResponse
updateThingResponse pResponseStatus_ =
UpdateThingResponse' {_utrsResponseStatus = pResponseStatus_}
utrsResponseStatus :: Lens' UpdateThingResponse Int
utrsResponseStatus = lens _utrsResponseStatus (\ s a -> s{_utrsResponseStatus = a})
instance NFData UpdateThingResponse where