{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.AccessAnalyzer.ListFindings
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves a list of findings generated by the specified analyzer.
--
-- To learn about filter keys that you can use to retrieve a list of
-- findings, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-reference-filter-keys.html IAM Access Analyzer filter keys>
-- in the __IAM User Guide__.
--
-- This operation returns paginated results.
module Amazonka.AccessAnalyzer.ListFindings
  ( -- * Creating a Request
    ListFindings (..),
    newListFindings,

    -- * Request Lenses
    listFindings_nextToken,
    listFindings_sort,
    listFindings_filter,
    listFindings_maxResults,
    listFindings_analyzerArn,

    -- * Destructuring the Response
    ListFindingsResponse (..),
    newListFindingsResponse,

    -- * Response Lenses
    listFindingsResponse_nextToken,
    listFindingsResponse_httpStatus,
    listFindingsResponse_findings,
  )
where

import Amazonka.AccessAnalyzer.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Retrieves a list of findings generated by the specified analyzer.
--
-- /See:/ 'newListFindings' smart constructor.
data ListFindings = ListFindings'
  { -- | A token used for pagination of results returned.
    ListFindings -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The sort order for the findings returned.
    ListFindings -> Maybe SortCriteria
sort :: Prelude.Maybe SortCriteria,
    -- | A filter to match for the findings to return.
    ListFindings -> Maybe (HashMap Text Criterion)
filter' :: Prelude.Maybe (Prelude.HashMap Prelude.Text Criterion),
    -- | The maximum number of results to return in the response.
    ListFindings -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | The
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-getting-started.html#permission-resources ARN of the analyzer>
    -- to retrieve findings from.
    ListFindings -> Text
analyzerArn :: Prelude.Text
  }
  deriving (ListFindings -> ListFindings -> Bool
(ListFindings -> ListFindings -> Bool)
-> (ListFindings -> ListFindings -> Bool) -> Eq ListFindings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListFindings -> ListFindings -> Bool
$c/= :: ListFindings -> ListFindings -> Bool
== :: ListFindings -> ListFindings -> Bool
$c== :: ListFindings -> ListFindings -> Bool
Prelude.Eq, ReadPrec [ListFindings]
ReadPrec ListFindings
Int -> ReadS ListFindings
ReadS [ListFindings]
(Int -> ReadS ListFindings)
-> ReadS [ListFindings]
-> ReadPrec ListFindings
-> ReadPrec [ListFindings]
-> Read ListFindings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListFindings]
$creadListPrec :: ReadPrec [ListFindings]
readPrec :: ReadPrec ListFindings
$creadPrec :: ReadPrec ListFindings
readList :: ReadS [ListFindings]
$creadList :: ReadS [ListFindings]
readsPrec :: Int -> ReadS ListFindings
$creadsPrec :: Int -> ReadS ListFindings
Prelude.Read, Int -> ListFindings -> ShowS
[ListFindings] -> ShowS
ListFindings -> String
(Int -> ListFindings -> ShowS)
-> (ListFindings -> String)
-> ([ListFindings] -> ShowS)
-> Show ListFindings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListFindings] -> ShowS
$cshowList :: [ListFindings] -> ShowS
show :: ListFindings -> String
$cshow :: ListFindings -> String
showsPrec :: Int -> ListFindings -> ShowS
$cshowsPrec :: Int -> ListFindings -> ShowS
Prelude.Show, (forall x. ListFindings -> Rep ListFindings x)
-> (forall x. Rep ListFindings x -> ListFindings)
-> Generic ListFindings
forall x. Rep ListFindings x -> ListFindings
forall x. ListFindings -> Rep ListFindings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListFindings x -> ListFindings
$cfrom :: forall x. ListFindings -> Rep ListFindings x
Prelude.Generic)

-- |
-- Create a value of 'ListFindings' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'listFindings_nextToken' - A token used for pagination of results returned.
--
-- 'sort', 'listFindings_sort' - The sort order for the findings returned.
--
-- 'filter'', 'listFindings_filter' - A filter to match for the findings to return.
--
-- 'maxResults', 'listFindings_maxResults' - The maximum number of results to return in the response.
--
-- 'analyzerArn', 'listFindings_analyzerArn' - The
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-getting-started.html#permission-resources ARN of the analyzer>
-- to retrieve findings from.
newListFindings ::
  -- | 'analyzerArn'
  Prelude.Text ->
  ListFindings
newListFindings :: Text -> ListFindings
newListFindings Text
pAnalyzerArn_ =
  ListFindings' :: Maybe Text
-> Maybe SortCriteria
-> Maybe (HashMap Text Criterion)
-> Maybe Int
-> Text
-> ListFindings
ListFindings'
    { $sel:nextToken:ListFindings' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sort:ListFindings' :: Maybe SortCriteria
sort = Maybe SortCriteria
forall a. Maybe a
Prelude.Nothing,
      $sel:filter':ListFindings' :: Maybe (HashMap Text Criterion)
filter' = Maybe (HashMap Text Criterion)
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListFindings' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:analyzerArn:ListFindings' :: Text
analyzerArn = Text
pAnalyzerArn_
    }

-- | A token used for pagination of results returned.
listFindings_nextToken :: Lens.Lens' ListFindings (Prelude.Maybe Prelude.Text)
listFindings_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListFindings -> f ListFindings
listFindings_nextToken = (ListFindings -> Maybe Text)
-> (ListFindings -> Maybe Text -> ListFindings)
-> Lens ListFindings ListFindings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFindings' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListFindings' :: ListFindings -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListFindings
s@ListFindings' {} Maybe Text
a -> ListFindings
s {$sel:nextToken:ListFindings' :: Maybe Text
nextToken = Maybe Text
a} :: ListFindings)

-- | The sort order for the findings returned.
listFindings_sort :: Lens.Lens' ListFindings (Prelude.Maybe SortCriteria)
listFindings_sort :: (Maybe SortCriteria -> f (Maybe SortCriteria))
-> ListFindings -> f ListFindings
listFindings_sort = (ListFindings -> Maybe SortCriteria)
-> (ListFindings -> Maybe SortCriteria -> ListFindings)
-> Lens
     ListFindings ListFindings (Maybe SortCriteria) (Maybe SortCriteria)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFindings' {Maybe SortCriteria
sort :: Maybe SortCriteria
$sel:sort:ListFindings' :: ListFindings -> Maybe SortCriteria
sort} -> Maybe SortCriteria
sort) (\s :: ListFindings
s@ListFindings' {} Maybe SortCriteria
a -> ListFindings
s {$sel:sort:ListFindings' :: Maybe SortCriteria
sort = Maybe SortCriteria
a} :: ListFindings)

-- | A filter to match for the findings to return.
listFindings_filter :: Lens.Lens' ListFindings (Prelude.Maybe (Prelude.HashMap Prelude.Text Criterion))
listFindings_filter :: (Maybe (HashMap Text Criterion)
 -> f (Maybe (HashMap Text Criterion)))
-> ListFindings -> f ListFindings
listFindings_filter = (ListFindings -> Maybe (HashMap Text Criterion))
-> (ListFindings -> Maybe (HashMap Text Criterion) -> ListFindings)
-> Lens
     ListFindings
     ListFindings
     (Maybe (HashMap Text Criterion))
     (Maybe (HashMap Text Criterion))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFindings' {Maybe (HashMap Text Criterion)
filter' :: Maybe (HashMap Text Criterion)
$sel:filter':ListFindings' :: ListFindings -> Maybe (HashMap Text Criterion)
filter'} -> Maybe (HashMap Text Criterion)
filter') (\s :: ListFindings
s@ListFindings' {} Maybe (HashMap Text Criterion)
a -> ListFindings
s {$sel:filter':ListFindings' :: Maybe (HashMap Text Criterion)
filter' = Maybe (HashMap Text Criterion)
a} :: ListFindings) ((Maybe (HashMap Text Criterion)
  -> f (Maybe (HashMap Text Criterion)))
 -> ListFindings -> f ListFindings)
-> ((Maybe (HashMap Text Criterion)
     -> f (Maybe (HashMap Text Criterion)))
    -> Maybe (HashMap Text Criterion)
    -> f (Maybe (HashMap Text Criterion)))
-> (Maybe (HashMap Text Criterion)
    -> f (Maybe (HashMap Text Criterion)))
-> ListFindings
-> f ListFindings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Criterion)
  (HashMap Text Criterion)
  (HashMap Text Criterion)
  (HashMap Text Criterion)
-> Iso
     (Maybe (HashMap Text Criterion))
     (Maybe (HashMap Text Criterion))
     (Maybe (HashMap Text Criterion))
     (Maybe (HashMap Text Criterion))
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 AnIso
  (HashMap Text Criterion)
  (HashMap Text Criterion)
  (HashMap Text Criterion)
  (HashMap Text Criterion)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The maximum number of results to return in the response.
listFindings_maxResults :: Lens.Lens' ListFindings (Prelude.Maybe Prelude.Int)
listFindings_maxResults :: (Maybe Int -> f (Maybe Int)) -> ListFindings -> f ListFindings
listFindings_maxResults = (ListFindings -> Maybe Int)
-> (ListFindings -> Maybe Int -> ListFindings)
-> Lens ListFindings ListFindings (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFindings' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:ListFindings' :: ListFindings -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: ListFindings
s@ListFindings' {} Maybe Int
a -> ListFindings
s {$sel:maxResults:ListFindings' :: Maybe Int
maxResults = Maybe Int
a} :: ListFindings)

-- | The
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-getting-started.html#permission-resources ARN of the analyzer>
-- to retrieve findings from.
listFindings_analyzerArn :: Lens.Lens' ListFindings Prelude.Text
listFindings_analyzerArn :: (Text -> f Text) -> ListFindings -> f ListFindings
listFindings_analyzerArn = (ListFindings -> Text)
-> (ListFindings -> Text -> ListFindings)
-> Lens ListFindings ListFindings Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFindings' {Text
analyzerArn :: Text
$sel:analyzerArn:ListFindings' :: ListFindings -> Text
analyzerArn} -> Text
analyzerArn) (\s :: ListFindings
s@ListFindings' {} Text
a -> ListFindings
s {$sel:analyzerArn:ListFindings' :: Text
analyzerArn = Text
a} :: ListFindings)

instance Core.AWSPager ListFindings where
  page :: ListFindings -> AWSResponse ListFindings -> Maybe ListFindings
page ListFindings
rq AWSResponse ListFindings
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListFindings
ListFindingsResponse
rs
            ListFindingsResponse
-> Getting (First Text) ListFindingsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListFindingsResponse -> Const (First Text) ListFindingsResponse
Lens' ListFindingsResponse (Maybe Text)
listFindingsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListFindingsResponse -> Const (First Text) ListFindingsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListFindingsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListFindings
forall a. Maybe a
Prelude.Nothing
    | [FindingSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        (AWSResponse ListFindings
ListFindingsResponse
rs ListFindingsResponse
-> Getting [FindingSummary] ListFindingsResponse [FindingSummary]
-> [FindingSummary]
forall s a. s -> Getting a s a -> a
Lens.^. Getting [FindingSummary] ListFindingsResponse [FindingSummary]
Lens' ListFindingsResponse [FindingSummary]
listFindingsResponse_findings) =
      Maybe ListFindings
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListFindings -> Maybe ListFindings
forall a. a -> Maybe a
Prelude.Just (ListFindings -> Maybe ListFindings)
-> ListFindings -> Maybe ListFindings
forall a b. (a -> b) -> a -> b
Prelude.$
        ListFindings
rq
          ListFindings -> (ListFindings -> ListFindings) -> ListFindings
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListFindings -> Identity ListFindings
Lens ListFindings ListFindings (Maybe Text) (Maybe Text)
listFindings_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListFindings -> Identity ListFindings)
-> Maybe Text -> ListFindings -> ListFindings
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListFindings
ListFindingsResponse
rs
          ListFindingsResponse
-> Getting (First Text) ListFindingsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListFindingsResponse -> Const (First Text) ListFindingsResponse
Lens' ListFindingsResponse (Maybe Text)
listFindingsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListFindingsResponse -> Const (First Text) ListFindingsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListFindingsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListFindings where
  type AWSResponse ListFindings = ListFindingsResponse
  request :: ListFindings -> Request ListFindings
request = Service -> ListFindings -> Request ListFindings
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListFindings
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListFindings)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListFindings))
-> Logger
-> Service
-> Proxy ListFindings
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListFindings)))
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 ->
          Maybe Text -> Int -> [FindingSummary] -> ListFindingsResponse
ListFindingsResponse'
            (Maybe Text -> Int -> [FindingSummary] -> ListFindingsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> [FindingSummary] -> ListFindingsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
            Either String (Int -> [FindingSummary] -> ListFindingsResponse)
-> Either String Int
-> Either String ([FindingSummary] -> ListFindingsResponse)
forall (f :: * -> *) a b. Applicative f => 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 ([FindingSummary] -> ListFindingsResponse)
-> Either String [FindingSummary]
-> Either String ListFindingsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [FindingSummary])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"findings" Either String (Maybe [FindingSummary])
-> [FindingSummary] -> Either String [FindingSummary]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [FindingSummary]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ListFindings

instance Prelude.NFData ListFindings

instance Core.ToHeaders ListFindings where
  toHeaders :: ListFindings -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListFindings -> 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 ListFindings where
  toJSON :: ListFindings -> Value
toJSON ListFindings' {Maybe Int
Maybe Text
Maybe (HashMap Text Criterion)
Maybe SortCriteria
Text
analyzerArn :: Text
maxResults :: Maybe Int
filter' :: Maybe (HashMap Text Criterion)
sort :: Maybe SortCriteria
nextToken :: Maybe Text
$sel:analyzerArn:ListFindings' :: ListFindings -> Text
$sel:maxResults:ListFindings' :: ListFindings -> Maybe Int
$sel:filter':ListFindings' :: ListFindings -> Maybe (HashMap Text Criterion)
$sel:sort:ListFindings' :: ListFindings -> Maybe SortCriteria
$sel:nextToken:ListFindings' :: ListFindings -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"nextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"sort" Text -> SortCriteria -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SortCriteria -> Pair) -> Maybe SortCriteria -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SortCriteria
sort,
            (Text
"filter" Text -> HashMap Text Criterion -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Criterion -> Pair)
-> Maybe (HashMap Text Criterion) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Criterion)
filter',
            (Text
"maxResults" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"analyzerArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
analyzerArn)
          ]
      )

instance Core.ToPath ListFindings where
  toPath :: ListFindings -> ByteString
toPath = ByteString -> ListFindings -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/finding"

instance Core.ToQuery ListFindings where
  toQuery :: ListFindings -> QueryString
toQuery = QueryString -> ListFindings -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | The response to the request.
--
-- /See:/ 'newListFindingsResponse' smart constructor.
data ListFindingsResponse = ListFindingsResponse'
  { -- | A token used for pagination of results returned.
    ListFindingsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListFindingsResponse -> Int
httpStatus :: Prelude.Int,
    -- | A list of findings retrieved from the analyzer that match the filter
    -- criteria specified, if any.
    ListFindingsResponse -> [FindingSummary]
findings :: [FindingSummary]
  }
  deriving (ListFindingsResponse -> ListFindingsResponse -> Bool
(ListFindingsResponse -> ListFindingsResponse -> Bool)
-> (ListFindingsResponse -> ListFindingsResponse -> Bool)
-> Eq ListFindingsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListFindingsResponse -> ListFindingsResponse -> Bool
$c/= :: ListFindingsResponse -> ListFindingsResponse -> Bool
== :: ListFindingsResponse -> ListFindingsResponse -> Bool
$c== :: ListFindingsResponse -> ListFindingsResponse -> Bool
Prelude.Eq, ReadPrec [ListFindingsResponse]
ReadPrec ListFindingsResponse
Int -> ReadS ListFindingsResponse
ReadS [ListFindingsResponse]
(Int -> ReadS ListFindingsResponse)
-> ReadS [ListFindingsResponse]
-> ReadPrec ListFindingsResponse
-> ReadPrec [ListFindingsResponse]
-> Read ListFindingsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListFindingsResponse]
$creadListPrec :: ReadPrec [ListFindingsResponse]
readPrec :: ReadPrec ListFindingsResponse
$creadPrec :: ReadPrec ListFindingsResponse
readList :: ReadS [ListFindingsResponse]
$creadList :: ReadS [ListFindingsResponse]
readsPrec :: Int -> ReadS ListFindingsResponse
$creadsPrec :: Int -> ReadS ListFindingsResponse
Prelude.Read, Int -> ListFindingsResponse -> ShowS
[ListFindingsResponse] -> ShowS
ListFindingsResponse -> String
(Int -> ListFindingsResponse -> ShowS)
-> (ListFindingsResponse -> String)
-> ([ListFindingsResponse] -> ShowS)
-> Show ListFindingsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListFindingsResponse] -> ShowS
$cshowList :: [ListFindingsResponse] -> ShowS
show :: ListFindingsResponse -> String
$cshow :: ListFindingsResponse -> String
showsPrec :: Int -> ListFindingsResponse -> ShowS
$cshowsPrec :: Int -> ListFindingsResponse -> ShowS
Prelude.Show, (forall x. ListFindingsResponse -> Rep ListFindingsResponse x)
-> (forall x. Rep ListFindingsResponse x -> ListFindingsResponse)
-> Generic ListFindingsResponse
forall x. Rep ListFindingsResponse x -> ListFindingsResponse
forall x. ListFindingsResponse -> Rep ListFindingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListFindingsResponse x -> ListFindingsResponse
$cfrom :: forall x. ListFindingsResponse -> Rep ListFindingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListFindingsResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'listFindingsResponse_nextToken' - A token used for pagination of results returned.
--
-- 'httpStatus', 'listFindingsResponse_httpStatus' - The response's http status code.
--
-- 'findings', 'listFindingsResponse_findings' - A list of findings retrieved from the analyzer that match the filter
-- criteria specified, if any.
newListFindingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListFindingsResponse
newListFindingsResponse :: Int -> ListFindingsResponse
newListFindingsResponse Int
pHttpStatus_ =
  ListFindingsResponse' :: Maybe Text -> Int -> [FindingSummary] -> ListFindingsResponse
ListFindingsResponse'
    { $sel:nextToken:ListFindingsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListFindingsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:findings:ListFindingsResponse' :: [FindingSummary]
findings = [FindingSummary]
forall a. Monoid a => a
Prelude.mempty
    }

-- | A token used for pagination of results returned.
listFindingsResponse_nextToken :: Lens.Lens' ListFindingsResponse (Prelude.Maybe Prelude.Text)
listFindingsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListFindingsResponse -> f ListFindingsResponse
listFindingsResponse_nextToken = (ListFindingsResponse -> Maybe Text)
-> (ListFindingsResponse -> Maybe Text -> ListFindingsResponse)
-> Lens' ListFindingsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFindingsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListFindingsResponse' :: ListFindingsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListFindingsResponse
s@ListFindingsResponse' {} Maybe Text
a -> ListFindingsResponse
s {$sel:nextToken:ListFindingsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListFindingsResponse)

-- | The response's http status code.
listFindingsResponse_httpStatus :: Lens.Lens' ListFindingsResponse Prelude.Int
listFindingsResponse_httpStatus :: (Int -> f Int) -> ListFindingsResponse -> f ListFindingsResponse
listFindingsResponse_httpStatus = (ListFindingsResponse -> Int)
-> (ListFindingsResponse -> Int -> ListFindingsResponse)
-> Lens ListFindingsResponse ListFindingsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFindingsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListFindingsResponse' :: ListFindingsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListFindingsResponse
s@ListFindingsResponse' {} Int
a -> ListFindingsResponse
s {$sel:httpStatus:ListFindingsResponse' :: Int
httpStatus = Int
a} :: ListFindingsResponse)

-- | A list of findings retrieved from the analyzer that match the filter
-- criteria specified, if any.
listFindingsResponse_findings :: Lens.Lens' ListFindingsResponse [FindingSummary]
listFindingsResponse_findings :: ([FindingSummary] -> f [FindingSummary])
-> ListFindingsResponse -> f ListFindingsResponse
listFindingsResponse_findings = (ListFindingsResponse -> [FindingSummary])
-> (ListFindingsResponse
    -> [FindingSummary] -> ListFindingsResponse)
-> Lens' ListFindingsResponse [FindingSummary]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFindingsResponse' {[FindingSummary]
findings :: [FindingSummary]
$sel:findings:ListFindingsResponse' :: ListFindingsResponse -> [FindingSummary]
findings} -> [FindingSummary]
findings) (\s :: ListFindingsResponse
s@ListFindingsResponse' {} [FindingSummary]
a -> ListFindingsResponse
s {$sel:findings:ListFindingsResponse' :: [FindingSummary]
findings = [FindingSummary]
a} :: ListFindingsResponse) (([FindingSummary] -> f [FindingSummary])
 -> ListFindingsResponse -> f ListFindingsResponse)
-> (([FindingSummary] -> f [FindingSummary])
    -> [FindingSummary] -> f [FindingSummary])
-> ([FindingSummary] -> f [FindingSummary])
-> ListFindingsResponse
-> f ListFindingsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([FindingSummary] -> f [FindingSummary])
-> [FindingSummary] -> f [FindingSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData ListFindingsResponse