{-# 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.UpdateApplication
(
updateApplication
, UpdateApplication
, uaHomePageURL
, uaReadmeBody
, uaReadmeURL
, uaAuthor
, uaLabels
, uaDescription
, uaApplicationId
, updateApplicationResponse
, UpdateApplicationResponse
, uarsCreationTime
, uarsHomePageURL
, uarsLicenseURL
, uarsReadmeURL
, uarsApplicationId
, uarsName
, uarsVersion
, uarsAuthor
, uarsLabels
, uarsDescription
, uarsSpdxLicenseId
, uarsResponseStatus
) 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 UpdateApplication = UpdateApplication'
{ _uaHomePageURL :: !(Maybe Text)
, _uaReadmeBody :: !(Maybe Text)
, _uaReadmeURL :: !(Maybe Text)
, _uaAuthor :: !(Maybe Text)
, _uaLabels :: !(Maybe [Text])
, _uaDescription :: !(Maybe Text)
, _uaApplicationId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateApplication
:: Text
-> UpdateApplication
updateApplication pApplicationId_ =
UpdateApplication'
{ _uaHomePageURL = Nothing
, _uaReadmeBody = Nothing
, _uaReadmeURL = Nothing
, _uaAuthor = Nothing
, _uaLabels = Nothing
, _uaDescription = Nothing
, _uaApplicationId = pApplicationId_
}
uaHomePageURL :: Lens' UpdateApplication (Maybe Text)
uaHomePageURL = lens _uaHomePageURL (\ s a -> s{_uaHomePageURL = a})
uaReadmeBody :: Lens' UpdateApplication (Maybe Text)
uaReadmeBody = lens _uaReadmeBody (\ s a -> s{_uaReadmeBody = a})
uaReadmeURL :: Lens' UpdateApplication (Maybe Text)
uaReadmeURL = lens _uaReadmeURL (\ s a -> s{_uaReadmeURL = a})
uaAuthor :: Lens' UpdateApplication (Maybe Text)
uaAuthor = lens _uaAuthor (\ s a -> s{_uaAuthor = a})
uaLabels :: Lens' UpdateApplication [Text]
uaLabels = lens _uaLabels (\ s a -> s{_uaLabels = a}) . _Default . _Coerce
uaDescription :: Lens' UpdateApplication (Maybe Text)
uaDescription = lens _uaDescription (\ s a -> s{_uaDescription = a})
uaApplicationId :: Lens' UpdateApplication Text
uaApplicationId = lens _uaApplicationId (\ s a -> s{_uaApplicationId = a})
instance AWSRequest UpdateApplication where
type Rs UpdateApplication = UpdateApplicationResponse
request = patchJSON serverlessApplicationRepository
response
= receiveJSON
(\ s h x ->
UpdateApplicationResponse' <$>
(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 UpdateApplication where
instance NFData UpdateApplication where
instance ToHeaders UpdateApplication where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON UpdateApplication where
toJSON UpdateApplication'{..}
= object
(catMaybes
[("homePageUrl" .=) <$> _uaHomePageURL,
("readmeBody" .=) <$> _uaReadmeBody,
("readmeUrl" .=) <$> _uaReadmeURL,
("author" .=) <$> _uaAuthor,
("labels" .=) <$> _uaLabels,
("description" .=) <$> _uaDescription])
instance ToPath UpdateApplication where
toPath UpdateApplication'{..}
= mconcat ["/applications/", toBS _uaApplicationId]
instance ToQuery UpdateApplication where
toQuery = const mempty
data UpdateApplicationResponse = UpdateApplicationResponse'
{ _uarsCreationTime :: !(Maybe Text)
, _uarsHomePageURL :: !(Maybe Text)
, _uarsLicenseURL :: !(Maybe Text)
, _uarsReadmeURL :: !(Maybe Text)
, _uarsApplicationId :: !(Maybe Text)
, _uarsName :: !(Maybe Text)
, _uarsVersion :: !(Maybe Version)
, _uarsAuthor :: !(Maybe Text)
, _uarsLabels :: !(Maybe [Text])
, _uarsDescription :: !(Maybe Text)
, _uarsSpdxLicenseId :: !(Maybe Text)
, _uarsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
updateApplicationResponse
:: Int
-> UpdateApplicationResponse
updateApplicationResponse pResponseStatus_ =
UpdateApplicationResponse'
{ _uarsCreationTime = Nothing
, _uarsHomePageURL = Nothing
, _uarsLicenseURL = Nothing
, _uarsReadmeURL = Nothing
, _uarsApplicationId = Nothing
, _uarsName = Nothing
, _uarsVersion = Nothing
, _uarsAuthor = Nothing
, _uarsLabels = Nothing
, _uarsDescription = Nothing
, _uarsSpdxLicenseId = Nothing
, _uarsResponseStatus = pResponseStatus_
}
uarsCreationTime :: Lens' UpdateApplicationResponse (Maybe Text)
uarsCreationTime = lens _uarsCreationTime (\ s a -> s{_uarsCreationTime = a})
uarsHomePageURL :: Lens' UpdateApplicationResponse (Maybe Text)
uarsHomePageURL = lens _uarsHomePageURL (\ s a -> s{_uarsHomePageURL = a})
uarsLicenseURL :: Lens' UpdateApplicationResponse (Maybe Text)
uarsLicenseURL = lens _uarsLicenseURL (\ s a -> s{_uarsLicenseURL = a})
uarsReadmeURL :: Lens' UpdateApplicationResponse (Maybe Text)
uarsReadmeURL = lens _uarsReadmeURL (\ s a -> s{_uarsReadmeURL = a})
uarsApplicationId :: Lens' UpdateApplicationResponse (Maybe Text)
uarsApplicationId = lens _uarsApplicationId (\ s a -> s{_uarsApplicationId = a})
uarsName :: Lens' UpdateApplicationResponse (Maybe Text)
uarsName = lens _uarsName (\ s a -> s{_uarsName = a})
uarsVersion :: Lens' UpdateApplicationResponse (Maybe Version)
uarsVersion = lens _uarsVersion (\ s a -> s{_uarsVersion = a})
uarsAuthor :: Lens' UpdateApplicationResponse (Maybe Text)
uarsAuthor = lens _uarsAuthor (\ s a -> s{_uarsAuthor = a})
uarsLabels :: Lens' UpdateApplicationResponse [Text]
uarsLabels = lens _uarsLabels (\ s a -> s{_uarsLabels = a}) . _Default . _Coerce
uarsDescription :: Lens' UpdateApplicationResponse (Maybe Text)
uarsDescription = lens _uarsDescription (\ s a -> s{_uarsDescription = a})
uarsSpdxLicenseId :: Lens' UpdateApplicationResponse (Maybe Text)
uarsSpdxLicenseId = lens _uarsSpdxLicenseId (\ s a -> s{_uarsSpdxLicenseId = a})
uarsResponseStatus :: Lens' UpdateApplicationResponse Int
uarsResponseStatus = lens _uarsResponseStatus (\ s a -> s{_uarsResponseStatus = a})
instance NFData UpdateApplicationResponse where