{-# 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.IoT.ListAuditFindings
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists the findings (results) of a Device Defender audit or of the audits
-- performed during a specified time period. (Findings are retained for 90
-- days.)
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions ListAuditFindings>
-- action.
--
-- This operation returns paginated results.
module Amazonka.IoT.ListAuditFindings
  ( -- * Creating a Request
    ListAuditFindings (..),
    newListAuditFindings,

    -- * Request Lenses
    listAuditFindings_checkName,
    listAuditFindings_endTime,
    listAuditFindings_listSuppressedFindings,
    listAuditFindings_maxResults,
    listAuditFindings_nextToken,
    listAuditFindings_resourceIdentifier,
    listAuditFindings_startTime,
    listAuditFindings_taskId,

    -- * Destructuring the Response
    ListAuditFindingsResponse (..),
    newListAuditFindingsResponse,

    -- * Response Lenses
    listAuditFindingsResponse_findings,
    listAuditFindingsResponse_nextToken,
    listAuditFindingsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListAuditFindings' smart constructor.
data ListAuditFindings = ListAuditFindings'
  { -- | A filter to limit results to the findings for the specified audit check.
    ListAuditFindings -> Maybe Text
checkName :: Prelude.Maybe Prelude.Text,
    -- | A filter to limit results to those found before the specified time. You
    -- must specify either the startTime and endTime or the taskId, but not
    -- both.
    ListAuditFindings -> Maybe POSIX
endTime :: Prelude.Maybe Data.POSIX,
    -- | Boolean flag indicating whether only the suppressed findings or the
    -- unsuppressed findings should be listed. If this parameter isn\'t
    -- provided, the response will list both suppressed and unsuppressed
    -- findings.
    ListAuditFindings -> Maybe Bool
listSuppressedFindings :: Prelude.Maybe Prelude.Bool,
    -- | The maximum number of results to return at one time. The default is 25.
    ListAuditFindings -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token for the next set of results.
    ListAuditFindings -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Information identifying the noncompliant resource.
    ListAuditFindings -> Maybe ResourceIdentifier
resourceIdentifier :: Prelude.Maybe ResourceIdentifier,
    -- | A filter to limit results to those found after the specified time. You
    -- must specify either the startTime and endTime or the taskId, but not
    -- both.
    ListAuditFindings -> Maybe POSIX
startTime :: Prelude.Maybe Data.POSIX,
    -- | A filter to limit results to the audit with the specified ID. You must
    -- specify either the taskId or the startTime and endTime, but not both.
    ListAuditFindings -> Maybe Text
taskId :: Prelude.Maybe Prelude.Text
  }
  deriving (ListAuditFindings -> ListAuditFindings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAuditFindings -> ListAuditFindings -> Bool
$c/= :: ListAuditFindings -> ListAuditFindings -> Bool
== :: ListAuditFindings -> ListAuditFindings -> Bool
$c== :: ListAuditFindings -> ListAuditFindings -> Bool
Prelude.Eq, ReadPrec [ListAuditFindings]
ReadPrec ListAuditFindings
Int -> ReadS ListAuditFindings
ReadS [ListAuditFindings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAuditFindings]
$creadListPrec :: ReadPrec [ListAuditFindings]
readPrec :: ReadPrec ListAuditFindings
$creadPrec :: ReadPrec ListAuditFindings
readList :: ReadS [ListAuditFindings]
$creadList :: ReadS [ListAuditFindings]
readsPrec :: Int -> ReadS ListAuditFindings
$creadsPrec :: Int -> ReadS ListAuditFindings
Prelude.Read, Int -> ListAuditFindings -> ShowS
[ListAuditFindings] -> ShowS
ListAuditFindings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAuditFindings] -> ShowS
$cshowList :: [ListAuditFindings] -> ShowS
show :: ListAuditFindings -> String
$cshow :: ListAuditFindings -> String
showsPrec :: Int -> ListAuditFindings -> ShowS
$cshowsPrec :: Int -> ListAuditFindings -> ShowS
Prelude.Show, forall x. Rep ListAuditFindings x -> ListAuditFindings
forall x. ListAuditFindings -> Rep ListAuditFindings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAuditFindings x -> ListAuditFindings
$cfrom :: forall x. ListAuditFindings -> Rep ListAuditFindings x
Prelude.Generic)

-- |
-- Create a value of 'ListAuditFindings' 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:
--
-- 'checkName', 'listAuditFindings_checkName' - A filter to limit results to the findings for the specified audit check.
--
-- 'endTime', 'listAuditFindings_endTime' - A filter to limit results to those found before the specified time. You
-- must specify either the startTime and endTime or the taskId, but not
-- both.
--
-- 'listSuppressedFindings', 'listAuditFindings_listSuppressedFindings' - Boolean flag indicating whether only the suppressed findings or the
-- unsuppressed findings should be listed. If this parameter isn\'t
-- provided, the response will list both suppressed and unsuppressed
-- findings.
--
-- 'maxResults', 'listAuditFindings_maxResults' - The maximum number of results to return at one time. The default is 25.
--
-- 'nextToken', 'listAuditFindings_nextToken' - The token for the next set of results.
--
-- 'resourceIdentifier', 'listAuditFindings_resourceIdentifier' - Information identifying the noncompliant resource.
--
-- 'startTime', 'listAuditFindings_startTime' - A filter to limit results to those found after the specified time. You
-- must specify either the startTime and endTime or the taskId, but not
-- both.
--
-- 'taskId', 'listAuditFindings_taskId' - A filter to limit results to the audit with the specified ID. You must
-- specify either the taskId or the startTime and endTime, but not both.
newListAuditFindings ::
  ListAuditFindings
newListAuditFindings :: ListAuditFindings
newListAuditFindings =
  ListAuditFindings'
    { $sel:checkName:ListAuditFindings' :: Maybe Text
checkName = forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:ListAuditFindings' :: Maybe POSIX
endTime = forall a. Maybe a
Prelude.Nothing,
      $sel:listSuppressedFindings:ListAuditFindings' :: Maybe Bool
listSuppressedFindings = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListAuditFindings' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListAuditFindings' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceIdentifier:ListAuditFindings' :: Maybe ResourceIdentifier
resourceIdentifier = forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:ListAuditFindings' :: Maybe POSIX
startTime = forall a. Maybe a
Prelude.Nothing,
      $sel:taskId:ListAuditFindings' :: Maybe Text
taskId = forall a. Maybe a
Prelude.Nothing
    }

-- | A filter to limit results to the findings for the specified audit check.
listAuditFindings_checkName :: Lens.Lens' ListAuditFindings (Prelude.Maybe Prelude.Text)
listAuditFindings_checkName :: Lens' ListAuditFindings (Maybe Text)
listAuditFindings_checkName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAuditFindings' {Maybe Text
checkName :: Maybe Text
$sel:checkName:ListAuditFindings' :: ListAuditFindings -> Maybe Text
checkName} -> Maybe Text
checkName) (\s :: ListAuditFindings
s@ListAuditFindings' {} Maybe Text
a -> ListAuditFindings
s {$sel:checkName:ListAuditFindings' :: Maybe Text
checkName = Maybe Text
a} :: ListAuditFindings)

-- | A filter to limit results to those found before the specified time. You
-- must specify either the startTime and endTime or the taskId, but not
-- both.
listAuditFindings_endTime :: Lens.Lens' ListAuditFindings (Prelude.Maybe Prelude.UTCTime)
listAuditFindings_endTime :: Lens' ListAuditFindings (Maybe UTCTime)
listAuditFindings_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAuditFindings' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:ListAuditFindings' :: ListAuditFindings -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: ListAuditFindings
s@ListAuditFindings' {} Maybe POSIX
a -> ListAuditFindings
s {$sel:endTime:ListAuditFindings' :: Maybe POSIX
endTime = Maybe POSIX
a} :: ListAuditFindings) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Boolean flag indicating whether only the suppressed findings or the
-- unsuppressed findings should be listed. If this parameter isn\'t
-- provided, the response will list both suppressed and unsuppressed
-- findings.
listAuditFindings_listSuppressedFindings :: Lens.Lens' ListAuditFindings (Prelude.Maybe Prelude.Bool)
listAuditFindings_listSuppressedFindings :: Lens' ListAuditFindings (Maybe Bool)
listAuditFindings_listSuppressedFindings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAuditFindings' {Maybe Bool
listSuppressedFindings :: Maybe Bool
$sel:listSuppressedFindings:ListAuditFindings' :: ListAuditFindings -> Maybe Bool
listSuppressedFindings} -> Maybe Bool
listSuppressedFindings) (\s :: ListAuditFindings
s@ListAuditFindings' {} Maybe Bool
a -> ListAuditFindings
s {$sel:listSuppressedFindings:ListAuditFindings' :: Maybe Bool
listSuppressedFindings = Maybe Bool
a} :: ListAuditFindings)

-- | The maximum number of results to return at one time. The default is 25.
listAuditFindings_maxResults :: Lens.Lens' ListAuditFindings (Prelude.Maybe Prelude.Natural)
listAuditFindings_maxResults :: Lens' ListAuditFindings (Maybe Natural)
listAuditFindings_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAuditFindings' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListAuditFindings' :: ListAuditFindings -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListAuditFindings
s@ListAuditFindings' {} Maybe Natural
a -> ListAuditFindings
s {$sel:maxResults:ListAuditFindings' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListAuditFindings)

-- | The token for the next set of results.
listAuditFindings_nextToken :: Lens.Lens' ListAuditFindings (Prelude.Maybe Prelude.Text)
listAuditFindings_nextToken :: Lens' ListAuditFindings (Maybe Text)
listAuditFindings_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAuditFindings' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAuditFindings' :: ListAuditFindings -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAuditFindings
s@ListAuditFindings' {} Maybe Text
a -> ListAuditFindings
s {$sel:nextToken:ListAuditFindings' :: Maybe Text
nextToken = Maybe Text
a} :: ListAuditFindings)

-- | Information identifying the noncompliant resource.
listAuditFindings_resourceIdentifier :: Lens.Lens' ListAuditFindings (Prelude.Maybe ResourceIdentifier)
listAuditFindings_resourceIdentifier :: Lens' ListAuditFindings (Maybe ResourceIdentifier)
listAuditFindings_resourceIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAuditFindings' {Maybe ResourceIdentifier
resourceIdentifier :: Maybe ResourceIdentifier
$sel:resourceIdentifier:ListAuditFindings' :: ListAuditFindings -> Maybe ResourceIdentifier
resourceIdentifier} -> Maybe ResourceIdentifier
resourceIdentifier) (\s :: ListAuditFindings
s@ListAuditFindings' {} Maybe ResourceIdentifier
a -> ListAuditFindings
s {$sel:resourceIdentifier:ListAuditFindings' :: Maybe ResourceIdentifier
resourceIdentifier = Maybe ResourceIdentifier
a} :: ListAuditFindings)

-- | A filter to limit results to those found after the specified time. You
-- must specify either the startTime and endTime or the taskId, but not
-- both.
listAuditFindings_startTime :: Lens.Lens' ListAuditFindings (Prelude.Maybe Prelude.UTCTime)
listAuditFindings_startTime :: Lens' ListAuditFindings (Maybe UTCTime)
listAuditFindings_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAuditFindings' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:ListAuditFindings' :: ListAuditFindings -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: ListAuditFindings
s@ListAuditFindings' {} Maybe POSIX
a -> ListAuditFindings
s {$sel:startTime:ListAuditFindings' :: Maybe POSIX
startTime = Maybe POSIX
a} :: ListAuditFindings) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | A filter to limit results to the audit with the specified ID. You must
-- specify either the taskId or the startTime and endTime, but not both.
listAuditFindings_taskId :: Lens.Lens' ListAuditFindings (Prelude.Maybe Prelude.Text)
listAuditFindings_taskId :: Lens' ListAuditFindings (Maybe Text)
listAuditFindings_taskId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAuditFindings' {Maybe Text
taskId :: Maybe Text
$sel:taskId:ListAuditFindings' :: ListAuditFindings -> Maybe Text
taskId} -> Maybe Text
taskId) (\s :: ListAuditFindings
s@ListAuditFindings' {} Maybe Text
a -> ListAuditFindings
s {$sel:taskId:ListAuditFindings' :: Maybe Text
taskId = Maybe Text
a} :: ListAuditFindings)

instance Core.AWSPager ListAuditFindings where
  page :: ListAuditFindings
-> AWSResponse ListAuditFindings -> Maybe ListAuditFindings
page ListAuditFindings
rq AWSResponse ListAuditFindings
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAuditFindings
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAuditFindingsResponse (Maybe Text)
listAuditFindingsResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAuditFindings
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAuditFindingsResponse (Maybe [AuditFinding])
listAuditFindingsResponse_findings
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListAuditFindings
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListAuditFindings (Maybe Text)
listAuditFindings_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAuditFindings
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAuditFindingsResponse (Maybe Text)
listAuditFindingsResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListAuditFindings where
  type
    AWSResponse ListAuditFindings =
      ListAuditFindingsResponse
  request :: (Service -> Service)
-> ListAuditFindings -> Request ListAuditFindings
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 ListAuditFindings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListAuditFindings)))
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 [AuditFinding]
-> Maybe Text -> Int -> ListAuditFindingsResponse
ListAuditFindingsResponse'
            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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
            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 ListAuditFindings where
  hashWithSalt :: Int -> ListAuditFindings -> Int
hashWithSalt Int
_salt ListAuditFindings' {Maybe Bool
Maybe Natural
Maybe Text
Maybe POSIX
Maybe ResourceIdentifier
taskId :: Maybe Text
startTime :: Maybe POSIX
resourceIdentifier :: Maybe ResourceIdentifier
nextToken :: Maybe Text
maxResults :: Maybe Natural
listSuppressedFindings :: Maybe Bool
endTime :: Maybe POSIX
checkName :: Maybe Text
$sel:taskId:ListAuditFindings' :: ListAuditFindings -> Maybe Text
$sel:startTime:ListAuditFindings' :: ListAuditFindings -> Maybe POSIX
$sel:resourceIdentifier:ListAuditFindings' :: ListAuditFindings -> Maybe ResourceIdentifier
$sel:nextToken:ListAuditFindings' :: ListAuditFindings -> Maybe Text
$sel:maxResults:ListAuditFindings' :: ListAuditFindings -> Maybe Natural
$sel:listSuppressedFindings:ListAuditFindings' :: ListAuditFindings -> Maybe Bool
$sel:endTime:ListAuditFindings' :: ListAuditFindings -> Maybe POSIX
$sel:checkName:ListAuditFindings' :: ListAuditFindings -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
checkName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
endTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
listSuppressedFindings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResourceIdentifier
resourceIdentifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
startTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
taskId

instance Prelude.NFData ListAuditFindings where
  rnf :: ListAuditFindings -> ()
rnf ListAuditFindings' {Maybe Bool
Maybe Natural
Maybe Text
Maybe POSIX
Maybe ResourceIdentifier
taskId :: Maybe Text
startTime :: Maybe POSIX
resourceIdentifier :: Maybe ResourceIdentifier
nextToken :: Maybe Text
maxResults :: Maybe Natural
listSuppressedFindings :: Maybe Bool
endTime :: Maybe POSIX
checkName :: Maybe Text
$sel:taskId:ListAuditFindings' :: ListAuditFindings -> Maybe Text
$sel:startTime:ListAuditFindings' :: ListAuditFindings -> Maybe POSIX
$sel:resourceIdentifier:ListAuditFindings' :: ListAuditFindings -> Maybe ResourceIdentifier
$sel:nextToken:ListAuditFindings' :: ListAuditFindings -> Maybe Text
$sel:maxResults:ListAuditFindings' :: ListAuditFindings -> Maybe Natural
$sel:listSuppressedFindings:ListAuditFindings' :: ListAuditFindings -> Maybe Bool
$sel:endTime:ListAuditFindings' :: ListAuditFindings -> Maybe POSIX
$sel:checkName:ListAuditFindings' :: ListAuditFindings -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
checkName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
endTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
listSuppressedFindings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceIdentifier
resourceIdentifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
startTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
taskId

instance Data.ToHeaders ListAuditFindings where
  toHeaders :: ListAuditFindings -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToJSON ListAuditFindings where
  toJSON :: ListAuditFindings -> Value
toJSON ListAuditFindings' {Maybe Bool
Maybe Natural
Maybe Text
Maybe POSIX
Maybe ResourceIdentifier
taskId :: Maybe Text
startTime :: Maybe POSIX
resourceIdentifier :: Maybe ResourceIdentifier
nextToken :: Maybe Text
maxResults :: Maybe Natural
listSuppressedFindings :: Maybe Bool
endTime :: Maybe POSIX
checkName :: Maybe Text
$sel:taskId:ListAuditFindings' :: ListAuditFindings -> Maybe Text
$sel:startTime:ListAuditFindings' :: ListAuditFindings -> Maybe POSIX
$sel:resourceIdentifier:ListAuditFindings' :: ListAuditFindings -> Maybe ResourceIdentifier
$sel:nextToken:ListAuditFindings' :: ListAuditFindings -> Maybe Text
$sel:maxResults:ListAuditFindings' :: ListAuditFindings -> Maybe Natural
$sel:listSuppressedFindings:ListAuditFindings' :: ListAuditFindings -> Maybe Bool
$sel:endTime:ListAuditFindings' :: ListAuditFindings -> Maybe POSIX
$sel:checkName:ListAuditFindings' :: ListAuditFindings -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"checkName" 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 Text
checkName,
            (Key
"endTime" 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 POSIX
endTime,
            (Key
"listSuppressedFindings" 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 Bool
listSuppressedFindings,
            (Key
"maxResults" 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 Natural
maxResults,
            (Key
"nextToken" 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 Text
nextToken,
            (Key
"resourceIdentifier" 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 ResourceIdentifier
resourceIdentifier,
            (Key
"startTime" 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 POSIX
startTime,
            (Key
"taskId" 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 Text
taskId
          ]
      )

instance Data.ToPath ListAuditFindings where
  toPath :: ListAuditFindings -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/audit/findings"

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

-- | /See:/ 'newListAuditFindingsResponse' smart constructor.
data ListAuditFindingsResponse = ListAuditFindingsResponse'
  { -- | The findings (results) of the audit.
    ListAuditFindingsResponse -> Maybe [AuditFinding]
findings :: Prelude.Maybe [AuditFinding],
    -- | A token that can be used to retrieve the next set of results, or @null@
    -- if there are no additional results.
    ListAuditFindingsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListAuditFindingsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListAuditFindingsResponse -> ListAuditFindingsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAuditFindingsResponse -> ListAuditFindingsResponse -> Bool
$c/= :: ListAuditFindingsResponse -> ListAuditFindingsResponse -> Bool
== :: ListAuditFindingsResponse -> ListAuditFindingsResponse -> Bool
$c== :: ListAuditFindingsResponse -> ListAuditFindingsResponse -> Bool
Prelude.Eq, ReadPrec [ListAuditFindingsResponse]
ReadPrec ListAuditFindingsResponse
Int -> ReadS ListAuditFindingsResponse
ReadS [ListAuditFindingsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAuditFindingsResponse]
$creadListPrec :: ReadPrec [ListAuditFindingsResponse]
readPrec :: ReadPrec ListAuditFindingsResponse
$creadPrec :: ReadPrec ListAuditFindingsResponse
readList :: ReadS [ListAuditFindingsResponse]
$creadList :: ReadS [ListAuditFindingsResponse]
readsPrec :: Int -> ReadS ListAuditFindingsResponse
$creadsPrec :: Int -> ReadS ListAuditFindingsResponse
Prelude.Read, Int -> ListAuditFindingsResponse -> ShowS
[ListAuditFindingsResponse] -> ShowS
ListAuditFindingsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAuditFindingsResponse] -> ShowS
$cshowList :: [ListAuditFindingsResponse] -> ShowS
show :: ListAuditFindingsResponse -> String
$cshow :: ListAuditFindingsResponse -> String
showsPrec :: Int -> ListAuditFindingsResponse -> ShowS
$cshowsPrec :: Int -> ListAuditFindingsResponse -> ShowS
Prelude.Show, forall x.
Rep ListAuditFindingsResponse x -> ListAuditFindingsResponse
forall x.
ListAuditFindingsResponse -> Rep ListAuditFindingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAuditFindingsResponse x -> ListAuditFindingsResponse
$cfrom :: forall x.
ListAuditFindingsResponse -> Rep ListAuditFindingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAuditFindingsResponse' 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:
--
-- 'findings', 'listAuditFindingsResponse_findings' - The findings (results) of the audit.
--
-- 'nextToken', 'listAuditFindingsResponse_nextToken' - A token that can be used to retrieve the next set of results, or @null@
-- if there are no additional results.
--
-- 'httpStatus', 'listAuditFindingsResponse_httpStatus' - The response's http status code.
newListAuditFindingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAuditFindingsResponse
newListAuditFindingsResponse :: Int -> ListAuditFindingsResponse
newListAuditFindingsResponse Int
pHttpStatus_ =
  ListAuditFindingsResponse'
    { $sel:findings:ListAuditFindingsResponse' :: Maybe [AuditFinding]
findings =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListAuditFindingsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAuditFindingsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The findings (results) of the audit.
listAuditFindingsResponse_findings :: Lens.Lens' ListAuditFindingsResponse (Prelude.Maybe [AuditFinding])
listAuditFindingsResponse_findings :: Lens' ListAuditFindingsResponse (Maybe [AuditFinding])
listAuditFindingsResponse_findings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAuditFindingsResponse' {Maybe [AuditFinding]
findings :: Maybe [AuditFinding]
$sel:findings:ListAuditFindingsResponse' :: ListAuditFindingsResponse -> Maybe [AuditFinding]
findings} -> Maybe [AuditFinding]
findings) (\s :: ListAuditFindingsResponse
s@ListAuditFindingsResponse' {} Maybe [AuditFinding]
a -> ListAuditFindingsResponse
s {$sel:findings:ListAuditFindingsResponse' :: Maybe [AuditFinding]
findings = Maybe [AuditFinding]
a} :: ListAuditFindingsResponse) 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

-- | A token that can be used to retrieve the next set of results, or @null@
-- if there are no additional results.
listAuditFindingsResponse_nextToken :: Lens.Lens' ListAuditFindingsResponse (Prelude.Maybe Prelude.Text)
listAuditFindingsResponse_nextToken :: Lens' ListAuditFindingsResponse (Maybe Text)
listAuditFindingsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAuditFindingsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAuditFindingsResponse' :: ListAuditFindingsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAuditFindingsResponse
s@ListAuditFindingsResponse' {} Maybe Text
a -> ListAuditFindingsResponse
s {$sel:nextToken:ListAuditFindingsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAuditFindingsResponse)

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

instance Prelude.NFData ListAuditFindingsResponse where
  rnf :: ListAuditFindingsResponse -> ()
rnf ListAuditFindingsResponse' {Int
Maybe [AuditFinding]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
findings :: Maybe [AuditFinding]
$sel:httpStatus:ListAuditFindingsResponse' :: ListAuditFindingsResponse -> Int
$sel:nextToken:ListAuditFindingsResponse' :: ListAuditFindingsResponse -> Maybe Text
$sel:findings:ListAuditFindingsResponse' :: ListAuditFindingsResponse -> Maybe [AuditFinding]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [AuditFinding]
findings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus