{-# 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.AppSync.UpdateType
(
updateType
, UpdateType
, utDefinition
, utApiId
, utTypeName
, utFormat
, updateTypeResponse
, UpdateTypeResponse
, utrsType
, utrsResponseStatus
) where
import Network.AWS.AppSync.Types
import Network.AWS.AppSync.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data UpdateType = UpdateType'
{ _utDefinition :: !(Maybe Text)
, _utApiId :: !Text
, _utTypeName :: !Text
, _utFormat :: !TypeDefinitionFormat
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateType
:: Text
-> Text
-> TypeDefinitionFormat
-> UpdateType
updateType pApiId_ pTypeName_ pFormat_ =
UpdateType'
{ _utDefinition = Nothing
, _utApiId = pApiId_
, _utTypeName = pTypeName_
, _utFormat = pFormat_
}
utDefinition :: Lens' UpdateType (Maybe Text)
utDefinition = lens _utDefinition (\ s a -> s{_utDefinition = a})
utApiId :: Lens' UpdateType Text
utApiId = lens _utApiId (\ s a -> s{_utApiId = a})
utTypeName :: Lens' UpdateType Text
utTypeName = lens _utTypeName (\ s a -> s{_utTypeName = a})
utFormat :: Lens' UpdateType TypeDefinitionFormat
utFormat = lens _utFormat (\ s a -> s{_utFormat = a})
instance AWSRequest UpdateType where
type Rs UpdateType = UpdateTypeResponse
request = postJSON appSync
response
= receiveJSON
(\ s h x ->
UpdateTypeResponse' <$>
(x .?> "type") <*> (pure (fromEnum s)))
instance Hashable UpdateType where
instance NFData UpdateType where
instance ToHeaders UpdateType where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateType where
toJSON UpdateType'{..}
= object
(catMaybes
[("definition" .=) <$> _utDefinition,
Just ("format" .= _utFormat)])
instance ToPath UpdateType where
toPath UpdateType'{..}
= mconcat
["/v1/apis/", toBS _utApiId, "/types/",
toBS _utTypeName]
instance ToQuery UpdateType where
toQuery = const mempty
data UpdateTypeResponse = UpdateTypeResponse'
{ _utrsType :: !(Maybe Type)
, _utrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateTypeResponse
:: Int
-> UpdateTypeResponse
updateTypeResponse pResponseStatus_ =
UpdateTypeResponse'
{_utrsType = Nothing, _utrsResponseStatus = pResponseStatus_}
utrsType :: Lens' UpdateTypeResponse (Maybe Type)
utrsType = lens _utrsType (\ s a -> s{_utrsType = a})
utrsResponseStatus :: Lens' UpdateTypeResponse Int
utrsResponseStatus = lens _utrsResponseStatus (\ s a -> s{_utrsResponseStatus = a})
instance NFData UpdateTypeResponse where