{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.GuardDuty.GetFindingsStatistics
(
GetFindingsStatistics (..),
newGetFindingsStatistics,
getFindingsStatistics_findingCriteria,
getFindingsStatistics_detectorId,
getFindingsStatistics_findingStatisticTypes,
GetFindingsStatisticsResponse (..),
newGetFindingsStatisticsResponse,
getFindingsStatisticsResponse_httpStatus,
getFindingsStatisticsResponse_findingStatistics,
)
where
import qualified Amazonka.Core as Core
import Amazonka.GuardDuty.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetFindingsStatistics = GetFindingsStatistics'
{
GetFindingsStatistics -> Maybe FindingCriteria
findingCriteria :: Prelude.Maybe FindingCriteria,
GetFindingsStatistics -> Text
detectorId :: Prelude.Text,
GetFindingsStatistics -> [FindingStatisticType]
findingStatisticTypes :: [FindingStatisticType]
}
deriving (GetFindingsStatistics -> GetFindingsStatistics -> Bool
(GetFindingsStatistics -> GetFindingsStatistics -> Bool)
-> (GetFindingsStatistics -> GetFindingsStatistics -> Bool)
-> Eq GetFindingsStatistics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFindingsStatistics -> GetFindingsStatistics -> Bool
$c/= :: GetFindingsStatistics -> GetFindingsStatistics -> Bool
== :: GetFindingsStatistics -> GetFindingsStatistics -> Bool
$c== :: GetFindingsStatistics -> GetFindingsStatistics -> Bool
Prelude.Eq, ReadPrec [GetFindingsStatistics]
ReadPrec GetFindingsStatistics
Int -> ReadS GetFindingsStatistics
ReadS [GetFindingsStatistics]
(Int -> ReadS GetFindingsStatistics)
-> ReadS [GetFindingsStatistics]
-> ReadPrec GetFindingsStatistics
-> ReadPrec [GetFindingsStatistics]
-> Read GetFindingsStatistics
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFindingsStatistics]
$creadListPrec :: ReadPrec [GetFindingsStatistics]
readPrec :: ReadPrec GetFindingsStatistics
$creadPrec :: ReadPrec GetFindingsStatistics
readList :: ReadS [GetFindingsStatistics]
$creadList :: ReadS [GetFindingsStatistics]
readsPrec :: Int -> ReadS GetFindingsStatistics
$creadsPrec :: Int -> ReadS GetFindingsStatistics
Prelude.Read, Int -> GetFindingsStatistics -> ShowS
[GetFindingsStatistics] -> ShowS
GetFindingsStatistics -> String
(Int -> GetFindingsStatistics -> ShowS)
-> (GetFindingsStatistics -> String)
-> ([GetFindingsStatistics] -> ShowS)
-> Show GetFindingsStatistics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFindingsStatistics] -> ShowS
$cshowList :: [GetFindingsStatistics] -> ShowS
show :: GetFindingsStatistics -> String
$cshow :: GetFindingsStatistics -> String
showsPrec :: Int -> GetFindingsStatistics -> ShowS
$cshowsPrec :: Int -> GetFindingsStatistics -> ShowS
Prelude.Show, (forall x. GetFindingsStatistics -> Rep GetFindingsStatistics x)
-> (forall x. Rep GetFindingsStatistics x -> GetFindingsStatistics)
-> Generic GetFindingsStatistics
forall x. Rep GetFindingsStatistics x -> GetFindingsStatistics
forall x. GetFindingsStatistics -> Rep GetFindingsStatistics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetFindingsStatistics x -> GetFindingsStatistics
$cfrom :: forall x. GetFindingsStatistics -> Rep GetFindingsStatistics x
Prelude.Generic)
newGetFindingsStatistics ::
Prelude.Text ->
GetFindingsStatistics
newGetFindingsStatistics :: Text -> GetFindingsStatistics
newGetFindingsStatistics Text
pDetectorId_ =
GetFindingsStatistics' :: Maybe FindingCriteria
-> Text -> [FindingStatisticType] -> GetFindingsStatistics
GetFindingsStatistics'
{ $sel:findingCriteria:GetFindingsStatistics' :: Maybe FindingCriteria
findingCriteria =
Maybe FindingCriteria
forall a. Maybe a
Prelude.Nothing,
$sel:detectorId:GetFindingsStatistics' :: Text
detectorId = Text
pDetectorId_,
$sel:findingStatisticTypes:GetFindingsStatistics' :: [FindingStatisticType]
findingStatisticTypes = [FindingStatisticType]
forall a. Monoid a => a
Prelude.mempty
}
getFindingsStatistics_findingCriteria :: Lens.Lens' GetFindingsStatistics (Prelude.Maybe FindingCriteria)
getFindingsStatistics_findingCriteria :: (Maybe FindingCriteria -> f (Maybe FindingCriteria))
-> GetFindingsStatistics -> f GetFindingsStatistics
getFindingsStatistics_findingCriteria = (GetFindingsStatistics -> Maybe FindingCriteria)
-> (GetFindingsStatistics
-> Maybe FindingCriteria -> GetFindingsStatistics)
-> Lens
GetFindingsStatistics
GetFindingsStatistics
(Maybe FindingCriteria)
(Maybe FindingCriteria)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindingsStatistics' {Maybe FindingCriteria
findingCriteria :: Maybe FindingCriteria
$sel:findingCriteria:GetFindingsStatistics' :: GetFindingsStatistics -> Maybe FindingCriteria
findingCriteria} -> Maybe FindingCriteria
findingCriteria) (\s :: GetFindingsStatistics
s@GetFindingsStatistics' {} Maybe FindingCriteria
a -> GetFindingsStatistics
s {$sel:findingCriteria:GetFindingsStatistics' :: Maybe FindingCriteria
findingCriteria = Maybe FindingCriteria
a} :: GetFindingsStatistics)
getFindingsStatistics_detectorId :: Lens.Lens' GetFindingsStatistics Prelude.Text
getFindingsStatistics_detectorId :: (Text -> f Text)
-> GetFindingsStatistics -> f GetFindingsStatistics
getFindingsStatistics_detectorId = (GetFindingsStatistics -> Text)
-> (GetFindingsStatistics -> Text -> GetFindingsStatistics)
-> Lens GetFindingsStatistics GetFindingsStatistics Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindingsStatistics' {Text
detectorId :: Text
$sel:detectorId:GetFindingsStatistics' :: GetFindingsStatistics -> Text
detectorId} -> Text
detectorId) (\s :: GetFindingsStatistics
s@GetFindingsStatistics' {} Text
a -> GetFindingsStatistics
s {$sel:detectorId:GetFindingsStatistics' :: Text
detectorId = Text
a} :: GetFindingsStatistics)
getFindingsStatistics_findingStatisticTypes :: Lens.Lens' GetFindingsStatistics [FindingStatisticType]
getFindingsStatistics_findingStatisticTypes :: ([FindingStatisticType] -> f [FindingStatisticType])
-> GetFindingsStatistics -> f GetFindingsStatistics
getFindingsStatistics_findingStatisticTypes = (GetFindingsStatistics -> [FindingStatisticType])
-> (GetFindingsStatistics
-> [FindingStatisticType] -> GetFindingsStatistics)
-> Lens
GetFindingsStatistics
GetFindingsStatistics
[FindingStatisticType]
[FindingStatisticType]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindingsStatistics' {[FindingStatisticType]
findingStatisticTypes :: [FindingStatisticType]
$sel:findingStatisticTypes:GetFindingsStatistics' :: GetFindingsStatistics -> [FindingStatisticType]
findingStatisticTypes} -> [FindingStatisticType]
findingStatisticTypes) (\s :: GetFindingsStatistics
s@GetFindingsStatistics' {} [FindingStatisticType]
a -> GetFindingsStatistics
s {$sel:findingStatisticTypes:GetFindingsStatistics' :: [FindingStatisticType]
findingStatisticTypes = [FindingStatisticType]
a} :: GetFindingsStatistics) (([FindingStatisticType] -> f [FindingStatisticType])
-> GetFindingsStatistics -> f GetFindingsStatistics)
-> (([FindingStatisticType] -> f [FindingStatisticType])
-> [FindingStatisticType] -> f [FindingStatisticType])
-> ([FindingStatisticType] -> f [FindingStatisticType])
-> GetFindingsStatistics
-> f GetFindingsStatistics
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([FindingStatisticType] -> f [FindingStatisticType])
-> [FindingStatisticType] -> f [FindingStatisticType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest GetFindingsStatistics where
type
AWSResponse GetFindingsStatistics =
GetFindingsStatisticsResponse
request :: GetFindingsStatistics -> Request GetFindingsStatistics
request = Service -> GetFindingsStatistics -> Request GetFindingsStatistics
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetFindingsStatistics
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetFindingsStatistics)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetFindingsStatistics))
-> Logger
-> Service
-> Proxy GetFindingsStatistics
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetFindingsStatistics)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> FindingStatistics -> GetFindingsStatisticsResponse
GetFindingsStatisticsResponse'
(Int -> FindingStatistics -> GetFindingsStatisticsResponse)
-> Either String Int
-> Either
String (FindingStatistics -> GetFindingsStatisticsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
Either String (FindingStatistics -> GetFindingsStatisticsResponse)
-> Either String FindingStatistics
-> Either String GetFindingsStatisticsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String FindingStatistics
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"findingStatistics")
)
instance Prelude.Hashable GetFindingsStatistics
instance Prelude.NFData GetFindingsStatistics
instance Core.ToHeaders GetFindingsStatistics where
toHeaders :: GetFindingsStatistics -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetFindingsStatistics -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON GetFindingsStatistics where
toJSON :: GetFindingsStatistics -> Value
toJSON GetFindingsStatistics' {[FindingStatisticType]
Maybe FindingCriteria
Text
findingStatisticTypes :: [FindingStatisticType]
detectorId :: Text
findingCriteria :: Maybe FindingCriteria
$sel:findingStatisticTypes:GetFindingsStatistics' :: GetFindingsStatistics -> [FindingStatisticType]
$sel:detectorId:GetFindingsStatistics' :: GetFindingsStatistics -> Text
$sel:findingCriteria:GetFindingsStatistics' :: GetFindingsStatistics -> Maybe FindingCriteria
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"findingCriteria" Text -> FindingCriteria -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(FindingCriteria -> Pair) -> Maybe FindingCriteria -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FindingCriteria
findingCriteria,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"findingStatisticTypes"
Text -> [FindingStatisticType] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [FindingStatisticType]
findingStatisticTypes
)
]
)
instance Core.ToPath GetFindingsStatistics where
toPath :: GetFindingsStatistics -> ByteString
toPath GetFindingsStatistics' {[FindingStatisticType]
Maybe FindingCriteria
Text
findingStatisticTypes :: [FindingStatisticType]
detectorId :: Text
findingCriteria :: Maybe FindingCriteria
$sel:findingStatisticTypes:GetFindingsStatistics' :: GetFindingsStatistics -> [FindingStatisticType]
$sel:detectorId:GetFindingsStatistics' :: GetFindingsStatistics -> Text
$sel:findingCriteria:GetFindingsStatistics' :: GetFindingsStatistics -> Maybe FindingCriteria
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/detector/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
detectorId,
ByteString
"/findings/statistics"
]
instance Core.ToQuery GetFindingsStatistics where
toQuery :: GetFindingsStatistics -> QueryString
toQuery = QueryString -> GetFindingsStatistics -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetFindingsStatisticsResponse = GetFindingsStatisticsResponse'
{
GetFindingsStatisticsResponse -> Int
httpStatus :: Prelude.Int,
GetFindingsStatisticsResponse -> FindingStatistics
findingStatistics :: FindingStatistics
}
deriving (GetFindingsStatisticsResponse
-> GetFindingsStatisticsResponse -> Bool
(GetFindingsStatisticsResponse
-> GetFindingsStatisticsResponse -> Bool)
-> (GetFindingsStatisticsResponse
-> GetFindingsStatisticsResponse -> Bool)
-> Eq GetFindingsStatisticsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFindingsStatisticsResponse
-> GetFindingsStatisticsResponse -> Bool
$c/= :: GetFindingsStatisticsResponse
-> GetFindingsStatisticsResponse -> Bool
== :: GetFindingsStatisticsResponse
-> GetFindingsStatisticsResponse -> Bool
$c== :: GetFindingsStatisticsResponse
-> GetFindingsStatisticsResponse -> Bool
Prelude.Eq, ReadPrec [GetFindingsStatisticsResponse]
ReadPrec GetFindingsStatisticsResponse
Int -> ReadS GetFindingsStatisticsResponse
ReadS [GetFindingsStatisticsResponse]
(Int -> ReadS GetFindingsStatisticsResponse)
-> ReadS [GetFindingsStatisticsResponse]
-> ReadPrec GetFindingsStatisticsResponse
-> ReadPrec [GetFindingsStatisticsResponse]
-> Read GetFindingsStatisticsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFindingsStatisticsResponse]
$creadListPrec :: ReadPrec [GetFindingsStatisticsResponse]
readPrec :: ReadPrec GetFindingsStatisticsResponse
$creadPrec :: ReadPrec GetFindingsStatisticsResponse
readList :: ReadS [GetFindingsStatisticsResponse]
$creadList :: ReadS [GetFindingsStatisticsResponse]
readsPrec :: Int -> ReadS GetFindingsStatisticsResponse
$creadsPrec :: Int -> ReadS GetFindingsStatisticsResponse
Prelude.Read, Int -> GetFindingsStatisticsResponse -> ShowS
[GetFindingsStatisticsResponse] -> ShowS
GetFindingsStatisticsResponse -> String
(Int -> GetFindingsStatisticsResponse -> ShowS)
-> (GetFindingsStatisticsResponse -> String)
-> ([GetFindingsStatisticsResponse] -> ShowS)
-> Show GetFindingsStatisticsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFindingsStatisticsResponse] -> ShowS
$cshowList :: [GetFindingsStatisticsResponse] -> ShowS
show :: GetFindingsStatisticsResponse -> String
$cshow :: GetFindingsStatisticsResponse -> String
showsPrec :: Int -> GetFindingsStatisticsResponse -> ShowS
$cshowsPrec :: Int -> GetFindingsStatisticsResponse -> ShowS
Prelude.Show, (forall x.
GetFindingsStatisticsResponse
-> Rep GetFindingsStatisticsResponse x)
-> (forall x.
Rep GetFindingsStatisticsResponse x
-> GetFindingsStatisticsResponse)
-> Generic GetFindingsStatisticsResponse
forall x.
Rep GetFindingsStatisticsResponse x
-> GetFindingsStatisticsResponse
forall x.
GetFindingsStatisticsResponse
-> Rep GetFindingsStatisticsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetFindingsStatisticsResponse x
-> GetFindingsStatisticsResponse
$cfrom :: forall x.
GetFindingsStatisticsResponse
-> Rep GetFindingsStatisticsResponse x
Prelude.Generic)
newGetFindingsStatisticsResponse ::
Prelude.Int ->
FindingStatistics ->
GetFindingsStatisticsResponse
newGetFindingsStatisticsResponse :: Int -> FindingStatistics -> GetFindingsStatisticsResponse
newGetFindingsStatisticsResponse
Int
pHttpStatus_
FindingStatistics
pFindingStatistics_ =
GetFindingsStatisticsResponse' :: Int -> FindingStatistics -> GetFindingsStatisticsResponse
GetFindingsStatisticsResponse'
{ $sel:httpStatus:GetFindingsStatisticsResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:findingStatistics:GetFindingsStatisticsResponse' :: FindingStatistics
findingStatistics = FindingStatistics
pFindingStatistics_
}
getFindingsStatisticsResponse_httpStatus :: Lens.Lens' GetFindingsStatisticsResponse Prelude.Int
getFindingsStatisticsResponse_httpStatus :: (Int -> f Int)
-> GetFindingsStatisticsResponse -> f GetFindingsStatisticsResponse
getFindingsStatisticsResponse_httpStatus = (GetFindingsStatisticsResponse -> Int)
-> (GetFindingsStatisticsResponse
-> Int -> GetFindingsStatisticsResponse)
-> Lens
GetFindingsStatisticsResponse GetFindingsStatisticsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindingsStatisticsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetFindingsStatisticsResponse' :: GetFindingsStatisticsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetFindingsStatisticsResponse
s@GetFindingsStatisticsResponse' {} Int
a -> GetFindingsStatisticsResponse
s {$sel:httpStatus:GetFindingsStatisticsResponse' :: Int
httpStatus = Int
a} :: GetFindingsStatisticsResponse)
getFindingsStatisticsResponse_findingStatistics :: Lens.Lens' GetFindingsStatisticsResponse FindingStatistics
getFindingsStatisticsResponse_findingStatistics :: (FindingStatistics -> f FindingStatistics)
-> GetFindingsStatisticsResponse -> f GetFindingsStatisticsResponse
getFindingsStatisticsResponse_findingStatistics = (GetFindingsStatisticsResponse -> FindingStatistics)
-> (GetFindingsStatisticsResponse
-> FindingStatistics -> GetFindingsStatisticsResponse)
-> Lens
GetFindingsStatisticsResponse
GetFindingsStatisticsResponse
FindingStatistics
FindingStatistics
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindingsStatisticsResponse' {FindingStatistics
findingStatistics :: FindingStatistics
$sel:findingStatistics:GetFindingsStatisticsResponse' :: GetFindingsStatisticsResponse -> FindingStatistics
findingStatistics} -> FindingStatistics
findingStatistics) (\s :: GetFindingsStatisticsResponse
s@GetFindingsStatisticsResponse' {} FindingStatistics
a -> GetFindingsStatisticsResponse
s {$sel:findingStatistics:GetFindingsStatisticsResponse' :: FindingStatistics
findingStatistics = FindingStatistics
a} :: GetFindingsStatisticsResponse)
instance Prelude.NFData GetFindingsStatisticsResponse