{-# 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.GetFindings
(
GetFindings (..),
newGetFindings,
getFindings_sortCriteria,
getFindings_detectorId,
getFindings_findingIds,
GetFindingsResponse (..),
newGetFindingsResponse,
getFindingsResponse_httpStatus,
getFindingsResponse_findings,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GuardDuty.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetFindings = GetFindings'
{
GetFindings -> Maybe SortCriteria
sortCriteria :: Prelude.Maybe SortCriteria,
GetFindings -> Text
detectorId :: Prelude.Text,
GetFindings -> [Text]
findingIds :: [Prelude.Text]
}
deriving (GetFindings -> GetFindings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFindings -> GetFindings -> Bool
$c/= :: GetFindings -> GetFindings -> Bool
== :: GetFindings -> GetFindings -> Bool
$c== :: GetFindings -> GetFindings -> Bool
Prelude.Eq, ReadPrec [GetFindings]
ReadPrec GetFindings
Int -> ReadS GetFindings
ReadS [GetFindings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFindings]
$creadListPrec :: ReadPrec [GetFindings]
readPrec :: ReadPrec GetFindings
$creadPrec :: ReadPrec GetFindings
readList :: ReadS [GetFindings]
$creadList :: ReadS [GetFindings]
readsPrec :: Int -> ReadS GetFindings
$creadsPrec :: Int -> ReadS GetFindings
Prelude.Read, Int -> GetFindings -> ShowS
[GetFindings] -> ShowS
GetFindings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFindings] -> ShowS
$cshowList :: [GetFindings] -> ShowS
show :: GetFindings -> String
$cshow :: GetFindings -> String
showsPrec :: Int -> GetFindings -> ShowS
$cshowsPrec :: Int -> GetFindings -> ShowS
Prelude.Show, forall x. Rep GetFindings x -> GetFindings
forall x. GetFindings -> Rep GetFindings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetFindings x -> GetFindings
$cfrom :: forall x. GetFindings -> Rep GetFindings x
Prelude.Generic)
newGetFindings ::
Prelude.Text ->
GetFindings
newGetFindings :: Text -> GetFindings
newGetFindings Text
pDetectorId_ =
GetFindings'
{ $sel:sortCriteria:GetFindings' :: Maybe SortCriteria
sortCriteria = forall a. Maybe a
Prelude.Nothing,
$sel:detectorId:GetFindings' :: Text
detectorId = Text
pDetectorId_,
$sel:findingIds:GetFindings' :: [Text]
findingIds = forall a. Monoid a => a
Prelude.mempty
}
getFindings_sortCriteria :: Lens.Lens' GetFindings (Prelude.Maybe SortCriteria)
getFindings_sortCriteria :: Lens' GetFindings (Maybe SortCriteria)
getFindings_sortCriteria = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindings' {Maybe SortCriteria
sortCriteria :: Maybe SortCriteria
$sel:sortCriteria:GetFindings' :: GetFindings -> Maybe SortCriteria
sortCriteria} -> Maybe SortCriteria
sortCriteria) (\s :: GetFindings
s@GetFindings' {} Maybe SortCriteria
a -> GetFindings
s {$sel:sortCriteria:GetFindings' :: Maybe SortCriteria
sortCriteria = Maybe SortCriteria
a} :: GetFindings)
getFindings_detectorId :: Lens.Lens' GetFindings Prelude.Text
getFindings_detectorId :: Lens' GetFindings Text
getFindings_detectorId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindings' {Text
detectorId :: Text
$sel:detectorId:GetFindings' :: GetFindings -> Text
detectorId} -> Text
detectorId) (\s :: GetFindings
s@GetFindings' {} Text
a -> GetFindings
s {$sel:detectorId:GetFindings' :: Text
detectorId = Text
a} :: GetFindings)
getFindings_findingIds :: Lens.Lens' GetFindings [Prelude.Text]
getFindings_findingIds :: Lens' GetFindings [Text]
getFindings_findingIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindings' {[Text]
findingIds :: [Text]
$sel:findingIds:GetFindings' :: GetFindings -> [Text]
findingIds} -> [Text]
findingIds) (\s :: GetFindings
s@GetFindings' {} [Text]
a -> GetFindings
s {$sel:findingIds:GetFindings' :: [Text]
findingIds = [Text]
a} :: GetFindings) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest GetFindings where
type AWSResponse GetFindings = GetFindingsResponse
request :: (Service -> Service) -> GetFindings -> Request GetFindings
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetFindings
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetFindings)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> [Finding] -> GetFindingsResponse
GetFindingsResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"findings" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable GetFindings where
hashWithSalt :: Int -> GetFindings -> Int
hashWithSalt Int
_salt GetFindings' {[Text]
Maybe SortCriteria
Text
findingIds :: [Text]
detectorId :: Text
sortCriteria :: Maybe SortCriteria
$sel:findingIds:GetFindings' :: GetFindings -> [Text]
$sel:detectorId:GetFindings' :: GetFindings -> Text
$sel:sortCriteria:GetFindings' :: GetFindings -> Maybe SortCriteria
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SortCriteria
sortCriteria
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
detectorId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
findingIds
instance Prelude.NFData GetFindings where
rnf :: GetFindings -> ()
rnf GetFindings' {[Text]
Maybe SortCriteria
Text
findingIds :: [Text]
detectorId :: Text
sortCriteria :: Maybe SortCriteria
$sel:findingIds:GetFindings' :: GetFindings -> [Text]
$sel:detectorId:GetFindings' :: GetFindings -> Text
$sel:sortCriteria:GetFindings' :: GetFindings -> Maybe SortCriteria
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe SortCriteria
sortCriteria
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
detectorId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
findingIds
instance Data.ToHeaders GetFindings where
toHeaders :: GetFindings -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetFindings where
toJSON :: GetFindings -> Value
toJSON GetFindings' {[Text]
Maybe SortCriteria
Text
findingIds :: [Text]
detectorId :: Text
sortCriteria :: Maybe SortCriteria
$sel:findingIds:GetFindings' :: GetFindings -> [Text]
$sel:detectorId:GetFindings' :: GetFindings -> Text
$sel:sortCriteria:GetFindings' :: GetFindings -> Maybe SortCriteria
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"sortCriteria" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SortCriteria
sortCriteria,
forall a. a -> Maybe a
Prelude.Just (Key
"findingIds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
findingIds)
]
)
instance Data.ToPath GetFindings where
toPath :: GetFindings -> ByteString
toPath GetFindings' {[Text]
Maybe SortCriteria
Text
findingIds :: [Text]
detectorId :: Text
sortCriteria :: Maybe SortCriteria
$sel:findingIds:GetFindings' :: GetFindings -> [Text]
$sel:detectorId:GetFindings' :: GetFindings -> Text
$sel:sortCriteria:GetFindings' :: GetFindings -> Maybe SortCriteria
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/detector/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
detectorId, ByteString
"/findings/get"]
instance Data.ToQuery GetFindings where
toQuery :: GetFindings -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetFindingsResponse = GetFindingsResponse'
{
GetFindingsResponse -> Int
httpStatus :: Prelude.Int,
GetFindingsResponse -> [Finding]
findings :: [Finding]
}
deriving (GetFindingsResponse -> GetFindingsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFindingsResponse -> GetFindingsResponse -> Bool
$c/= :: GetFindingsResponse -> GetFindingsResponse -> Bool
== :: GetFindingsResponse -> GetFindingsResponse -> Bool
$c== :: GetFindingsResponse -> GetFindingsResponse -> Bool
Prelude.Eq, ReadPrec [GetFindingsResponse]
ReadPrec GetFindingsResponse
Int -> ReadS GetFindingsResponse
ReadS [GetFindingsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFindingsResponse]
$creadListPrec :: ReadPrec [GetFindingsResponse]
readPrec :: ReadPrec GetFindingsResponse
$creadPrec :: ReadPrec GetFindingsResponse
readList :: ReadS [GetFindingsResponse]
$creadList :: ReadS [GetFindingsResponse]
readsPrec :: Int -> ReadS GetFindingsResponse
$creadsPrec :: Int -> ReadS GetFindingsResponse
Prelude.Read, Int -> GetFindingsResponse -> ShowS
[GetFindingsResponse] -> ShowS
GetFindingsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFindingsResponse] -> ShowS
$cshowList :: [GetFindingsResponse] -> ShowS
show :: GetFindingsResponse -> String
$cshow :: GetFindingsResponse -> String
showsPrec :: Int -> GetFindingsResponse -> ShowS
$cshowsPrec :: Int -> GetFindingsResponse -> ShowS
Prelude.Show, forall x. Rep GetFindingsResponse x -> GetFindingsResponse
forall x. GetFindingsResponse -> Rep GetFindingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetFindingsResponse x -> GetFindingsResponse
$cfrom :: forall x. GetFindingsResponse -> Rep GetFindingsResponse x
Prelude.Generic)
newGetFindingsResponse ::
Prelude.Int ->
GetFindingsResponse
newGetFindingsResponse :: Int -> GetFindingsResponse
newGetFindingsResponse Int
pHttpStatus_ =
GetFindingsResponse'
{ $sel:httpStatus:GetFindingsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:findings:GetFindingsResponse' :: [Finding]
findings = forall a. Monoid a => a
Prelude.mempty
}
getFindingsResponse_httpStatus :: Lens.Lens' GetFindingsResponse Prelude.Int
getFindingsResponse_httpStatus :: Lens' GetFindingsResponse Int
getFindingsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindingsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetFindingsResponse' :: GetFindingsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetFindingsResponse
s@GetFindingsResponse' {} Int
a -> GetFindingsResponse
s {$sel:httpStatus:GetFindingsResponse' :: Int
httpStatus = Int
a} :: GetFindingsResponse)
getFindingsResponse_findings :: Lens.Lens' GetFindingsResponse [Finding]
getFindingsResponse_findings :: Lens' GetFindingsResponse [Finding]
getFindingsResponse_findings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindingsResponse' {[Finding]
findings :: [Finding]
$sel:findings:GetFindingsResponse' :: GetFindingsResponse -> [Finding]
findings} -> [Finding]
findings) (\s :: GetFindingsResponse
s@GetFindingsResponse' {} [Finding]
a -> GetFindingsResponse
s {$sel:findings:GetFindingsResponse' :: [Finding]
findings = [Finding]
a} :: GetFindingsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData GetFindingsResponse where
rnf :: GetFindingsResponse -> ()
rnf GetFindingsResponse' {Int
[Finding]
findings :: [Finding]
httpStatus :: Int
$sel:findings:GetFindingsResponse' :: GetFindingsResponse -> [Finding]
$sel:httpStatus:GetFindingsResponse' :: GetFindingsResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Finding]
findings