{-# 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.Inspector.DescribeFindings
(
DescribeFindings (..),
newDescribeFindings,
describeFindings_locale,
describeFindings_findingArns,
DescribeFindingsResponse (..),
newDescribeFindingsResponse,
describeFindingsResponse_httpStatus,
describeFindingsResponse_findings,
describeFindingsResponse_failedItems,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Inspector.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 DescribeFindings = DescribeFindings'
{
DescribeFindings -> Maybe Locale
locale :: Prelude.Maybe Locale,
DescribeFindings -> NonEmpty Text
findingArns :: Prelude.NonEmpty Prelude.Text
}
deriving (DescribeFindings -> DescribeFindings -> Bool
(DescribeFindings -> DescribeFindings -> Bool)
-> (DescribeFindings -> DescribeFindings -> Bool)
-> Eq DescribeFindings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFindings -> DescribeFindings -> Bool
$c/= :: DescribeFindings -> DescribeFindings -> Bool
== :: DescribeFindings -> DescribeFindings -> Bool
$c== :: DescribeFindings -> DescribeFindings -> Bool
Prelude.Eq, ReadPrec [DescribeFindings]
ReadPrec DescribeFindings
Int -> ReadS DescribeFindings
ReadS [DescribeFindings]
(Int -> ReadS DescribeFindings)
-> ReadS [DescribeFindings]
-> ReadPrec DescribeFindings
-> ReadPrec [DescribeFindings]
-> Read DescribeFindings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeFindings]
$creadListPrec :: ReadPrec [DescribeFindings]
readPrec :: ReadPrec DescribeFindings
$creadPrec :: ReadPrec DescribeFindings
readList :: ReadS [DescribeFindings]
$creadList :: ReadS [DescribeFindings]
readsPrec :: Int -> ReadS DescribeFindings
$creadsPrec :: Int -> ReadS DescribeFindings
Prelude.Read, Int -> DescribeFindings -> ShowS
[DescribeFindings] -> ShowS
DescribeFindings -> String
(Int -> DescribeFindings -> ShowS)
-> (DescribeFindings -> String)
-> ([DescribeFindings] -> ShowS)
-> Show DescribeFindings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFindings] -> ShowS
$cshowList :: [DescribeFindings] -> ShowS
show :: DescribeFindings -> String
$cshow :: DescribeFindings -> String
showsPrec :: Int -> DescribeFindings -> ShowS
$cshowsPrec :: Int -> DescribeFindings -> ShowS
Prelude.Show, (forall x. DescribeFindings -> Rep DescribeFindings x)
-> (forall x. Rep DescribeFindings x -> DescribeFindings)
-> Generic DescribeFindings
forall x. Rep DescribeFindings x -> DescribeFindings
forall x. DescribeFindings -> Rep DescribeFindings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeFindings x -> DescribeFindings
$cfrom :: forall x. DescribeFindings -> Rep DescribeFindings x
Prelude.Generic)
newDescribeFindings ::
Prelude.NonEmpty Prelude.Text ->
DescribeFindings
newDescribeFindings :: NonEmpty Text -> DescribeFindings
newDescribeFindings NonEmpty Text
pFindingArns_ =
DescribeFindings' :: Maybe Locale -> NonEmpty Text -> DescribeFindings
DescribeFindings'
{ $sel:locale:DescribeFindings' :: Maybe Locale
locale = Maybe Locale
forall a. Maybe a
Prelude.Nothing,
$sel:findingArns:DescribeFindings' :: NonEmpty Text
findingArns = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pFindingArns_
}
describeFindings_locale :: Lens.Lens' DescribeFindings (Prelude.Maybe Locale)
describeFindings_locale :: (Maybe Locale -> f (Maybe Locale))
-> DescribeFindings -> f DescribeFindings
describeFindings_locale = (DescribeFindings -> Maybe Locale)
-> (DescribeFindings -> Maybe Locale -> DescribeFindings)
-> Lens
DescribeFindings DescribeFindings (Maybe Locale) (Maybe Locale)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFindings' {Maybe Locale
locale :: Maybe Locale
$sel:locale:DescribeFindings' :: DescribeFindings -> Maybe Locale
locale} -> Maybe Locale
locale) (\s :: DescribeFindings
s@DescribeFindings' {} Maybe Locale
a -> DescribeFindings
s {$sel:locale:DescribeFindings' :: Maybe Locale
locale = Maybe Locale
a} :: DescribeFindings)
describeFindings_findingArns :: Lens.Lens' DescribeFindings (Prelude.NonEmpty Prelude.Text)
describeFindings_findingArns :: (NonEmpty Text -> f (NonEmpty Text))
-> DescribeFindings -> f DescribeFindings
describeFindings_findingArns = (DescribeFindings -> NonEmpty Text)
-> (DescribeFindings -> NonEmpty Text -> DescribeFindings)
-> Lens
DescribeFindings DescribeFindings (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFindings' {NonEmpty Text
findingArns :: NonEmpty Text
$sel:findingArns:DescribeFindings' :: DescribeFindings -> NonEmpty Text
findingArns} -> NonEmpty Text
findingArns) (\s :: DescribeFindings
s@DescribeFindings' {} NonEmpty Text
a -> DescribeFindings
s {$sel:findingArns:DescribeFindings' :: NonEmpty Text
findingArns = NonEmpty Text
a} :: DescribeFindings) ((NonEmpty Text -> f (NonEmpty Text))
-> DescribeFindings -> f DescribeFindings)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> DescribeFindings
-> f DescribeFindings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest DescribeFindings where
type
AWSResponse DescribeFindings =
DescribeFindingsResponse
request :: DescribeFindings -> Request DescribeFindings
request = Service -> DescribeFindings -> Request DescribeFindings
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeFindings
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeFindings)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeFindings))
-> Logger
-> Service
-> Proxy DescribeFindings
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeFindings)))
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
-> [Finding]
-> HashMap Text FailedItemDetails
-> DescribeFindingsResponse
DescribeFindingsResponse'
(Int
-> [Finding]
-> HashMap Text FailedItemDetails
-> DescribeFindingsResponse)
-> Either String Int
-> Either
String
([Finding]
-> HashMap Text FailedItemDetails -> DescribeFindingsResponse)
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
([Finding]
-> HashMap Text FailedItemDetails -> DescribeFindingsResponse)
-> Either String [Finding]
-> Either
String (HashMap Text FailedItemDetails -> DescribeFindingsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [Finding])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"findings" Either String (Maybe [Finding])
-> [Finding] -> Either String [Finding]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Finding]
forall a. Monoid a => a
Prelude.mempty)
Either
String (HashMap Text FailedItemDetails -> DescribeFindingsResponse)
-> Either String (HashMap Text FailedItemDetails)
-> Either String DescribeFindingsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Either String (Maybe (HashMap Text FailedItemDetails))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"failedItems" Either String (Maybe (HashMap Text FailedItemDetails))
-> HashMap Text FailedItemDetails
-> Either String (HashMap Text FailedItemDetails)
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ HashMap Text FailedItemDetails
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable DescribeFindings
instance Prelude.NFData DescribeFindings
instance Core.ToHeaders DescribeFindings where
toHeaders :: DescribeFindings -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeFindings -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"InspectorService.DescribeFindings" ::
Prelude.ByteString
),
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 DescribeFindings where
toJSON :: DescribeFindings -> Value
toJSON DescribeFindings' {Maybe Locale
NonEmpty Text
findingArns :: NonEmpty Text
locale :: Maybe Locale
$sel:findingArns:DescribeFindings' :: DescribeFindings -> NonEmpty Text
$sel:locale:DescribeFindings' :: DescribeFindings -> Maybe Locale
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"locale" Text -> Locale -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Locale -> Pair) -> Maybe Locale -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Locale
locale,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"findingArns" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
findingArns)
]
)
instance Core.ToPath DescribeFindings where
toPath :: DescribeFindings -> ByteString
toPath = ByteString -> DescribeFindings -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeFindings where
toQuery :: DescribeFindings -> QueryString
toQuery = QueryString -> DescribeFindings -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeFindingsResponse = DescribeFindingsResponse'
{
DescribeFindingsResponse -> Int
httpStatus :: Prelude.Int,
DescribeFindingsResponse -> [Finding]
findings :: [Finding],
DescribeFindingsResponse -> HashMap Text FailedItemDetails
failedItems :: Prelude.HashMap Prelude.Text FailedItemDetails
}
deriving (DescribeFindingsResponse -> DescribeFindingsResponse -> Bool
(DescribeFindingsResponse -> DescribeFindingsResponse -> Bool)
-> (DescribeFindingsResponse -> DescribeFindingsResponse -> Bool)
-> Eq DescribeFindingsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFindingsResponse -> DescribeFindingsResponse -> Bool
$c/= :: DescribeFindingsResponse -> DescribeFindingsResponse -> Bool
== :: DescribeFindingsResponse -> DescribeFindingsResponse -> Bool
$c== :: DescribeFindingsResponse -> DescribeFindingsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeFindingsResponse]
ReadPrec DescribeFindingsResponse
Int -> ReadS DescribeFindingsResponse
ReadS [DescribeFindingsResponse]
(Int -> ReadS DescribeFindingsResponse)
-> ReadS [DescribeFindingsResponse]
-> ReadPrec DescribeFindingsResponse
-> ReadPrec [DescribeFindingsResponse]
-> Read DescribeFindingsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeFindingsResponse]
$creadListPrec :: ReadPrec [DescribeFindingsResponse]
readPrec :: ReadPrec DescribeFindingsResponse
$creadPrec :: ReadPrec DescribeFindingsResponse
readList :: ReadS [DescribeFindingsResponse]
$creadList :: ReadS [DescribeFindingsResponse]
readsPrec :: Int -> ReadS DescribeFindingsResponse
$creadsPrec :: Int -> ReadS DescribeFindingsResponse
Prelude.Read, Int -> DescribeFindingsResponse -> ShowS
[DescribeFindingsResponse] -> ShowS
DescribeFindingsResponse -> String
(Int -> DescribeFindingsResponse -> ShowS)
-> (DescribeFindingsResponse -> String)
-> ([DescribeFindingsResponse] -> ShowS)
-> Show DescribeFindingsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFindingsResponse] -> ShowS
$cshowList :: [DescribeFindingsResponse] -> ShowS
show :: DescribeFindingsResponse -> String
$cshow :: DescribeFindingsResponse -> String
showsPrec :: Int -> DescribeFindingsResponse -> ShowS
$cshowsPrec :: Int -> DescribeFindingsResponse -> ShowS
Prelude.Show, (forall x.
DescribeFindingsResponse -> Rep DescribeFindingsResponse x)
-> (forall x.
Rep DescribeFindingsResponse x -> DescribeFindingsResponse)
-> Generic DescribeFindingsResponse
forall x.
Rep DescribeFindingsResponse x -> DescribeFindingsResponse
forall x.
DescribeFindingsResponse -> Rep DescribeFindingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeFindingsResponse x -> DescribeFindingsResponse
$cfrom :: forall x.
DescribeFindingsResponse -> Rep DescribeFindingsResponse x
Prelude.Generic)
newDescribeFindingsResponse ::
Prelude.Int ->
DescribeFindingsResponse
newDescribeFindingsResponse :: Int -> DescribeFindingsResponse
newDescribeFindingsResponse Int
pHttpStatus_ =
DescribeFindingsResponse' :: Int
-> [Finding]
-> HashMap Text FailedItemDetails
-> DescribeFindingsResponse
DescribeFindingsResponse'
{ $sel:httpStatus:DescribeFindingsResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:findings:DescribeFindingsResponse' :: [Finding]
findings = [Finding]
forall a. Monoid a => a
Prelude.mempty,
$sel:failedItems:DescribeFindingsResponse' :: HashMap Text FailedItemDetails
failedItems = HashMap Text FailedItemDetails
forall a. Monoid a => a
Prelude.mempty
}
describeFindingsResponse_httpStatus :: Lens.Lens' DescribeFindingsResponse Prelude.Int
describeFindingsResponse_httpStatus :: (Int -> f Int)
-> DescribeFindingsResponse -> f DescribeFindingsResponse
describeFindingsResponse_httpStatus = (DescribeFindingsResponse -> Int)
-> (DescribeFindingsResponse -> Int -> DescribeFindingsResponse)
-> Lens DescribeFindingsResponse DescribeFindingsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFindingsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeFindingsResponse' :: DescribeFindingsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeFindingsResponse
s@DescribeFindingsResponse' {} Int
a -> DescribeFindingsResponse
s {$sel:httpStatus:DescribeFindingsResponse' :: Int
httpStatus = Int
a} :: DescribeFindingsResponse)
describeFindingsResponse_findings :: Lens.Lens' DescribeFindingsResponse [Finding]
describeFindingsResponse_findings :: ([Finding] -> f [Finding])
-> DescribeFindingsResponse -> f DescribeFindingsResponse
describeFindingsResponse_findings = (DescribeFindingsResponse -> [Finding])
-> (DescribeFindingsResponse
-> [Finding] -> DescribeFindingsResponse)
-> Lens
DescribeFindingsResponse
DescribeFindingsResponse
[Finding]
[Finding]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFindingsResponse' {[Finding]
findings :: [Finding]
$sel:findings:DescribeFindingsResponse' :: DescribeFindingsResponse -> [Finding]
findings} -> [Finding]
findings) (\s :: DescribeFindingsResponse
s@DescribeFindingsResponse' {} [Finding]
a -> DescribeFindingsResponse
s {$sel:findings:DescribeFindingsResponse' :: [Finding]
findings = [Finding]
a} :: DescribeFindingsResponse) (([Finding] -> f [Finding])
-> DescribeFindingsResponse -> f DescribeFindingsResponse)
-> (([Finding] -> f [Finding]) -> [Finding] -> f [Finding])
-> ([Finding] -> f [Finding])
-> DescribeFindingsResponse
-> f DescribeFindingsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Finding] -> f [Finding]) -> [Finding] -> f [Finding]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeFindingsResponse_failedItems :: Lens.Lens' DescribeFindingsResponse (Prelude.HashMap Prelude.Text FailedItemDetails)
describeFindingsResponse_failedItems :: (HashMap Text FailedItemDetails
-> f (HashMap Text FailedItemDetails))
-> DescribeFindingsResponse -> f DescribeFindingsResponse
describeFindingsResponse_failedItems = (DescribeFindingsResponse -> HashMap Text FailedItemDetails)
-> (DescribeFindingsResponse
-> HashMap Text FailedItemDetails -> DescribeFindingsResponse)
-> Lens
DescribeFindingsResponse
DescribeFindingsResponse
(HashMap Text FailedItemDetails)
(HashMap Text FailedItemDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFindingsResponse' {HashMap Text FailedItemDetails
failedItems :: HashMap Text FailedItemDetails
$sel:failedItems:DescribeFindingsResponse' :: DescribeFindingsResponse -> HashMap Text FailedItemDetails
failedItems} -> HashMap Text FailedItemDetails
failedItems) (\s :: DescribeFindingsResponse
s@DescribeFindingsResponse' {} HashMap Text FailedItemDetails
a -> DescribeFindingsResponse
s {$sel:failedItems:DescribeFindingsResponse' :: HashMap Text FailedItemDetails
failedItems = HashMap Text FailedItemDetails
a} :: DescribeFindingsResponse) ((HashMap Text FailedItemDetails
-> f (HashMap Text FailedItemDetails))
-> DescribeFindingsResponse -> f DescribeFindingsResponse)
-> ((HashMap Text FailedItemDetails
-> f (HashMap Text FailedItemDetails))
-> HashMap Text FailedItemDetails
-> f (HashMap Text FailedItemDetails))
-> (HashMap Text FailedItemDetails
-> f (HashMap Text FailedItemDetails))
-> DescribeFindingsResponse
-> f DescribeFindingsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text FailedItemDetails
-> f (HashMap Text FailedItemDetails))
-> HashMap Text FailedItemDetails
-> f (HashMap Text FailedItemDetails)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData DescribeFindingsResponse