{-# 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.ListAuditMitigationActionsExecutions
-- 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)
--
-- Gets the status of audit mitigation action tasks that were executed.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions ListAuditMitigationActionsExecutions>
-- action.
--
-- This operation returns paginated results.
module Amazonka.IoT.ListAuditMitigationActionsExecutions
  ( -- * Creating a Request
    ListAuditMitigationActionsExecutions (..),
    newListAuditMitigationActionsExecutions,

    -- * Request Lenses
    listAuditMitigationActionsExecutions_nextToken,
    listAuditMitigationActionsExecutions_actionStatus,
    listAuditMitigationActionsExecutions_maxResults,
    listAuditMitigationActionsExecutions_taskId,
    listAuditMitigationActionsExecutions_findingId,

    -- * Destructuring the Response
    ListAuditMitigationActionsExecutionsResponse (..),
    newListAuditMitigationActionsExecutionsResponse,

    -- * Response Lenses
    listAuditMitigationActionsExecutionsResponse_actionsExecutions,
    listAuditMitigationActionsExecutionsResponse_nextToken,
    listAuditMitigationActionsExecutionsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoT.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

-- | /See:/ 'newListAuditMitigationActionsExecutions' smart constructor.
data ListAuditMitigationActionsExecutions = ListAuditMitigationActionsExecutions'
  { -- | The token for the next set of results.
    ListAuditMitigationActionsExecutions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Specify this filter to limit results to those with a specific status.
    ListAuditMitigationActionsExecutions
-> Maybe AuditMitigationActionsExecutionStatus
actionStatus :: Prelude.Maybe AuditMitigationActionsExecutionStatus,
    -- | The maximum number of results to return at one time. The default is 25.
    ListAuditMitigationActionsExecutions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | Specify this filter to limit results to actions for a specific audit
    -- mitigation actions task.
    ListAuditMitigationActionsExecutions -> Text
taskId :: Prelude.Text,
    -- | Specify this filter to limit results to those that were applied to a
    -- specific audit finding.
    ListAuditMitigationActionsExecutions -> Text
findingId :: Prelude.Text
  }
  deriving (ListAuditMitigationActionsExecutions
-> ListAuditMitigationActionsExecutions -> Bool
(ListAuditMitigationActionsExecutions
 -> ListAuditMitigationActionsExecutions -> Bool)
-> (ListAuditMitigationActionsExecutions
    -> ListAuditMitigationActionsExecutions -> Bool)
-> Eq ListAuditMitigationActionsExecutions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAuditMitigationActionsExecutions
-> ListAuditMitigationActionsExecutions -> Bool
$c/= :: ListAuditMitigationActionsExecutions
-> ListAuditMitigationActionsExecutions -> Bool
== :: ListAuditMitigationActionsExecutions
-> ListAuditMitigationActionsExecutions -> Bool
$c== :: ListAuditMitigationActionsExecutions
-> ListAuditMitigationActionsExecutions -> Bool
Prelude.Eq, ReadPrec [ListAuditMitigationActionsExecutions]
ReadPrec ListAuditMitigationActionsExecutions
Int -> ReadS ListAuditMitigationActionsExecutions
ReadS [ListAuditMitigationActionsExecutions]
(Int -> ReadS ListAuditMitigationActionsExecutions)
-> ReadS [ListAuditMitigationActionsExecutions]
-> ReadPrec ListAuditMitigationActionsExecutions
-> ReadPrec [ListAuditMitigationActionsExecutions]
-> Read ListAuditMitigationActionsExecutions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAuditMitigationActionsExecutions]
$creadListPrec :: ReadPrec [ListAuditMitigationActionsExecutions]
readPrec :: ReadPrec ListAuditMitigationActionsExecutions
$creadPrec :: ReadPrec ListAuditMitigationActionsExecutions
readList :: ReadS [ListAuditMitigationActionsExecutions]
$creadList :: ReadS [ListAuditMitigationActionsExecutions]
readsPrec :: Int -> ReadS ListAuditMitigationActionsExecutions
$creadsPrec :: Int -> ReadS ListAuditMitigationActionsExecutions
Prelude.Read, Int -> ListAuditMitigationActionsExecutions -> ShowS
[ListAuditMitigationActionsExecutions] -> ShowS
ListAuditMitigationActionsExecutions -> String
(Int -> ListAuditMitigationActionsExecutions -> ShowS)
-> (ListAuditMitigationActionsExecutions -> String)
-> ([ListAuditMitigationActionsExecutions] -> ShowS)
-> Show ListAuditMitigationActionsExecutions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAuditMitigationActionsExecutions] -> ShowS
$cshowList :: [ListAuditMitigationActionsExecutions] -> ShowS
show :: ListAuditMitigationActionsExecutions -> String
$cshow :: ListAuditMitigationActionsExecutions -> String
showsPrec :: Int -> ListAuditMitigationActionsExecutions -> ShowS
$cshowsPrec :: Int -> ListAuditMitigationActionsExecutions -> ShowS
Prelude.Show, (forall x.
 ListAuditMitigationActionsExecutions
 -> Rep ListAuditMitigationActionsExecutions x)
-> (forall x.
    Rep ListAuditMitigationActionsExecutions x
    -> ListAuditMitigationActionsExecutions)
-> Generic ListAuditMitigationActionsExecutions
forall x.
Rep ListAuditMitigationActionsExecutions x
-> ListAuditMitigationActionsExecutions
forall x.
ListAuditMitigationActionsExecutions
-> Rep ListAuditMitigationActionsExecutions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAuditMitigationActionsExecutions x
-> ListAuditMitigationActionsExecutions
$cfrom :: forall x.
ListAuditMitigationActionsExecutions
-> Rep ListAuditMitigationActionsExecutions x
Prelude.Generic)

-- |
-- Create a value of 'ListAuditMitigationActionsExecutions' 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', 'listAuditMitigationActionsExecutions_nextToken' - The token for the next set of results.
--
-- 'actionStatus', 'listAuditMitigationActionsExecutions_actionStatus' - Specify this filter to limit results to those with a specific status.
--
-- 'maxResults', 'listAuditMitigationActionsExecutions_maxResults' - The maximum number of results to return at one time. The default is 25.
--
-- 'taskId', 'listAuditMitigationActionsExecutions_taskId' - Specify this filter to limit results to actions for a specific audit
-- mitigation actions task.
--
-- 'findingId', 'listAuditMitigationActionsExecutions_findingId' - Specify this filter to limit results to those that were applied to a
-- specific audit finding.
newListAuditMitigationActionsExecutions ::
  -- | 'taskId'
  Prelude.Text ->
  -- | 'findingId'
  Prelude.Text ->
  ListAuditMitigationActionsExecutions
newListAuditMitigationActionsExecutions :: Text -> Text -> ListAuditMitigationActionsExecutions
newListAuditMitigationActionsExecutions
  Text
pTaskId_
  Text
pFindingId_ =
    ListAuditMitigationActionsExecutions' :: Maybe Text
-> Maybe AuditMitigationActionsExecutionStatus
-> Maybe Natural
-> Text
-> Text
-> ListAuditMitigationActionsExecutions
ListAuditMitigationActionsExecutions'
      { $sel:nextToken:ListAuditMitigationActionsExecutions' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:actionStatus:ListAuditMitigationActionsExecutions' :: Maybe AuditMitigationActionsExecutionStatus
actionStatus = Maybe AuditMitigationActionsExecutionStatus
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListAuditMitigationActionsExecutions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:taskId:ListAuditMitigationActionsExecutions' :: Text
taskId = Text
pTaskId_,
        $sel:findingId:ListAuditMitigationActionsExecutions' :: Text
findingId = Text
pFindingId_
      }

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

-- | Specify this filter to limit results to those with a specific status.
listAuditMitigationActionsExecutions_actionStatus :: Lens.Lens' ListAuditMitigationActionsExecutions (Prelude.Maybe AuditMitigationActionsExecutionStatus)
listAuditMitigationActionsExecutions_actionStatus :: (Maybe AuditMitigationActionsExecutionStatus
 -> f (Maybe AuditMitigationActionsExecutionStatus))
-> ListAuditMitigationActionsExecutions
-> f ListAuditMitigationActionsExecutions
listAuditMitigationActionsExecutions_actionStatus = (ListAuditMitigationActionsExecutions
 -> Maybe AuditMitigationActionsExecutionStatus)
-> (ListAuditMitigationActionsExecutions
    -> Maybe AuditMitigationActionsExecutionStatus
    -> ListAuditMitigationActionsExecutions)
-> Lens
     ListAuditMitigationActionsExecutions
     ListAuditMitigationActionsExecutions
     (Maybe AuditMitigationActionsExecutionStatus)
     (Maybe AuditMitigationActionsExecutionStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAuditMitigationActionsExecutions' {Maybe AuditMitigationActionsExecutionStatus
actionStatus :: Maybe AuditMitigationActionsExecutionStatus
$sel:actionStatus:ListAuditMitigationActionsExecutions' :: ListAuditMitigationActionsExecutions
-> Maybe AuditMitigationActionsExecutionStatus
actionStatus} -> Maybe AuditMitigationActionsExecutionStatus
actionStatus) (\s :: ListAuditMitigationActionsExecutions
s@ListAuditMitigationActionsExecutions' {} Maybe AuditMitigationActionsExecutionStatus
a -> ListAuditMitigationActionsExecutions
s {$sel:actionStatus:ListAuditMitigationActionsExecutions' :: Maybe AuditMitigationActionsExecutionStatus
actionStatus = Maybe AuditMitigationActionsExecutionStatus
a} :: ListAuditMitigationActionsExecutions)

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

-- | Specify this filter to limit results to actions for a specific audit
-- mitigation actions task.
listAuditMitigationActionsExecutions_taskId :: Lens.Lens' ListAuditMitigationActionsExecutions Prelude.Text
listAuditMitigationActionsExecutions_taskId :: (Text -> f Text)
-> ListAuditMitigationActionsExecutions
-> f ListAuditMitigationActionsExecutions
listAuditMitigationActionsExecutions_taskId = (ListAuditMitigationActionsExecutions -> Text)
-> (ListAuditMitigationActionsExecutions
    -> Text -> ListAuditMitigationActionsExecutions)
-> Lens
     ListAuditMitigationActionsExecutions
     ListAuditMitigationActionsExecutions
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAuditMitigationActionsExecutions' {Text
taskId :: Text
$sel:taskId:ListAuditMitigationActionsExecutions' :: ListAuditMitigationActionsExecutions -> Text
taskId} -> Text
taskId) (\s :: ListAuditMitigationActionsExecutions
s@ListAuditMitigationActionsExecutions' {} Text
a -> ListAuditMitigationActionsExecutions
s {$sel:taskId:ListAuditMitigationActionsExecutions' :: Text
taskId = Text
a} :: ListAuditMitigationActionsExecutions)

-- | Specify this filter to limit results to those that were applied to a
-- specific audit finding.
listAuditMitigationActionsExecutions_findingId :: Lens.Lens' ListAuditMitigationActionsExecutions Prelude.Text
listAuditMitigationActionsExecutions_findingId :: (Text -> f Text)
-> ListAuditMitigationActionsExecutions
-> f ListAuditMitigationActionsExecutions
listAuditMitigationActionsExecutions_findingId = (ListAuditMitigationActionsExecutions -> Text)
-> (ListAuditMitigationActionsExecutions
    -> Text -> ListAuditMitigationActionsExecutions)
-> Lens
     ListAuditMitigationActionsExecutions
     ListAuditMitigationActionsExecutions
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAuditMitigationActionsExecutions' {Text
findingId :: Text
$sel:findingId:ListAuditMitigationActionsExecutions' :: ListAuditMitigationActionsExecutions -> Text
findingId} -> Text
findingId) (\s :: ListAuditMitigationActionsExecutions
s@ListAuditMitigationActionsExecutions' {} Text
a -> ListAuditMitigationActionsExecutions
s {$sel:findingId:ListAuditMitigationActionsExecutions' :: Text
findingId = Text
a} :: ListAuditMitigationActionsExecutions)

instance
  Core.AWSPager
    ListAuditMitigationActionsExecutions
  where
  page :: ListAuditMitigationActionsExecutions
-> AWSResponse ListAuditMitigationActionsExecutions
-> Maybe ListAuditMitigationActionsExecutions
page ListAuditMitigationActionsExecutions
rq AWSResponse ListAuditMitigationActionsExecutions
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAuditMitigationActionsExecutions
ListAuditMitigationActionsExecutionsResponse
rs
            ListAuditMitigationActionsExecutionsResponse
-> Getting
     (First Text) ListAuditMitigationActionsExecutionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListAuditMitigationActionsExecutionsResponse
-> Const (First Text) ListAuditMitigationActionsExecutionsResponse
Lens' ListAuditMitigationActionsExecutionsResponse (Maybe Text)
listAuditMitigationActionsExecutionsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListAuditMitigationActionsExecutionsResponse
 -> Const (First Text) ListAuditMitigationActionsExecutionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) ListAuditMitigationActionsExecutionsResponse 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 ListAuditMitigationActionsExecutions
forall a. Maybe a
Prelude.Nothing
    | Maybe [AuditMitigationActionExecutionMetadata] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAuditMitigationActionsExecutions
ListAuditMitigationActionsExecutionsResponse
rs
            ListAuditMitigationActionsExecutionsResponse
-> Getting
     (First [AuditMitigationActionExecutionMetadata])
     ListAuditMitigationActionsExecutionsResponse
     [AuditMitigationActionExecutionMetadata]
-> Maybe [AuditMitigationActionExecutionMetadata]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [AuditMitigationActionExecutionMetadata]
 -> Const
      (First [AuditMitigationActionExecutionMetadata])
      (Maybe [AuditMitigationActionExecutionMetadata]))
-> ListAuditMitigationActionsExecutionsResponse
-> Const
     (First [AuditMitigationActionExecutionMetadata])
     ListAuditMitigationActionsExecutionsResponse
Lens'
  ListAuditMitigationActionsExecutionsResponse
  (Maybe [AuditMitigationActionExecutionMetadata])
listAuditMitigationActionsExecutionsResponse_actionsExecutions
              ((Maybe [AuditMitigationActionExecutionMetadata]
  -> Const
       (First [AuditMitigationActionExecutionMetadata])
       (Maybe [AuditMitigationActionExecutionMetadata]))
 -> ListAuditMitigationActionsExecutionsResponse
 -> Const
      (First [AuditMitigationActionExecutionMetadata])
      ListAuditMitigationActionsExecutionsResponse)
-> (([AuditMitigationActionExecutionMetadata]
     -> Const
          (First [AuditMitigationActionExecutionMetadata])
          [AuditMitigationActionExecutionMetadata])
    -> Maybe [AuditMitigationActionExecutionMetadata]
    -> Const
         (First [AuditMitigationActionExecutionMetadata])
         (Maybe [AuditMitigationActionExecutionMetadata]))
-> Getting
     (First [AuditMitigationActionExecutionMetadata])
     ListAuditMitigationActionsExecutionsResponse
     [AuditMitigationActionExecutionMetadata]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([AuditMitigationActionExecutionMetadata]
 -> Const
      (First [AuditMitigationActionExecutionMetadata])
      [AuditMitigationActionExecutionMetadata])
-> Maybe [AuditMitigationActionExecutionMetadata]
-> Const
     (First [AuditMitigationActionExecutionMetadata])
     (Maybe [AuditMitigationActionExecutionMetadata])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListAuditMitigationActionsExecutions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListAuditMitigationActionsExecutions
-> Maybe ListAuditMitigationActionsExecutions
forall a. a -> Maybe a
Prelude.Just (ListAuditMitigationActionsExecutions
 -> Maybe ListAuditMitigationActionsExecutions)
-> ListAuditMitigationActionsExecutions
-> Maybe ListAuditMitigationActionsExecutions
forall a b. (a -> b) -> a -> b
Prelude.$
        ListAuditMitigationActionsExecutions
rq
          ListAuditMitigationActionsExecutions
-> (ListAuditMitigationActionsExecutions
    -> ListAuditMitigationActionsExecutions)
-> ListAuditMitigationActionsExecutions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListAuditMitigationActionsExecutions
-> Identity ListAuditMitigationActionsExecutions
Lens
  ListAuditMitigationActionsExecutions
  ListAuditMitigationActionsExecutions
  (Maybe Text)
  (Maybe Text)
listAuditMitigationActionsExecutions_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListAuditMitigationActionsExecutions
 -> Identity ListAuditMitigationActionsExecutions)
-> Maybe Text
-> ListAuditMitigationActionsExecutions
-> ListAuditMitigationActionsExecutions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAuditMitigationActionsExecutions
ListAuditMitigationActionsExecutionsResponse
rs
            ListAuditMitigationActionsExecutionsResponse
-> Getting
     (First Text) ListAuditMitigationActionsExecutionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListAuditMitigationActionsExecutionsResponse
-> Const (First Text) ListAuditMitigationActionsExecutionsResponse
Lens' ListAuditMitigationActionsExecutionsResponse (Maybe Text)
listAuditMitigationActionsExecutionsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListAuditMitigationActionsExecutionsResponse
 -> Const (First Text) ListAuditMitigationActionsExecutionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) ListAuditMitigationActionsExecutionsResponse 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
    ListAuditMitigationActionsExecutions
  where
  type
    AWSResponse ListAuditMitigationActionsExecutions =
      ListAuditMitigationActionsExecutionsResponse
  request :: ListAuditMitigationActionsExecutions
-> Request ListAuditMitigationActionsExecutions
request = Service
-> ListAuditMitigationActionsExecutions
-> Request ListAuditMitigationActionsExecutions
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListAuditMitigationActionsExecutions
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse ListAuditMitigationActionsExecutions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either
      String (AWSResponse ListAuditMitigationActionsExecutions))
-> Logger
-> Service
-> Proxy ListAuditMitigationActionsExecutions
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse ListAuditMitigationActionsExecutions)))
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 [AuditMitigationActionExecutionMetadata]
-> Maybe Text
-> Int
-> ListAuditMitigationActionsExecutionsResponse
ListAuditMitigationActionsExecutionsResponse'
            (Maybe [AuditMitigationActionExecutionMetadata]
 -> Maybe Text
 -> Int
 -> ListAuditMitigationActionsExecutionsResponse)
-> Either String (Maybe [AuditMitigationActionExecutionMetadata])
-> Either
     String
     (Maybe Text -> Int -> ListAuditMitigationActionsExecutionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text
-> Either
     String (Maybe (Maybe [AuditMitigationActionExecutionMetadata]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"actionsExecutions"
                            Either
  String (Maybe (Maybe [AuditMitigationActionExecutionMetadata]))
-> Maybe [AuditMitigationActionExecutionMetadata]
-> Either String (Maybe [AuditMitigationActionExecutionMetadata])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [AuditMitigationActionExecutionMetadata]
forall a. Monoid a => a
Prelude.mempty
                        )
              Either
  String
  (Maybe Text -> Int -> ListAuditMitigationActionsExecutionsResponse)
-> Either String (Maybe Text)
-> Either
     String (Int -> ListAuditMitigationActionsExecutionsResponse)
forall (f :: * -> *) a b. Applicative f => 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 -> ListAuditMitigationActionsExecutionsResponse)
-> Either String Int
-> Either String ListAuditMitigationActionsExecutionsResponse
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))
      )

instance
  Prelude.Hashable
    ListAuditMitigationActionsExecutions

instance
  Prelude.NFData
    ListAuditMitigationActionsExecutions

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

instance
  Core.ToPath
    ListAuditMitigationActionsExecutions
  where
  toPath :: ListAuditMitigationActionsExecutions -> ByteString
toPath =
    ByteString -> ListAuditMitigationActionsExecutions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/audit/mitigationactions/executions"

instance
  Core.ToQuery
    ListAuditMitigationActionsExecutions
  where
  toQuery :: ListAuditMitigationActionsExecutions -> QueryString
toQuery ListAuditMitigationActionsExecutions' {Maybe Natural
Maybe Text
Maybe AuditMitigationActionsExecutionStatus
Text
findingId :: Text
taskId :: Text
maxResults :: Maybe Natural
actionStatus :: Maybe AuditMitigationActionsExecutionStatus
nextToken :: Maybe Text
$sel:findingId:ListAuditMitigationActionsExecutions' :: ListAuditMitigationActionsExecutions -> Text
$sel:taskId:ListAuditMitigationActionsExecutions' :: ListAuditMitigationActionsExecutions -> Text
$sel:maxResults:ListAuditMitigationActionsExecutions' :: ListAuditMitigationActionsExecutions -> Maybe Natural
$sel:actionStatus:ListAuditMitigationActionsExecutions' :: ListAuditMitigationActionsExecutions
-> Maybe AuditMitigationActionsExecutionStatus
$sel:nextToken:ListAuditMitigationActionsExecutions' :: ListAuditMitigationActionsExecutions -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"actionStatus" ByteString
-> Maybe AuditMitigationActionsExecutionStatus -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe AuditMitigationActionsExecutionStatus
actionStatus,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults,
        ByteString
"taskId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
taskId,
        ByteString
"findingId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
findingId
      ]

-- | /See:/ 'newListAuditMitigationActionsExecutionsResponse' smart constructor.
data ListAuditMitigationActionsExecutionsResponse = ListAuditMitigationActionsExecutionsResponse'
  { -- | A set of task execution results based on the input parameters. Details
    -- include the mitigation action applied, start time, and task status.
    ListAuditMitigationActionsExecutionsResponse
-> Maybe [AuditMitigationActionExecutionMetadata]
actionsExecutions :: Prelude.Maybe [AuditMitigationActionExecutionMetadata],
    -- | The token for the next set of results.
    ListAuditMitigationActionsExecutionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListAuditMitigationActionsExecutionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListAuditMitigationActionsExecutionsResponse
-> ListAuditMitigationActionsExecutionsResponse -> Bool
(ListAuditMitigationActionsExecutionsResponse
 -> ListAuditMitigationActionsExecutionsResponse -> Bool)
-> (ListAuditMitigationActionsExecutionsResponse
    -> ListAuditMitigationActionsExecutionsResponse -> Bool)
-> Eq ListAuditMitigationActionsExecutionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAuditMitigationActionsExecutionsResponse
-> ListAuditMitigationActionsExecutionsResponse -> Bool
$c/= :: ListAuditMitigationActionsExecutionsResponse
-> ListAuditMitigationActionsExecutionsResponse -> Bool
== :: ListAuditMitigationActionsExecutionsResponse
-> ListAuditMitigationActionsExecutionsResponse -> Bool
$c== :: ListAuditMitigationActionsExecutionsResponse
-> ListAuditMitigationActionsExecutionsResponse -> Bool
Prelude.Eq, ReadPrec [ListAuditMitigationActionsExecutionsResponse]
ReadPrec ListAuditMitigationActionsExecutionsResponse
Int -> ReadS ListAuditMitigationActionsExecutionsResponse
ReadS [ListAuditMitigationActionsExecutionsResponse]
(Int -> ReadS ListAuditMitigationActionsExecutionsResponse)
-> ReadS [ListAuditMitigationActionsExecutionsResponse]
-> ReadPrec ListAuditMitigationActionsExecutionsResponse
-> ReadPrec [ListAuditMitigationActionsExecutionsResponse]
-> Read ListAuditMitigationActionsExecutionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAuditMitigationActionsExecutionsResponse]
$creadListPrec :: ReadPrec [ListAuditMitigationActionsExecutionsResponse]
readPrec :: ReadPrec ListAuditMitigationActionsExecutionsResponse
$creadPrec :: ReadPrec ListAuditMitigationActionsExecutionsResponse
readList :: ReadS [ListAuditMitigationActionsExecutionsResponse]
$creadList :: ReadS [ListAuditMitigationActionsExecutionsResponse]
readsPrec :: Int -> ReadS ListAuditMitigationActionsExecutionsResponse
$creadsPrec :: Int -> ReadS ListAuditMitigationActionsExecutionsResponse
Prelude.Read, Int -> ListAuditMitigationActionsExecutionsResponse -> ShowS
[ListAuditMitigationActionsExecutionsResponse] -> ShowS
ListAuditMitigationActionsExecutionsResponse -> String
(Int -> ListAuditMitigationActionsExecutionsResponse -> ShowS)
-> (ListAuditMitigationActionsExecutionsResponse -> String)
-> ([ListAuditMitigationActionsExecutionsResponse] -> ShowS)
-> Show ListAuditMitigationActionsExecutionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAuditMitigationActionsExecutionsResponse] -> ShowS
$cshowList :: [ListAuditMitigationActionsExecutionsResponse] -> ShowS
show :: ListAuditMitigationActionsExecutionsResponse -> String
$cshow :: ListAuditMitigationActionsExecutionsResponse -> String
showsPrec :: Int -> ListAuditMitigationActionsExecutionsResponse -> ShowS
$cshowsPrec :: Int -> ListAuditMitigationActionsExecutionsResponse -> ShowS
Prelude.Show, (forall x.
 ListAuditMitigationActionsExecutionsResponse
 -> Rep ListAuditMitigationActionsExecutionsResponse x)
-> (forall x.
    Rep ListAuditMitigationActionsExecutionsResponse x
    -> ListAuditMitigationActionsExecutionsResponse)
-> Generic ListAuditMitigationActionsExecutionsResponse
forall x.
Rep ListAuditMitigationActionsExecutionsResponse x
-> ListAuditMitigationActionsExecutionsResponse
forall x.
ListAuditMitigationActionsExecutionsResponse
-> Rep ListAuditMitigationActionsExecutionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAuditMitigationActionsExecutionsResponse x
-> ListAuditMitigationActionsExecutionsResponse
$cfrom :: forall x.
ListAuditMitigationActionsExecutionsResponse
-> Rep ListAuditMitigationActionsExecutionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAuditMitigationActionsExecutionsResponse' 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:
--
-- 'actionsExecutions', 'listAuditMitigationActionsExecutionsResponse_actionsExecutions' - A set of task execution results based on the input parameters. Details
-- include the mitigation action applied, start time, and task status.
--
-- 'nextToken', 'listAuditMitigationActionsExecutionsResponse_nextToken' - The token for the next set of results.
--
-- 'httpStatus', 'listAuditMitigationActionsExecutionsResponse_httpStatus' - The response's http status code.
newListAuditMitigationActionsExecutionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAuditMitigationActionsExecutionsResponse
newListAuditMitigationActionsExecutionsResponse :: Int -> ListAuditMitigationActionsExecutionsResponse
newListAuditMitigationActionsExecutionsResponse
  Int
pHttpStatus_ =
    ListAuditMitigationActionsExecutionsResponse' :: Maybe [AuditMitigationActionExecutionMetadata]
-> Maybe Text
-> Int
-> ListAuditMitigationActionsExecutionsResponse
ListAuditMitigationActionsExecutionsResponse'
      { $sel:actionsExecutions:ListAuditMitigationActionsExecutionsResponse' :: Maybe [AuditMitigationActionExecutionMetadata]
actionsExecutions =
          Maybe [AuditMitigationActionExecutionMetadata]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:ListAuditMitigationActionsExecutionsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListAuditMitigationActionsExecutionsResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | A set of task execution results based on the input parameters. Details
-- include the mitigation action applied, start time, and task status.
listAuditMitigationActionsExecutionsResponse_actionsExecutions :: Lens.Lens' ListAuditMitigationActionsExecutionsResponse (Prelude.Maybe [AuditMitigationActionExecutionMetadata])
listAuditMitigationActionsExecutionsResponse_actionsExecutions :: (Maybe [AuditMitigationActionExecutionMetadata]
 -> f (Maybe [AuditMitigationActionExecutionMetadata]))
-> ListAuditMitigationActionsExecutionsResponse
-> f ListAuditMitigationActionsExecutionsResponse
listAuditMitigationActionsExecutionsResponse_actionsExecutions = (ListAuditMitigationActionsExecutionsResponse
 -> Maybe [AuditMitigationActionExecutionMetadata])
-> (ListAuditMitigationActionsExecutionsResponse
    -> Maybe [AuditMitigationActionExecutionMetadata]
    -> ListAuditMitigationActionsExecutionsResponse)
-> Lens'
     ListAuditMitigationActionsExecutionsResponse
     (Maybe [AuditMitigationActionExecutionMetadata])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAuditMitigationActionsExecutionsResponse' {Maybe [AuditMitigationActionExecutionMetadata]
actionsExecutions :: Maybe [AuditMitigationActionExecutionMetadata]
$sel:actionsExecutions:ListAuditMitigationActionsExecutionsResponse' :: ListAuditMitigationActionsExecutionsResponse
-> Maybe [AuditMitigationActionExecutionMetadata]
actionsExecutions} -> Maybe [AuditMitigationActionExecutionMetadata]
actionsExecutions) (\s :: ListAuditMitigationActionsExecutionsResponse
s@ListAuditMitigationActionsExecutionsResponse' {} Maybe [AuditMitigationActionExecutionMetadata]
a -> ListAuditMitigationActionsExecutionsResponse
s {$sel:actionsExecutions:ListAuditMitigationActionsExecutionsResponse' :: Maybe [AuditMitigationActionExecutionMetadata]
actionsExecutions = Maybe [AuditMitigationActionExecutionMetadata]
a} :: ListAuditMitigationActionsExecutionsResponse) ((Maybe [AuditMitigationActionExecutionMetadata]
  -> f (Maybe [AuditMitigationActionExecutionMetadata]))
 -> ListAuditMitigationActionsExecutionsResponse
 -> f ListAuditMitigationActionsExecutionsResponse)
-> ((Maybe [AuditMitigationActionExecutionMetadata]
     -> f (Maybe [AuditMitigationActionExecutionMetadata]))
    -> Maybe [AuditMitigationActionExecutionMetadata]
    -> f (Maybe [AuditMitigationActionExecutionMetadata]))
-> (Maybe [AuditMitigationActionExecutionMetadata]
    -> f (Maybe [AuditMitigationActionExecutionMetadata]))
-> ListAuditMitigationActionsExecutionsResponse
-> f ListAuditMitigationActionsExecutionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AuditMitigationActionExecutionMetadata]
  [AuditMitigationActionExecutionMetadata]
  [AuditMitigationActionExecutionMetadata]
  [AuditMitigationActionExecutionMetadata]
-> Iso
     (Maybe [AuditMitigationActionExecutionMetadata])
     (Maybe [AuditMitigationActionExecutionMetadata])
     (Maybe [AuditMitigationActionExecutionMetadata])
     (Maybe [AuditMitigationActionExecutionMetadata])
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
  [AuditMitigationActionExecutionMetadata]
  [AuditMitigationActionExecutionMetadata]
  [AuditMitigationActionExecutionMetadata]
  [AuditMitigationActionExecutionMetadata]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance
  Prelude.NFData
    ListAuditMitigationActionsExecutionsResponse