module Network.AWS.CodeDeploy.CreateApplication
(
CreateApplication
, createApplication
, caApplicationName
, CreateApplicationResponse
, createApplicationResponse
, carApplicationId
) where
import Network.AWS.Prelude
import Network.AWS.Request.JSON
import Network.AWS.CodeDeploy.Types
import qualified GHC.Exts
newtype CreateApplication = CreateApplication
{ _caApplicationName :: Text
} deriving (Eq, Ord, Show, Monoid, IsString)
createApplication :: Text
-> CreateApplication
createApplication p1 = CreateApplication
{ _caApplicationName = p1
}
caApplicationName :: Lens' CreateApplication Text
caApplicationName =
lens _caApplicationName (\s a -> s { _caApplicationName = a })
newtype CreateApplicationResponse = CreateApplicationResponse
{ _carApplicationId :: Maybe Text
} deriving (Eq, Ord, Show, Monoid)
createApplicationResponse :: CreateApplicationResponse
createApplicationResponse = CreateApplicationResponse
{ _carApplicationId = Nothing
}
carApplicationId :: Lens' CreateApplicationResponse (Maybe Text)
carApplicationId = lens _carApplicationId (\s a -> s { _carApplicationId = a })
instance ToPath CreateApplication where
toPath = const "/"
instance ToQuery CreateApplication where
toQuery = const mempty
instance ToHeaders CreateApplication
instance ToJSON CreateApplication where
toJSON CreateApplication{..} = object
[ "applicationName" .= _caApplicationName
]
instance AWSRequest CreateApplication where
type Sv CreateApplication = CodeDeploy
type Rs CreateApplication = CreateApplicationResponse
request = post "CreateApplication"
response = jsonResponse
instance FromJSON CreateApplicationResponse where
parseJSON = withObject "CreateApplicationResponse" $ \o -> CreateApplicationResponse
<$> o .:? "applicationId"