{-# 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.MacieV2.GetFindings
(
GetFindings (..),
newGetFindings,
getFindings_sortCriteria,
getFindings_findingIds,
GetFindingsResponse (..),
newGetFindingsResponse,
getFindingsResponse_findings,
getFindingsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MacieV2.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]
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 ::
GetFindings
newGetFindings :: GetFindings
newGetFindings =
GetFindings'
{ $sel:sortCriteria:GetFindings' :: Maybe SortCriteria
sortCriteria = forall a. Maybe a
Prelude.Nothing,
$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_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 ->
Maybe [Finding] -> Int -> GetFindingsResponse
GetFindingsResponse'
forall (f :: * -> *) a b. Functor 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)
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable GetFindings where
hashWithSalt :: Int -> GetFindings -> Int
hashWithSalt Int
_salt GetFindings' {[Text]
Maybe SortCriteria
findingIds :: [Text]
sortCriteria :: Maybe SortCriteria
$sel:findingIds: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]
findingIds
instance Prelude.NFData GetFindings where
rnf :: GetFindings -> ()
rnf GetFindings' {[Text]
Maybe SortCriteria
findingIds :: [Text]
sortCriteria :: Maybe SortCriteria
$sel:findingIds: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]
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
findingIds :: [Text]
sortCriteria :: Maybe SortCriteria
$sel:findingIds: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 = forall a b. a -> b -> a
Prelude.const ByteString
"/findings/describe"
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 -> Maybe [Finding]
findings :: Prelude.Maybe [Finding],
GetFindingsResponse -> Int
httpStatus :: Prelude.Int
}
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:findings:GetFindingsResponse' :: Maybe [Finding]
findings = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetFindingsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getFindingsResponse_findings :: Lens.Lens' GetFindingsResponse (Prelude.Maybe [Finding])
getFindingsResponse_findings :: Lens' GetFindingsResponse (Maybe [Finding])
getFindingsResponse_findings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindingsResponse' {Maybe [Finding]
findings :: Maybe [Finding]
$sel:findings:GetFindingsResponse' :: GetFindingsResponse -> Maybe [Finding]
findings} -> Maybe [Finding]
findings) (\s :: GetFindingsResponse
s@GetFindingsResponse' {} Maybe [Finding]
a -> GetFindingsResponse
s {$sel:findings:GetFindingsResponse' :: Maybe [Finding]
findings = Maybe [Finding]
a} :: GetFindingsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
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)
instance Prelude.NFData GetFindingsResponse where
rnf :: GetFindingsResponse -> ()
rnf GetFindingsResponse' {Int
Maybe [Finding]
httpStatus :: Int
findings :: Maybe [Finding]
$sel:httpStatus:GetFindingsResponse' :: GetFindingsResponse -> Int
$sel:findings:GetFindingsResponse' :: GetFindingsResponse -> Maybe [Finding]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Finding]
findings
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus