{-# 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.GuardDuty.GetFindingsStatistics
(
getFindingsStatistics
, GetFindingsStatistics
, gfsFindingStatisticTypes
, gfsFindingCriteria
, gfsDetectorId
, getFindingsStatisticsResponse
, GetFindingsStatisticsResponse
, gfsrsFindingStatistics
, gfsrsResponseStatus
) where
import Network.AWS.GuardDuty.Types
import Network.AWS.GuardDuty.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetFindingsStatistics = GetFindingsStatistics'
{ _gfsFindingStatisticTypes :: !(Maybe [FindingStatisticType])
, _gfsFindingCriteria :: !(Maybe FindingCriteria)
, _gfsDetectorId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getFindingsStatistics
:: Text
-> GetFindingsStatistics
getFindingsStatistics pDetectorId_ =
GetFindingsStatistics'
{ _gfsFindingStatisticTypes = Nothing
, _gfsFindingCriteria = Nothing
, _gfsDetectorId = pDetectorId_
}
gfsFindingStatisticTypes :: Lens' GetFindingsStatistics [FindingStatisticType]
gfsFindingStatisticTypes = lens _gfsFindingStatisticTypes (\ s a -> s{_gfsFindingStatisticTypes = a}) . _Default . _Coerce
gfsFindingCriteria :: Lens' GetFindingsStatistics (Maybe FindingCriteria)
gfsFindingCriteria = lens _gfsFindingCriteria (\ s a -> s{_gfsFindingCriteria = a})
gfsDetectorId :: Lens' GetFindingsStatistics Text
gfsDetectorId = lens _gfsDetectorId (\ s a -> s{_gfsDetectorId = a})
instance AWSRequest GetFindingsStatistics where
type Rs GetFindingsStatistics =
GetFindingsStatisticsResponse
request = postJSON guardDuty
response
= receiveJSON
(\ s h x ->
GetFindingsStatisticsResponse' <$>
(x .?> "findingStatistics") <*> (pure (fromEnum s)))
instance Hashable GetFindingsStatistics where
instance NFData GetFindingsStatistics where
instance ToHeaders GetFindingsStatistics where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetFindingsStatistics where
toJSON GetFindingsStatistics'{..}
= object
(catMaybes
[("findingStatisticTypes" .=) <$>
_gfsFindingStatisticTypes,
("findingCriteria" .=) <$> _gfsFindingCriteria])
instance ToPath GetFindingsStatistics where
toPath GetFindingsStatistics'{..}
= mconcat
["/detector/", toBS _gfsDetectorId,
"/findings/statistics"]
instance ToQuery GetFindingsStatistics where
toQuery = const mempty
data GetFindingsStatisticsResponse = GetFindingsStatisticsResponse'
{ _gfsrsFindingStatistics :: !(Maybe FindingStatistics)
, _gfsrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getFindingsStatisticsResponse
:: Int
-> GetFindingsStatisticsResponse
getFindingsStatisticsResponse pResponseStatus_ =
GetFindingsStatisticsResponse'
{_gfsrsFindingStatistics = Nothing, _gfsrsResponseStatus = pResponseStatus_}
gfsrsFindingStatistics :: Lens' GetFindingsStatisticsResponse (Maybe FindingStatistics)
gfsrsFindingStatistics = lens _gfsrsFindingStatistics (\ s a -> s{_gfsrsFindingStatistics = a})
gfsrsResponseStatus :: Lens' GetFindingsStatisticsResponse Int
gfsrsResponseStatus = lens _gfsrsResponseStatus (\ s a -> s{_gfsrsResponseStatus = a})
instance NFData GetFindingsStatisticsResponse where