module Network.AWS.Inspector.ListFindings
(
listFindings
, ListFindings
, lfAssessmentRunARNs
, lfNextToken
, lfFilter
, lfMaxResults
, listFindingsResponse
, ListFindingsResponse
, lfrsNextToken
, lfrsResponseStatus
, lfrsFindingARNs
) where
import Network.AWS.Inspector.Types
import Network.AWS.Inspector.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data ListFindings = ListFindings'
{ _lfAssessmentRunARNs :: !(Maybe [Text])
, _lfNextToken :: !(Maybe Text)
, _lfFilter :: !(Maybe FindingFilter)
, _lfMaxResults :: !(Maybe Int)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listFindings
:: ListFindings
listFindings =
ListFindings'
{ _lfAssessmentRunARNs = Nothing
, _lfNextToken = Nothing
, _lfFilter = Nothing
, _lfMaxResults = Nothing
}
lfAssessmentRunARNs :: Lens' ListFindings [Text]
lfAssessmentRunARNs = lens _lfAssessmentRunARNs (\ s a -> s{_lfAssessmentRunARNs = a}) . _Default . _Coerce;
lfNextToken :: Lens' ListFindings (Maybe Text)
lfNextToken = lens _lfNextToken (\ s a -> s{_lfNextToken = a});
lfFilter :: Lens' ListFindings (Maybe FindingFilter)
lfFilter = lens _lfFilter (\ s a -> s{_lfFilter = a});
lfMaxResults :: Lens' ListFindings (Maybe Int)
lfMaxResults = lens _lfMaxResults (\ s a -> s{_lfMaxResults = a});
instance AWSRequest ListFindings where
type Rs ListFindings = ListFindingsResponse
request = postJSON inspector
response
= receiveJSON
(\ s h x ->
ListFindingsResponse' <$>
(x .?> "nextToken") <*> (pure (fromEnum s)) <*>
(x .?> "findingArns" .!@ mempty))
instance Hashable ListFindings
instance NFData ListFindings
instance ToHeaders ListFindings where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("InspectorService.ListFindings" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON ListFindings where
toJSON ListFindings'{..}
= object
(catMaybes
[("assessmentRunArns" .=) <$> _lfAssessmentRunARNs,
("nextToken" .=) <$> _lfNextToken,
("filter" .=) <$> _lfFilter,
("maxResults" .=) <$> _lfMaxResults])
instance ToPath ListFindings where
toPath = const "/"
instance ToQuery ListFindings where
toQuery = const mempty
data ListFindingsResponse = ListFindingsResponse'
{ _lfrsNextToken :: !(Maybe Text)
, _lfrsResponseStatus :: !Int
, _lfrsFindingARNs :: ![Text]
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listFindingsResponse
:: Int
-> ListFindingsResponse
listFindingsResponse pResponseStatus_ =
ListFindingsResponse'
{ _lfrsNextToken = Nothing
, _lfrsResponseStatus = pResponseStatus_
, _lfrsFindingARNs = mempty
}
lfrsNextToken :: Lens' ListFindingsResponse (Maybe Text)
lfrsNextToken = lens _lfrsNextToken (\ s a -> s{_lfrsNextToken = a});
lfrsResponseStatus :: Lens' ListFindingsResponse Int
lfrsResponseStatus = lens _lfrsResponseStatus (\ s a -> s{_lfrsResponseStatus = a});
lfrsFindingARNs :: Lens' ListFindingsResponse [Text]
lfrsFindingARNs = lens _lfrsFindingARNs (\ s a -> s{_lfrsFindingARNs = a}) . _Coerce;
instance NFData ListFindingsResponse