module Network.AWS.IoT.AttachThingPrincipal
(
attachThingPrincipal
, AttachThingPrincipal
, atpThingName
, atpPrincipal
, attachThingPrincipalResponse
, AttachThingPrincipalResponse
, atprsResponseStatus
) 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 AttachThingPrincipal = AttachThingPrincipal'
{ _atpThingName :: !Text
, _atpPrincipal :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
attachThingPrincipal
:: Text
-> Text
-> AttachThingPrincipal
attachThingPrincipal pThingName_ pPrincipal_ =
AttachThingPrincipal'
{ _atpThingName = pThingName_
, _atpPrincipal = pPrincipal_
}
atpThingName :: Lens' AttachThingPrincipal Text
atpThingName = lens _atpThingName (\ s a -> s{_atpThingName = a});
atpPrincipal :: Lens' AttachThingPrincipal Text
atpPrincipal = lens _atpPrincipal (\ s a -> s{_atpPrincipal = a});
instance AWSRequest AttachThingPrincipal where
type Rs AttachThingPrincipal =
AttachThingPrincipalResponse
request = putJSON ioT
response
= receiveEmpty
(\ s h x ->
AttachThingPrincipalResponse' <$>
(pure (fromEnum s)))
instance ToHeaders AttachThingPrincipal where
toHeaders AttachThingPrincipal'{..}
= mconcat ["x-amzn-principal" =# _atpPrincipal]
instance ToJSON AttachThingPrincipal where
toJSON = const (Object mempty)
instance ToPath AttachThingPrincipal where
toPath AttachThingPrincipal'{..}
= mconcat
["/things/", toBS _atpThingName, "/principals"]
instance ToQuery AttachThingPrincipal where
toQuery = const mempty
newtype AttachThingPrincipalResponse = AttachThingPrincipalResponse'
{ _atprsResponseStatus :: Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
attachThingPrincipalResponse
:: Int
-> AttachThingPrincipalResponse
attachThingPrincipalResponse pResponseStatus_ =
AttachThingPrincipalResponse'
{ _atprsResponseStatus = pResponseStatus_
}
atprsResponseStatus :: Lens' AttachThingPrincipalResponse Int
atprsResponseStatus = lens _atprsResponseStatus (\ s a -> s{_atprsResponseStatus = a});