{-# 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.ServerlessApplicationRepository.CreateApplicationVersion
(
createApplicationVersion
, CreateApplicationVersion
, cavSourceCodeURL
, cavTemplateBody
, cavTemplateURL
, cavApplicationId
, cavSemanticVersion
, createApplicationVersionResponse
, CreateApplicationVersionResponse
, cavrsCreationTime
, cavrsParameterDefinitions
, cavrsSemanticVersion
, cavrsSourceCodeURL
, cavrsApplicationId
, cavrsTemplateURL
, cavrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.ServerlessApplicationRepository.Types
import Network.AWS.ServerlessApplicationRepository.Types.Product
data CreateApplicationVersion = CreateApplicationVersion'
{ _cavSourceCodeURL :: !(Maybe Text)
, _cavTemplateBody :: !(Maybe Text)
, _cavTemplateURL :: !(Maybe Text)
, _cavApplicationId :: !Text
, _cavSemanticVersion :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createApplicationVersion
:: Text
-> Text
-> CreateApplicationVersion
createApplicationVersion pApplicationId_ pSemanticVersion_ =
CreateApplicationVersion'
{ _cavSourceCodeURL = Nothing
, _cavTemplateBody = Nothing
, _cavTemplateURL = Nothing
, _cavApplicationId = pApplicationId_
, _cavSemanticVersion = pSemanticVersion_
}
cavSourceCodeURL :: Lens' CreateApplicationVersion (Maybe Text)
cavSourceCodeURL = lens _cavSourceCodeURL (\ s a -> s{_cavSourceCodeURL = a})
cavTemplateBody :: Lens' CreateApplicationVersion (Maybe Text)
cavTemplateBody = lens _cavTemplateBody (\ s a -> s{_cavTemplateBody = a})
cavTemplateURL :: Lens' CreateApplicationVersion (Maybe Text)
cavTemplateURL = lens _cavTemplateURL (\ s a -> s{_cavTemplateURL = a})
cavApplicationId :: Lens' CreateApplicationVersion Text
cavApplicationId = lens _cavApplicationId (\ s a -> s{_cavApplicationId = a})
cavSemanticVersion :: Lens' CreateApplicationVersion Text
cavSemanticVersion = lens _cavSemanticVersion (\ s a -> s{_cavSemanticVersion = a})
instance AWSRequest CreateApplicationVersion where
type Rs CreateApplicationVersion =
CreateApplicationVersionResponse
request = putJSON serverlessApplicationRepository
response
= receiveJSON
(\ s h x ->
CreateApplicationVersionResponse' <$>
(x .?> "creationTime") <*>
(x .?> "parameterDefinitions" .!@ mempty)
<*> (x .?> "semanticVersion")
<*> (x .?> "sourceCodeUrl")
<*> (x .?> "applicationId")
<*> (x .?> "templateUrl")
<*> (pure (fromEnum s)))
instance Hashable CreateApplicationVersion where
instance NFData CreateApplicationVersion where
instance ToHeaders CreateApplicationVersion where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateApplicationVersion where
toJSON CreateApplicationVersion'{..}
= object
(catMaybes
[("sourceCodeUrl" .=) <$> _cavSourceCodeURL,
("templateBody" .=) <$> _cavTemplateBody,
("templateUrl" .=) <$> _cavTemplateURL])
instance ToPath CreateApplicationVersion where
toPath CreateApplicationVersion'{..}
= mconcat
["/applications/", toBS _cavApplicationId,
"/versions/", toBS _cavSemanticVersion]
instance ToQuery CreateApplicationVersion where
toQuery = const mempty
data CreateApplicationVersionResponse = CreateApplicationVersionResponse'
{ _cavrsCreationTime :: !(Maybe Text)
, _cavrsParameterDefinitions :: !(Maybe [ParameterDefinition])
, _cavrsSemanticVersion :: !(Maybe Text)
, _cavrsSourceCodeURL :: !(Maybe Text)
, _cavrsApplicationId :: !(Maybe Text)
, _cavrsTemplateURL :: !(Maybe Text)
, _cavrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createApplicationVersionResponse
:: Int
-> CreateApplicationVersionResponse
createApplicationVersionResponse pResponseStatus_ =
CreateApplicationVersionResponse'
{ _cavrsCreationTime = Nothing
, _cavrsParameterDefinitions = Nothing
, _cavrsSemanticVersion = Nothing
, _cavrsSourceCodeURL = Nothing
, _cavrsApplicationId = Nothing
, _cavrsTemplateURL = Nothing
, _cavrsResponseStatus = pResponseStatus_
}
cavrsCreationTime :: Lens' CreateApplicationVersionResponse (Maybe Text)
cavrsCreationTime = lens _cavrsCreationTime (\ s a -> s{_cavrsCreationTime = a})
cavrsParameterDefinitions :: Lens' CreateApplicationVersionResponse [ParameterDefinition]
cavrsParameterDefinitions = lens _cavrsParameterDefinitions (\ s a -> s{_cavrsParameterDefinitions = a}) . _Default . _Coerce
cavrsSemanticVersion :: Lens' CreateApplicationVersionResponse (Maybe Text)
cavrsSemanticVersion = lens _cavrsSemanticVersion (\ s a -> s{_cavrsSemanticVersion = a})
cavrsSourceCodeURL :: Lens' CreateApplicationVersionResponse (Maybe Text)
cavrsSourceCodeURL = lens _cavrsSourceCodeURL (\ s a -> s{_cavrsSourceCodeURL = a})
cavrsApplicationId :: Lens' CreateApplicationVersionResponse (Maybe Text)
cavrsApplicationId = lens _cavrsApplicationId (\ s a -> s{_cavrsApplicationId = a})
cavrsTemplateURL :: Lens' CreateApplicationVersionResponse (Maybe Text)
cavrsTemplateURL = lens _cavrsTemplateURL (\ s a -> s{_cavrsTemplateURL = a})
cavrsResponseStatus :: Lens' CreateApplicationVersionResponse Int
cavrsResponseStatus = lens _cavrsResponseStatus (\ s a -> s{_cavrsResponseStatus = a})
instance NFData CreateApplicationVersionResponse
where