module Network.AWS.APIGateway.CreateModel
(
createModel
, CreateModel
, cmSchema
, cmDescription
, cmRestAPIId
, cmName
, cmContentType
, model
, Model
, mSchema
, mName
, mId
, mDescription
, mContentType
) where
import Network.AWS.APIGateway.Types
import Network.AWS.APIGateway.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateModel = CreateModel'
{ _cmSchema :: !(Maybe Text)
, _cmDescription :: !(Maybe Text)
, _cmRestAPIId :: !Text
, _cmName :: !Text
, _cmContentType :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createModel
:: Text
-> Text
-> Text
-> CreateModel
createModel pRestAPIId_ pName_ pContentType_ =
CreateModel'
{ _cmSchema = Nothing
, _cmDescription = Nothing
, _cmRestAPIId = pRestAPIId_
, _cmName = pName_
, _cmContentType = pContentType_
}
cmSchema :: Lens' CreateModel (Maybe Text)
cmSchema = lens _cmSchema (\ s a -> s{_cmSchema = a});
cmDescription :: Lens' CreateModel (Maybe Text)
cmDescription = lens _cmDescription (\ s a -> s{_cmDescription = a});
cmRestAPIId :: Lens' CreateModel Text
cmRestAPIId = lens _cmRestAPIId (\ s a -> s{_cmRestAPIId = a});
cmName :: Lens' CreateModel Text
cmName = lens _cmName (\ s a -> s{_cmName = a});
cmContentType :: Lens' CreateModel Text
cmContentType = lens _cmContentType (\ s a -> s{_cmContentType = a});
instance AWSRequest CreateModel where
type Rs CreateModel = Model
request = postJSON apiGateway
response = receiveJSON (\ s h x -> eitherParseJSON x)
instance Hashable CreateModel where
instance NFData CreateModel where
instance ToHeaders CreateModel where
toHeaders
= const
(mconcat
["Accept" =# ("application/json" :: ByteString)])
instance ToJSON CreateModel where
toJSON CreateModel'{..}
= object
(catMaybes
[("schema" .=) <$> _cmSchema,
("description" .=) <$> _cmDescription,
Just ("name" .= _cmName),
Just ("contentType" .= _cmContentType)])
instance ToPath CreateModel where
toPath CreateModel'{..}
= mconcat
["/restapis/", toBS _cmRestAPIId, "/models"]
instance ToQuery CreateModel where
toQuery = const mempty