{-# 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.CreateApplication
(
createApplication
, CreateApplication
, caHomePageURL
, caReadmeBody
, caLicenseURL
, caSemanticVersion
, caSourceCodeURL
, caReadmeURL
, caName
, caAuthor
, caLabels
, caTemplateBody
, caTemplateURL
, caLicenseBody
, caDescription
, caSpdxLicenseId
, createApplicationResponse
, CreateApplicationResponse
, carsCreationTime
, carsHomePageURL
, carsLicenseURL
, carsReadmeURL
, carsApplicationId
, carsName
, carsVersion
, carsAuthor
, carsLabels
, carsDescription
, carsSpdxLicenseId
, carsResponseStatus
) 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 CreateApplication = CreateApplication'
{ _caHomePageURL :: !(Maybe Text)
, _caReadmeBody :: !(Maybe Text)
, _caLicenseURL :: !(Maybe Text)
, _caSemanticVersion :: !(Maybe Text)
, _caSourceCodeURL :: !(Maybe Text)
, _caReadmeURL :: !(Maybe Text)
, _caName :: !(Maybe Text)
, _caAuthor :: !(Maybe Text)
, _caLabels :: !(Maybe [Text])
, _caTemplateBody :: !(Maybe Text)
, _caTemplateURL :: !(Maybe Text)
, _caLicenseBody :: !(Maybe Text)
, _caDescription :: !(Maybe Text)
, _caSpdxLicenseId :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createApplication
:: CreateApplication
createApplication =
CreateApplication'
{ _caHomePageURL = Nothing
, _caReadmeBody = Nothing
, _caLicenseURL = Nothing
, _caSemanticVersion = Nothing
, _caSourceCodeURL = Nothing
, _caReadmeURL = Nothing
, _caName = Nothing
, _caAuthor = Nothing
, _caLabels = Nothing
, _caTemplateBody = Nothing
, _caTemplateURL = Nothing
, _caLicenseBody = Nothing
, _caDescription = Nothing
, _caSpdxLicenseId = Nothing
}
caHomePageURL :: Lens' CreateApplication (Maybe Text)
caHomePageURL = lens _caHomePageURL (\ s a -> s{_caHomePageURL = a})
caReadmeBody :: Lens' CreateApplication (Maybe Text)
caReadmeBody = lens _caReadmeBody (\ s a -> s{_caReadmeBody = a})
caLicenseURL :: Lens' CreateApplication (Maybe Text)
caLicenseURL = lens _caLicenseURL (\ s a -> s{_caLicenseURL = a})
caSemanticVersion :: Lens' CreateApplication (Maybe Text)
caSemanticVersion = lens _caSemanticVersion (\ s a -> s{_caSemanticVersion = a})
caSourceCodeURL :: Lens' CreateApplication (Maybe Text)
caSourceCodeURL = lens _caSourceCodeURL (\ s a -> s{_caSourceCodeURL = a})
caReadmeURL :: Lens' CreateApplication (Maybe Text)
caReadmeURL = lens _caReadmeURL (\ s a -> s{_caReadmeURL = a})
caName :: Lens' CreateApplication (Maybe Text)
caName = lens _caName (\ s a -> s{_caName = a})
caAuthor :: Lens' CreateApplication (Maybe Text)
caAuthor = lens _caAuthor (\ s a -> s{_caAuthor = a})
caLabels :: Lens' CreateApplication [Text]
caLabels = lens _caLabels (\ s a -> s{_caLabels = a}) . _Default . _Coerce
caTemplateBody :: Lens' CreateApplication (Maybe Text)
caTemplateBody = lens _caTemplateBody (\ s a -> s{_caTemplateBody = a})
caTemplateURL :: Lens' CreateApplication (Maybe Text)
caTemplateURL = lens _caTemplateURL (\ s a -> s{_caTemplateURL = a})
caLicenseBody :: Lens' CreateApplication (Maybe Text)
caLicenseBody = lens _caLicenseBody (\ s a -> s{_caLicenseBody = a})
caDescription :: Lens' CreateApplication (Maybe Text)
caDescription = lens _caDescription (\ s a -> s{_caDescription = a})
caSpdxLicenseId :: Lens' CreateApplication (Maybe Text)
caSpdxLicenseId = lens _caSpdxLicenseId (\ s a -> s{_caSpdxLicenseId = a})
instance AWSRequest CreateApplication where
type Rs CreateApplication = CreateApplicationResponse
request = postJSON serverlessApplicationRepository
response
= receiveJSON
(\ s h x ->
CreateApplicationResponse' <$>
(x .?> "creationTime") <*> (x .?> "homePageUrl") <*>
(x .?> "licenseUrl")
<*> (x .?> "readmeUrl")
<*> (x .?> "applicationId")
<*> (x .?> "name")
<*> (x .?> "version")
<*> (x .?> "author")
<*> (x .?> "labels" .!@ mempty)
<*> (x .?> "description")
<*> (x .?> "spdxLicenseId")
<*> (pure (fromEnum s)))
instance Hashable CreateApplication where
instance NFData CreateApplication where
instance ToHeaders CreateApplication where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateApplication where
toJSON CreateApplication'{..}
= object
(catMaybes
[("homePageUrl" .=) <$> _caHomePageURL,
("readmeBody" .=) <$> _caReadmeBody,
("licenseUrl" .=) <$> _caLicenseURL,
("semanticVersion" .=) <$> _caSemanticVersion,
("sourceCodeUrl" .=) <$> _caSourceCodeURL,
("readmeUrl" .=) <$> _caReadmeURL,
("name" .=) <$> _caName, ("author" .=) <$> _caAuthor,
("labels" .=) <$> _caLabels,
("templateBody" .=) <$> _caTemplateBody,
("templateUrl" .=) <$> _caTemplateURL,
("licenseBody" .=) <$> _caLicenseBody,
("description" .=) <$> _caDescription,
("spdxLicenseId" .=) <$> _caSpdxLicenseId])
instance ToPath CreateApplication where
toPath = const "/applications"
instance ToQuery CreateApplication where
toQuery = const mempty
data CreateApplicationResponse = CreateApplicationResponse'
{ _carsCreationTime :: !(Maybe Text)
, _carsHomePageURL :: !(Maybe Text)
, _carsLicenseURL :: !(Maybe Text)
, _carsReadmeURL :: !(Maybe Text)
, _carsApplicationId :: !(Maybe Text)
, _carsName :: !(Maybe Text)
, _carsVersion :: !(Maybe Version)
, _carsAuthor :: !(Maybe Text)
, _carsLabels :: !(Maybe [Text])
, _carsDescription :: !(Maybe Text)
, _carsSpdxLicenseId :: !(Maybe Text)
, _carsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createApplicationResponse
:: Int
-> CreateApplicationResponse
createApplicationResponse pResponseStatus_ =
CreateApplicationResponse'
{ _carsCreationTime = Nothing
, _carsHomePageURL = Nothing
, _carsLicenseURL = Nothing
, _carsReadmeURL = Nothing
, _carsApplicationId = Nothing
, _carsName = Nothing
, _carsVersion = Nothing
, _carsAuthor = Nothing
, _carsLabels = Nothing
, _carsDescription = Nothing
, _carsSpdxLicenseId = Nothing
, _carsResponseStatus = pResponseStatus_
}
carsCreationTime :: Lens' CreateApplicationResponse (Maybe Text)
carsCreationTime = lens _carsCreationTime (\ s a -> s{_carsCreationTime = a})
carsHomePageURL :: Lens' CreateApplicationResponse (Maybe Text)
carsHomePageURL = lens _carsHomePageURL (\ s a -> s{_carsHomePageURL = a})
carsLicenseURL :: Lens' CreateApplicationResponse (Maybe Text)
carsLicenseURL = lens _carsLicenseURL (\ s a -> s{_carsLicenseURL = a})
carsReadmeURL :: Lens' CreateApplicationResponse (Maybe Text)
carsReadmeURL = lens _carsReadmeURL (\ s a -> s{_carsReadmeURL = a})
carsApplicationId :: Lens' CreateApplicationResponse (Maybe Text)
carsApplicationId = lens _carsApplicationId (\ s a -> s{_carsApplicationId = a})
carsName :: Lens' CreateApplicationResponse (Maybe Text)
carsName = lens _carsName (\ s a -> s{_carsName = a})
carsVersion :: Lens' CreateApplicationResponse (Maybe Version)
carsVersion = lens _carsVersion (\ s a -> s{_carsVersion = a})
carsAuthor :: Lens' CreateApplicationResponse (Maybe Text)
carsAuthor = lens _carsAuthor (\ s a -> s{_carsAuthor = a})
carsLabels :: Lens' CreateApplicationResponse [Text]
carsLabels = lens _carsLabels (\ s a -> s{_carsLabels = a}) . _Default . _Coerce
carsDescription :: Lens' CreateApplicationResponse (Maybe Text)
carsDescription = lens _carsDescription (\ s a -> s{_carsDescription = a})
carsSpdxLicenseId :: Lens' CreateApplicationResponse (Maybe Text)
carsSpdxLicenseId = lens _carsSpdxLicenseId (\ s a -> s{_carsSpdxLicenseId = a})
carsResponseStatus :: Lens' CreateApplicationResponse Int
carsResponseStatus = lens _carsResponseStatus (\ s a -> s{_carsResponseStatus = a})
instance NFData CreateApplicationResponse where