{-# 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.SecurityHub.GetFindings
-- 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)
--
-- Returns a list of findings that match the specified criteria.
--
-- If finding aggregation is enabled, then when you call @GetFindings@ from
-- the aggregation Region, the results include all of the matching findings
-- from both the aggregation Region and the linked Regions.
--
-- This operation returns paginated results.
module Amazonka.SecurityHub.GetFindings
  ( -- * Creating a Request
    GetFindings (..),
    newGetFindings,

    -- * Request Lenses
    getFindings_filters,
    getFindings_sortCriteria,
    getFindings_nextToken,
    getFindings_maxResults,

    -- * Destructuring the Response
    GetFindingsResponse (..),
    newGetFindingsResponse,

    -- * Response Lenses
    getFindingsResponse_nextToken,
    getFindingsResponse_httpStatus,
    getFindingsResponse_findings,
  )
where

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
import Amazonka.SecurityHub.Types

-- | /See:/ 'newGetFindings' smart constructor.
data GetFindings = GetFindings'
  { -- | The finding attributes used to define a condition to filter the returned
    -- findings.
    --
    -- You can filter by up to 10 finding attributes. For each attribute, you
    -- can provide up to 20 filter values.
    --
    -- Note that in the available filter fields, @WorkflowState@ is deprecated.
    -- To search for a finding based on its workflow status, use
    -- @WorkflowStatus@.
    GetFindings -> Maybe AwsSecurityFindingFilters
filters :: Prelude.Maybe AwsSecurityFindingFilters,
    -- | The finding attributes used to sort the list of returned findings.
    GetFindings -> Maybe [SortCriterion]
sortCriteria :: Prelude.Maybe [SortCriterion],
    -- | The token that is required for pagination. On your first call to the
    -- @GetFindings@ operation, set the value of this parameter to @NULL@.
    --
    -- For subsequent calls to the operation, to continue listing data, set the
    -- value of this parameter to the value returned from the previous
    -- response.
    GetFindings -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of findings to return.
    GetFindings -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (GetFindings -> GetFindings -> Bool
(GetFindings -> GetFindings -> Bool)
-> (GetFindings -> GetFindings -> Bool) -> Eq GetFindings
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]
(Int -> ReadS GetFindings)
-> ReadS [GetFindings]
-> ReadPrec GetFindings
-> ReadPrec [GetFindings]
-> Read 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
(Int -> GetFindings -> ShowS)
-> (GetFindings -> String)
-> ([GetFindings] -> ShowS)
-> Show GetFindings
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. GetFindings -> Rep GetFindings x)
-> (forall x. Rep GetFindings x -> GetFindings)
-> Generic GetFindings
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)

-- |
-- Create a value of 'GetFindings' 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:
--
-- 'filters', 'getFindings_filters' - The finding attributes used to define a condition to filter the returned
-- findings.
--
-- You can filter by up to 10 finding attributes. For each attribute, you
-- can provide up to 20 filter values.
--
-- Note that in the available filter fields, @WorkflowState@ is deprecated.
-- To search for a finding based on its workflow status, use
-- @WorkflowStatus@.
--
-- 'sortCriteria', 'getFindings_sortCriteria' - The finding attributes used to sort the list of returned findings.
--
-- 'nextToken', 'getFindings_nextToken' - The token that is required for pagination. On your first call to the
-- @GetFindings@ operation, set the value of this parameter to @NULL@.
--
-- For subsequent calls to the operation, to continue listing data, set the
-- value of this parameter to the value returned from the previous
-- response.
--
-- 'maxResults', 'getFindings_maxResults' - The maximum number of findings to return.
newGetFindings ::
  GetFindings
newGetFindings :: GetFindings
newGetFindings =
  GetFindings' :: Maybe AwsSecurityFindingFilters
-> Maybe [SortCriterion]
-> Maybe Text
-> Maybe Natural
-> GetFindings
GetFindings'
    { $sel:filters:GetFindings' :: Maybe AwsSecurityFindingFilters
filters = Maybe AwsSecurityFindingFilters
forall a. Maybe a
Prelude.Nothing,
      $sel:sortCriteria:GetFindings' :: Maybe [SortCriterion]
sortCriteria = Maybe [SortCriterion]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetFindings' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetFindings' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The finding attributes used to define a condition to filter the returned
-- findings.
--
-- You can filter by up to 10 finding attributes. For each attribute, you
-- can provide up to 20 filter values.
--
-- Note that in the available filter fields, @WorkflowState@ is deprecated.
-- To search for a finding based on its workflow status, use
-- @WorkflowStatus@.
getFindings_filters :: Lens.Lens' GetFindings (Prelude.Maybe AwsSecurityFindingFilters)
getFindings_filters :: (Maybe AwsSecurityFindingFilters
 -> f (Maybe AwsSecurityFindingFilters))
-> GetFindings -> f GetFindings
getFindings_filters = (GetFindings -> Maybe AwsSecurityFindingFilters)
-> (GetFindings -> Maybe AwsSecurityFindingFilters -> GetFindings)
-> Lens
     GetFindings
     GetFindings
     (Maybe AwsSecurityFindingFilters)
     (Maybe AwsSecurityFindingFilters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindings' {Maybe AwsSecurityFindingFilters
filters :: Maybe AwsSecurityFindingFilters
$sel:filters:GetFindings' :: GetFindings -> Maybe AwsSecurityFindingFilters
filters} -> Maybe AwsSecurityFindingFilters
filters) (\s :: GetFindings
s@GetFindings' {} Maybe AwsSecurityFindingFilters
a -> GetFindings
s {$sel:filters:GetFindings' :: Maybe AwsSecurityFindingFilters
filters = Maybe AwsSecurityFindingFilters
a} :: GetFindings)

-- | The finding attributes used to sort the list of returned findings.
getFindings_sortCriteria :: Lens.Lens' GetFindings (Prelude.Maybe [SortCriterion])
getFindings_sortCriteria :: (Maybe [SortCriterion] -> f (Maybe [SortCriterion]))
-> GetFindings -> f GetFindings
getFindings_sortCriteria = (GetFindings -> Maybe [SortCriterion])
-> (GetFindings -> Maybe [SortCriterion] -> GetFindings)
-> Lens
     GetFindings
     GetFindings
     (Maybe [SortCriterion])
     (Maybe [SortCriterion])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindings' {Maybe [SortCriterion]
sortCriteria :: Maybe [SortCriterion]
$sel:sortCriteria:GetFindings' :: GetFindings -> Maybe [SortCriterion]
sortCriteria} -> Maybe [SortCriterion]
sortCriteria) (\s :: GetFindings
s@GetFindings' {} Maybe [SortCriterion]
a -> GetFindings
s {$sel:sortCriteria:GetFindings' :: Maybe [SortCriterion]
sortCriteria = Maybe [SortCriterion]
a} :: GetFindings) ((Maybe [SortCriterion] -> f (Maybe [SortCriterion]))
 -> GetFindings -> f GetFindings)
-> ((Maybe [SortCriterion] -> f (Maybe [SortCriterion]))
    -> Maybe [SortCriterion] -> f (Maybe [SortCriterion]))
-> (Maybe [SortCriterion] -> f (Maybe [SortCriterion]))
-> GetFindings
-> f GetFindings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SortCriterion] [SortCriterion] [SortCriterion] [SortCriterion]
-> Iso
     (Maybe [SortCriterion])
     (Maybe [SortCriterion])
     (Maybe [SortCriterion])
     (Maybe [SortCriterion])
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
  [SortCriterion] [SortCriterion] [SortCriterion] [SortCriterion]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token that is required for pagination. On your first call to the
-- @GetFindings@ operation, set the value of this parameter to @NULL@.
--
-- For subsequent calls to the operation, to continue listing data, set the
-- value of this parameter to the value returned from the previous
-- response.
getFindings_nextToken :: Lens.Lens' GetFindings (Prelude.Maybe Prelude.Text)
getFindings_nextToken :: (Maybe Text -> f (Maybe Text)) -> GetFindings -> f GetFindings
getFindings_nextToken = (GetFindings -> Maybe Text)
-> (GetFindings -> Maybe Text -> GetFindings)
-> Lens GetFindings GetFindings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindings' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetFindings' :: GetFindings -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetFindings
s@GetFindings' {} Maybe Text
a -> GetFindings
s {$sel:nextToken:GetFindings' :: Maybe Text
nextToken = Maybe Text
a} :: GetFindings)

-- | The maximum number of findings to return.
getFindings_maxResults :: Lens.Lens' GetFindings (Prelude.Maybe Prelude.Natural)
getFindings_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetFindings -> f GetFindings
getFindings_maxResults = (GetFindings -> Maybe Natural)
-> (GetFindings -> Maybe Natural -> GetFindings)
-> Lens GetFindings GetFindings (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindings' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetFindings' :: GetFindings -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetFindings
s@GetFindings' {} Maybe Natural
a -> GetFindings
s {$sel:maxResults:GetFindings' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetFindings)

instance Core.AWSPager GetFindings where
  page :: GetFindings -> AWSResponse GetFindings -> Maybe GetFindings
page GetFindings
rq AWSResponse GetFindings
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetFindings
GetFindingsResponse
rs
            GetFindingsResponse
-> Getting (First Text) GetFindingsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetFindingsResponse -> Const (First Text) GetFindingsResponse
Lens' GetFindingsResponse (Maybe Text)
getFindingsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetFindingsResponse -> Const (First Text) GetFindingsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetFindingsResponse 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 GetFindings
forall a. Maybe a
Prelude.Nothing
    | [AwsSecurityFinding] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop (AWSResponse GetFindings
GetFindingsResponse
rs GetFindingsResponse
-> Getting
     [AwsSecurityFinding] GetFindingsResponse [AwsSecurityFinding]
-> [AwsSecurityFinding]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
  [AwsSecurityFinding] GetFindingsResponse [AwsSecurityFinding]
Lens' GetFindingsResponse [AwsSecurityFinding]
getFindingsResponse_findings) =
      Maybe GetFindings
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      GetFindings -> Maybe GetFindings
forall a. a -> Maybe a
Prelude.Just (GetFindings -> Maybe GetFindings)
-> GetFindings -> Maybe GetFindings
forall a b. (a -> b) -> a -> b
Prelude.$
        GetFindings
rq
          GetFindings -> (GetFindings -> GetFindings) -> GetFindings
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> GetFindings -> Identity GetFindings
Lens GetFindings GetFindings (Maybe Text) (Maybe Text)
getFindings_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> GetFindings -> Identity GetFindings)
-> Maybe Text -> GetFindings -> GetFindings
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetFindings
GetFindingsResponse
rs
          GetFindingsResponse
-> Getting (First Text) GetFindingsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetFindingsResponse -> Const (First Text) GetFindingsResponse
Lens' GetFindingsResponse (Maybe Text)
getFindingsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetFindingsResponse -> Const (First Text) GetFindingsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetFindingsResponse 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 GetFindings where
  type AWSResponse GetFindings = GetFindingsResponse
  request :: GetFindings -> Request GetFindings
request = Service -> GetFindings -> Request GetFindings
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetFindings
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetFindings)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetFindings))
-> Logger
-> Service
-> Proxy GetFindings
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetFindings)))
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 -> [AwsSecurityFinding] -> GetFindingsResponse
GetFindingsResponse'
            (Maybe Text -> Int -> [AwsSecurityFinding] -> GetFindingsResponse)
-> Either String (Maybe Text)
-> Either
     String (Int -> [AwsSecurityFinding] -> GetFindingsResponse)
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 -> [AwsSecurityFinding] -> GetFindingsResponse)
-> Either String Int
-> Either String ([AwsSecurityFinding] -> GetFindingsResponse)
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 ([AwsSecurityFinding] -> GetFindingsResponse)
-> Either String [AwsSecurityFinding]
-> Either String GetFindingsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [AwsSecurityFinding])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Findings" Either String (Maybe [AwsSecurityFinding])
-> [AwsSecurityFinding] -> Either String [AwsSecurityFinding]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [AwsSecurityFinding]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable GetFindings

instance Prelude.NFData GetFindings

instance Core.ToHeaders GetFindings where
  toHeaders :: GetFindings -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetFindings -> 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 GetFindings where
  toJSON :: GetFindings -> Value
toJSON GetFindings' {Maybe Natural
Maybe [SortCriterion]
Maybe Text
Maybe AwsSecurityFindingFilters
maxResults :: Maybe Natural
nextToken :: Maybe Text
sortCriteria :: Maybe [SortCriterion]
filters :: Maybe AwsSecurityFindingFilters
$sel:maxResults:GetFindings' :: GetFindings -> Maybe Natural
$sel:nextToken:GetFindings' :: GetFindings -> Maybe Text
$sel:sortCriteria:GetFindings' :: GetFindings -> Maybe [SortCriterion]
$sel:filters:GetFindings' :: GetFindings -> Maybe AwsSecurityFindingFilters
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Filters" Text -> AwsSecurityFindingFilters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AwsSecurityFindingFilters -> Pair)
-> Maybe AwsSecurityFindingFilters -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AwsSecurityFindingFilters
filters,
            (Text
"SortCriteria" Text -> [SortCriterion] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([SortCriterion] -> Pair) -> Maybe [SortCriterion] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [SortCriterion]
sortCriteria,
            (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
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
          ]
      )

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

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

-- | /See:/ 'newGetFindingsResponse' smart constructor.
data GetFindingsResponse = GetFindingsResponse'
  { -- | The pagination token to use to request the next page of results.
    GetFindingsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetFindingsResponse -> Int
httpStatus :: Prelude.Int,
    -- | The findings that matched the filters specified in the request.
    GetFindingsResponse -> [AwsSecurityFinding]
findings :: [AwsSecurityFinding]
  }
  deriving (GetFindingsResponse -> GetFindingsResponse -> Bool
(GetFindingsResponse -> GetFindingsResponse -> Bool)
-> (GetFindingsResponse -> GetFindingsResponse -> Bool)
-> Eq GetFindingsResponse
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]
(Int -> ReadS GetFindingsResponse)
-> ReadS [GetFindingsResponse]
-> ReadPrec GetFindingsResponse
-> ReadPrec [GetFindingsResponse]
-> Read 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
(Int -> GetFindingsResponse -> ShowS)
-> (GetFindingsResponse -> String)
-> ([GetFindingsResponse] -> ShowS)
-> Show GetFindingsResponse
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. GetFindingsResponse -> Rep GetFindingsResponse x)
-> (forall x. Rep GetFindingsResponse x -> GetFindingsResponse)
-> Generic GetFindingsResponse
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)

-- |
-- Create a value of 'GetFindingsResponse' 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', 'getFindingsResponse_nextToken' - The pagination token to use to request the next page of results.
--
-- 'httpStatus', 'getFindingsResponse_httpStatus' - The response's http status code.
--
-- 'findings', 'getFindingsResponse_findings' - The findings that matched the filters specified in the request.
newGetFindingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetFindingsResponse
newGetFindingsResponse :: Int -> GetFindingsResponse
newGetFindingsResponse Int
pHttpStatus_ =
  GetFindingsResponse' :: Maybe Text -> Int -> [AwsSecurityFinding] -> GetFindingsResponse
GetFindingsResponse'
    { $sel:nextToken:GetFindingsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetFindingsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:findings:GetFindingsResponse' :: [AwsSecurityFinding]
findings = [AwsSecurityFinding]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The pagination token to use to request the next page of results.
getFindingsResponse_nextToken :: Lens.Lens' GetFindingsResponse (Prelude.Maybe Prelude.Text)
getFindingsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetFindingsResponse -> f GetFindingsResponse
getFindingsResponse_nextToken = (GetFindingsResponse -> Maybe Text)
-> (GetFindingsResponse -> Maybe Text -> GetFindingsResponse)
-> Lens' GetFindingsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindingsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetFindingsResponse' :: GetFindingsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetFindingsResponse
s@GetFindingsResponse' {} Maybe Text
a -> GetFindingsResponse
s {$sel:nextToken:GetFindingsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetFindingsResponse)

-- | The response's http status code.
getFindingsResponse_httpStatus :: Lens.Lens' GetFindingsResponse Prelude.Int
getFindingsResponse_httpStatus :: (Int -> f Int) -> GetFindingsResponse -> f GetFindingsResponse
getFindingsResponse_httpStatus = (GetFindingsResponse -> Int)
-> (GetFindingsResponse -> Int -> GetFindingsResponse)
-> Lens GetFindingsResponse GetFindingsResponse Int Int
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)

-- | The findings that matched the filters specified in the request.
getFindingsResponse_findings :: Lens.Lens' GetFindingsResponse [AwsSecurityFinding]
getFindingsResponse_findings :: ([AwsSecurityFinding] -> f [AwsSecurityFinding])
-> GetFindingsResponse -> f GetFindingsResponse
getFindingsResponse_findings = (GetFindingsResponse -> [AwsSecurityFinding])
-> (GetFindingsResponse
    -> [AwsSecurityFinding] -> GetFindingsResponse)
-> Lens' GetFindingsResponse [AwsSecurityFinding]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindingsResponse' {[AwsSecurityFinding]
findings :: [AwsSecurityFinding]
$sel:findings:GetFindingsResponse' :: GetFindingsResponse -> [AwsSecurityFinding]
findings} -> [AwsSecurityFinding]
findings) (\s :: GetFindingsResponse
s@GetFindingsResponse' {} [AwsSecurityFinding]
a -> GetFindingsResponse
s {$sel:findings:GetFindingsResponse' :: [AwsSecurityFinding]
findings = [AwsSecurityFinding]
a} :: GetFindingsResponse) (([AwsSecurityFinding] -> f [AwsSecurityFinding])
 -> GetFindingsResponse -> f GetFindingsResponse)
-> (([AwsSecurityFinding] -> f [AwsSecurityFinding])
    -> [AwsSecurityFinding] -> f [AwsSecurityFinding])
-> ([AwsSecurityFinding] -> f [AwsSecurityFinding])
-> GetFindingsResponse
-> f GetFindingsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([AwsSecurityFinding] -> f [AwsSecurityFinding])
-> [AwsSecurityFinding] -> f [AwsSecurityFinding]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData GetFindingsResponse