{-# 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.GetApplication
(
getApplication
, GetApplication
, gaSemanticVersion
, gaApplicationId
, getApplicationResponse
, GetApplicationResponse
, garsCreationTime
, garsHomePageURL
, garsLicenseURL
, garsReadmeURL
, garsApplicationId
, garsName
, garsVersion
, garsAuthor
, garsLabels
, garsDescription
, garsSpdxLicenseId
, garsResponseStatus
) 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 GetApplication = GetApplication'
{ _gaSemanticVersion :: !(Maybe Text)
, _gaApplicationId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getApplication
:: Text
-> GetApplication
getApplication pApplicationId_ =
GetApplication'
{_gaSemanticVersion = Nothing, _gaApplicationId = pApplicationId_}
gaSemanticVersion :: Lens' GetApplication (Maybe Text)
gaSemanticVersion = lens _gaSemanticVersion (\ s a -> s{_gaSemanticVersion = a})
gaApplicationId :: Lens' GetApplication Text
gaApplicationId = lens _gaApplicationId (\ s a -> s{_gaApplicationId = a})
instance AWSRequest GetApplication where
type Rs GetApplication = GetApplicationResponse
request = get serverlessApplicationRepository
response
= receiveJSON
(\ s h x ->
GetApplicationResponse' <$>
(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 GetApplication where
instance NFData GetApplication where
instance ToHeaders GetApplication where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToPath GetApplication where
toPath GetApplication'{..}
= mconcat ["/applications/", toBS _gaApplicationId]
instance ToQuery GetApplication where
toQuery GetApplication'{..}
= mconcat ["semanticVersion" =: _gaSemanticVersion]
data GetApplicationResponse = GetApplicationResponse'
{ _garsCreationTime :: !(Maybe Text)
, _garsHomePageURL :: !(Maybe Text)
, _garsLicenseURL :: !(Maybe Text)
, _garsReadmeURL :: !(Maybe Text)
, _garsApplicationId :: !(Maybe Text)
, _garsName :: !(Maybe Text)
, _garsVersion :: !(Maybe Version)
, _garsAuthor :: !(Maybe Text)
, _garsLabels :: !(Maybe [Text])
, _garsDescription :: !(Maybe Text)
, _garsSpdxLicenseId :: !(Maybe Text)
, _garsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getApplicationResponse
:: Int
-> GetApplicationResponse
getApplicationResponse pResponseStatus_ =
GetApplicationResponse'
{ _garsCreationTime = Nothing
, _garsHomePageURL = Nothing
, _garsLicenseURL = Nothing
, _garsReadmeURL = Nothing
, _garsApplicationId = Nothing
, _garsName = Nothing
, _garsVersion = Nothing
, _garsAuthor = Nothing
, _garsLabels = Nothing
, _garsDescription = Nothing
, _garsSpdxLicenseId = Nothing
, _garsResponseStatus = pResponseStatus_
}
garsCreationTime :: Lens' GetApplicationResponse (Maybe Text)
garsCreationTime = lens _garsCreationTime (\ s a -> s{_garsCreationTime = a})
garsHomePageURL :: Lens' GetApplicationResponse (Maybe Text)
garsHomePageURL = lens _garsHomePageURL (\ s a -> s{_garsHomePageURL = a})
garsLicenseURL :: Lens' GetApplicationResponse (Maybe Text)
garsLicenseURL = lens _garsLicenseURL (\ s a -> s{_garsLicenseURL = a})
garsReadmeURL :: Lens' GetApplicationResponse (Maybe Text)
garsReadmeURL = lens _garsReadmeURL (\ s a -> s{_garsReadmeURL = a})
garsApplicationId :: Lens' GetApplicationResponse (Maybe Text)
garsApplicationId = lens _garsApplicationId (\ s a -> s{_garsApplicationId = a})
garsName :: Lens' GetApplicationResponse (Maybe Text)
garsName = lens _garsName (\ s a -> s{_garsName = a})
garsVersion :: Lens' GetApplicationResponse (Maybe Version)
garsVersion = lens _garsVersion (\ s a -> s{_garsVersion = a})
garsAuthor :: Lens' GetApplicationResponse (Maybe Text)
garsAuthor = lens _garsAuthor (\ s a -> s{_garsAuthor = a})
garsLabels :: Lens' GetApplicationResponse [Text]
garsLabels = lens _garsLabels (\ s a -> s{_garsLabels = a}) . _Default . _Coerce
garsDescription :: Lens' GetApplicationResponse (Maybe Text)
garsDescription = lens _garsDescription (\ s a -> s{_garsDescription = a})
garsSpdxLicenseId :: Lens' GetApplicationResponse (Maybe Text)
garsSpdxLicenseId = lens _garsSpdxLicenseId (\ s a -> s{_garsSpdxLicenseId = a})
garsResponseStatus :: Lens' GetApplicationResponse Int
garsResponseStatus = lens _garsResponseStatus (\ s a -> s{_garsResponseStatus = a})
instance NFData GetApplicationResponse where