{-# 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.CodeDeploy.CreateApplication
(
createApplication
, CreateApplication
, caComputePlatform
, caApplicationName
, createApplicationResponse
, CreateApplicationResponse
, carsApplicationId
, carsResponseStatus
) where
import Network.AWS.CodeDeploy.Types
import Network.AWS.CodeDeploy.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateApplication = CreateApplication'
{ _caComputePlatform :: !(Maybe ComputePlatform)
, _caApplicationName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createApplication
:: Text
-> CreateApplication
createApplication pApplicationName_ =
CreateApplication'
{_caComputePlatform = Nothing, _caApplicationName = pApplicationName_}
caComputePlatform :: Lens' CreateApplication (Maybe ComputePlatform)
caComputePlatform = lens _caComputePlatform (\ s a -> s{_caComputePlatform = a})
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 Hashable CreateApplication where
instance NFData CreateApplication where
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
[("computePlatform" .=) <$> _caComputePlatform,
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})
instance NFData CreateApplicationResponse where