module Network.AWS.CodeDeploy.CreateApplication
(
createApplication
, CreateApplication
, caApplicationName
, createApplicationResponse
, CreateApplicationResponse
, carsApplicationId
, carsResponseStatus
) where
import Network.AWS.CodeDeploy.Types
import Network.AWS.CodeDeploy.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype CreateApplication = CreateApplication'
{ _caApplicationName :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createApplication
:: Text
-> CreateApplication
createApplication pApplicationName_ =
CreateApplication'
{ _caApplicationName = pApplicationName_
}
caApplicationName :: Lens' CreateApplication Text
caApplicationName = lens _caApplicationName (\ s a -> s{_caApplicationName = a});
instance AWSRequest CreateApplication where
type Rs CreateApplication = CreateApplicationResponse
request = postJSON codeDeploy
response
= receiveJSON
(\ s h x ->
CreateApplicationResponse' <$>
(x .?> "applicationId") <*> (pure (fromEnum s)))
instance ToHeaders CreateApplication where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeDeploy_20141006.CreateApplication" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateApplication where
toJSON CreateApplication'{..}
= object
(catMaybes
[Just ("applicationName" .= _caApplicationName)])
instance ToPath CreateApplication where
toPath = const "/"
instance ToQuery CreateApplication where
toQuery = const mempty
data CreateApplicationResponse = CreateApplicationResponse'
{ _carsApplicationId :: !(Maybe Text)
, _carsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createApplicationResponse
:: Int
-> CreateApplicationResponse
createApplicationResponse pResponseStatus_ =
CreateApplicationResponse'
{ _carsApplicationId = Nothing
, _carsResponseStatus = pResponseStatus_
}
carsApplicationId :: Lens' CreateApplicationResponse (Maybe Text)
carsApplicationId = lens _carsApplicationId (\ s a -> s{_carsApplicationId = a});
carsResponseStatus :: Lens' CreateApplicationResponse Int
carsResponseStatus = lens _carsResponseStatus (\ s a -> s{_carsResponseStatus = a});