module Network.AWS.Discovery.CreateApplication
(
createApplication
, CreateApplication
, caDescription
, caName
, createApplicationResponse
, CreateApplicationResponse
, carsConfigurationId
, carsResponseStatus
) where
import Network.AWS.Discovery.Types
import Network.AWS.Discovery.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateApplication = CreateApplication'
{ _caDescription :: !(Maybe Text)
, _caName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createApplication
:: Text
-> CreateApplication
createApplication pName_ =
CreateApplication' {_caDescription = Nothing, _caName = pName_}
caDescription :: Lens' CreateApplication (Maybe Text)
caDescription = lens _caDescription (\ s a -> s{_caDescription = a});
caName :: Lens' CreateApplication Text
caName = lens _caName (\ s a -> s{_caName = a});
instance AWSRequest CreateApplication where
type Rs CreateApplication = CreateApplicationResponse
request = postJSON discovery
response
= receiveJSON
(\ s h x ->
CreateApplicationResponse' <$>
(x .?> "configurationId") <*> (pure (fromEnum s)))
instance Hashable CreateApplication where
instance NFData CreateApplication where
instance ToHeaders CreateApplication where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSPoseidonService_V2015_11_01.CreateApplication"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateApplication where
toJSON CreateApplication'{..}
= object
(catMaybes
[("description" .=) <$> _caDescription,
Just ("name" .= _caName)])
instance ToPath CreateApplication where
toPath = const "/"
instance ToQuery CreateApplication where
toQuery = const mempty
data CreateApplicationResponse = CreateApplicationResponse'
{ _carsConfigurationId :: !(Maybe Text)
, _carsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createApplicationResponse
:: Int
-> CreateApplicationResponse
createApplicationResponse pResponseStatus_ =
CreateApplicationResponse'
{_carsConfigurationId = Nothing, _carsResponseStatus = pResponseStatus_}
carsConfigurationId :: Lens' CreateApplicationResponse (Maybe Text)
carsConfigurationId = lens _carsConfigurationId (\ s a -> s{_carsConfigurationId = a});
carsResponseStatus :: Lens' CreateApplicationResponse Int
carsResponseStatus = lens _carsResponseStatus (\ s a -> s{_carsResponseStatus = a});
instance NFData CreateApplicationResponse where