module Network.AWS.Inspector.ListFindings
(
listFindings
, ListFindings
, lfRunARNs
, lfNextToken
, lfFilter
, lfMaxResults
, listFindingsResponse
, ListFindingsResponse
, lfrsNextToken
, lfrsFindingARNList
, lfrsResponseStatus
) 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 ListFindings = ListFindings'
{ _lfRunARNs :: !(Maybe [Text])
, _lfNextToken :: !(Maybe Text)
, _lfFilter :: !(Maybe FindingsFilter)
, _lfMaxResults :: !(Maybe Int)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listFindings
:: ListFindings
listFindings =
ListFindings'
{ _lfRunARNs = Nothing
, _lfNextToken = Nothing
, _lfFilter = Nothing
, _lfMaxResults = Nothing
}
lfRunARNs :: Lens' ListFindings [Text]
lfRunARNs = lens _lfRunARNs (\ s a -> s{_lfRunARNs = a}) . _Default . _Coerce;
lfNextToken :: Lens' ListFindings (Maybe Text)
lfNextToken = lens _lfNextToken (\ s a -> s{_lfNextToken = a});
lfFilter :: Lens' ListFindings (Maybe FindingsFilter)
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") <*>
(x .?> "findingArnList" .!@ mempty)
<*> (pure (fromEnum s)))
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
[("runArns" .=) <$> _lfRunARNs,
("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)
, _lfrsFindingARNList :: !(Maybe [Text])
, _lfrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
listFindingsResponse
:: Int
-> ListFindingsResponse
listFindingsResponse pResponseStatus_ =
ListFindingsResponse'
{ _lfrsNextToken = Nothing
, _lfrsFindingARNList = Nothing
, _lfrsResponseStatus = pResponseStatus_
}
lfrsNextToken :: Lens' ListFindingsResponse (Maybe Text)
lfrsNextToken = lens _lfrsNextToken (\ s a -> s{_lfrsNextToken = a});
lfrsFindingARNList :: Lens' ListFindingsResponse [Text]
lfrsFindingARNList = lens _lfrsFindingARNList (\ s a -> s{_lfrsFindingARNList = a}) . _Default . _Coerce;
lfrsResponseStatus :: Lens' ListFindingsResponse Int
lfrsResponseStatus = lens _lfrsResponseStatus (\ s a -> s{_lfrsResponseStatus = a});