{-# 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.CreateThingType
(
createThingType
, CreateThingType
, cttThingTypeProperties
, cttThingTypeName
, createThingTypeResponse
, CreateThingTypeResponse
, cttrsThingTypeName
, cttrsThingTypeId
, cttrsThingTypeARN
, cttrsResponseStatus
) 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 CreateThingType = CreateThingType'
{ _cttThingTypeProperties :: !(Maybe ThingTypeProperties)
, _cttThingTypeName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createThingType
:: Text
-> CreateThingType
createThingType pThingTypeName_ =
CreateThingType'
{_cttThingTypeProperties = Nothing, _cttThingTypeName = pThingTypeName_}
cttThingTypeProperties :: Lens' CreateThingType (Maybe ThingTypeProperties)
cttThingTypeProperties = lens _cttThingTypeProperties (\ s a -> s{_cttThingTypeProperties = a})
cttThingTypeName :: Lens' CreateThingType Text
cttThingTypeName = lens _cttThingTypeName (\ s a -> s{_cttThingTypeName = a})
instance AWSRequest CreateThingType where
type Rs CreateThingType = CreateThingTypeResponse
request = postJSON ioT
response
= receiveJSON
(\ s h x ->
CreateThingTypeResponse' <$>
(x .?> "thingTypeName") <*> (x .?> "thingTypeId") <*>
(x .?> "thingTypeArn")
<*> (pure (fromEnum s)))
instance Hashable CreateThingType where
instance NFData CreateThingType where
instance ToHeaders CreateThingType where
toHeaders = const mempty
instance ToJSON CreateThingType where
toJSON CreateThingType'{..}
= object
(catMaybes
[("thingTypeProperties" .=) <$>
_cttThingTypeProperties])
instance ToPath CreateThingType where
toPath CreateThingType'{..}
= mconcat ["/thing-types/", toBS _cttThingTypeName]
instance ToQuery CreateThingType where
toQuery = const mempty
data CreateThingTypeResponse = CreateThingTypeResponse'
{ _cttrsThingTypeName :: !(Maybe Text)
, _cttrsThingTypeId :: !(Maybe Text)
, _cttrsThingTypeARN :: !(Maybe Text)
, _cttrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createThingTypeResponse
:: Int
-> CreateThingTypeResponse
createThingTypeResponse pResponseStatus_ =
CreateThingTypeResponse'
{ _cttrsThingTypeName = Nothing
, _cttrsThingTypeId = Nothing
, _cttrsThingTypeARN = Nothing
, _cttrsResponseStatus = pResponseStatus_
}
cttrsThingTypeName :: Lens' CreateThingTypeResponse (Maybe Text)
cttrsThingTypeName = lens _cttrsThingTypeName (\ s a -> s{_cttrsThingTypeName = a})
cttrsThingTypeId :: Lens' CreateThingTypeResponse (Maybe Text)
cttrsThingTypeId = lens _cttrsThingTypeId (\ s a -> s{_cttrsThingTypeId = a})
cttrsThingTypeARN :: Lens' CreateThingTypeResponse (Maybe Text)
cttrsThingTypeARN = lens _cttrsThingTypeARN (\ s a -> s{_cttrsThingTypeARN = a})
cttrsResponseStatus :: Lens' CreateThingTypeResponse Int
cttrsResponseStatus = lens _cttrsResponseStatus (\ s a -> s{_cttrsResponseStatus = a})
instance NFData CreateThingTypeResponse where