module Network.AWS.Inspector.CreateApplication
(
createApplication
, CreateApplication
, caResourceGroupARN
, caApplicationName
, createApplicationResponse
, CreateApplicationResponse
, carsApplicationARN
, carsResponseStatus
) where
import Network.AWS.Inspector.Types
import Network.AWS.Inspector.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateApplication = CreateApplication'
{ _caResourceGroupARN :: !(Maybe Text)
, _caApplicationName :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createApplication
:: CreateApplication
createApplication =
CreateApplication'
{ _caResourceGroupARN = Nothing
, _caApplicationName = Nothing
}
caResourceGroupARN :: Lens' CreateApplication (Maybe Text)
caResourceGroupARN = lens _caResourceGroupARN (\ s a -> s{_caResourceGroupARN = a});
caApplicationName :: Lens' CreateApplication (Maybe Text)
caApplicationName = lens _caApplicationName (\ s a -> s{_caApplicationName = a});
instance AWSRequest CreateApplication where
type Rs CreateApplication = CreateApplicationResponse
request = postJSON inspector
response
= receiveJSON
(\ s h x ->
CreateApplicationResponse' <$>
(x .?> "applicationArn") <*> (pure (fromEnum s)))
instance ToHeaders CreateApplication where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("InspectorService.CreateApplication" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateApplication where
toJSON CreateApplication'{..}
= object
(catMaybes
[("resourceGroupArn" .=) <$> _caResourceGroupARN,
("applicationName" .=) <$> _caApplicationName])
instance ToPath CreateApplication where
toPath = const "/"
instance ToQuery CreateApplication where
toQuery = const mempty
data CreateApplicationResponse = CreateApplicationResponse'
{ _carsApplicationARN :: !(Maybe Text)
, _carsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createApplicationResponse
:: Int
-> CreateApplicationResponse
createApplicationResponse pResponseStatus_ =
CreateApplicationResponse'
{ _carsApplicationARN = Nothing
, _carsResponseStatus = pResponseStatus_
}
carsApplicationARN :: Lens' CreateApplicationResponse (Maybe Text)
carsApplicationARN = lens _carsApplicationARN (\ s a -> s{_carsApplicationARN = a});
carsResponseStatus :: Lens' CreateApplicationResponse Int
carsResponseStatus = lens _carsResponseStatus (\ s a -> s{_carsResponseStatus = a});