{-# 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.ListDetectMitigationActionsTasks
-- 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)
--
-- List of Device Defender ML Detect mitigation actions tasks.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions ListDetectMitigationActionsTasks>
-- action.
--
-- This operation returns paginated results.
module Amazonka.IoT.ListDetectMitigationActionsTasks
  ( -- * Creating a Request
    ListDetectMitigationActionsTasks (..),
    newListDetectMitigationActionsTasks,

    -- * Request Lenses
    listDetectMitigationActionsTasks_nextToken,
    listDetectMitigationActionsTasks_maxResults,
    listDetectMitigationActionsTasks_startTime,
    listDetectMitigationActionsTasks_endTime,

    -- * Destructuring the Response
    ListDetectMitigationActionsTasksResponse (..),
    newListDetectMitigationActionsTasksResponse,

    -- * Response Lenses
    listDetectMitigationActionsTasksResponse_tasks,
    listDetectMitigationActionsTasksResponse_nextToken,
    listDetectMitigationActionsTasksResponse_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:/ 'newListDetectMitigationActionsTasks' smart constructor.
data ListDetectMitigationActionsTasks = ListDetectMitigationActionsTasks'
  { -- | The token for the next set of results.
    ListDetectMitigationActionsTasks -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return at one time. The default is 25.
    ListDetectMitigationActionsTasks -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | 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.
    ListDetectMitigationActionsTasks -> POSIX
startTime :: Core.POSIX,
    -- | The end of the time period for which ML Detect mitigation actions tasks
    -- are returned.
    ListDetectMitigationActionsTasks -> POSIX
endTime :: Core.POSIX
  }
  deriving (ListDetectMitigationActionsTasks
-> ListDetectMitigationActionsTasks -> Bool
(ListDetectMitigationActionsTasks
 -> ListDetectMitigationActionsTasks -> Bool)
-> (ListDetectMitigationActionsTasks
    -> ListDetectMitigationActionsTasks -> Bool)
-> Eq ListDetectMitigationActionsTasks
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDetectMitigationActionsTasks
-> ListDetectMitigationActionsTasks -> Bool
$c/= :: ListDetectMitigationActionsTasks
-> ListDetectMitigationActionsTasks -> Bool
== :: ListDetectMitigationActionsTasks
-> ListDetectMitigationActionsTasks -> Bool
$c== :: ListDetectMitigationActionsTasks
-> ListDetectMitigationActionsTasks -> Bool
Prelude.Eq, ReadPrec [ListDetectMitigationActionsTasks]
ReadPrec ListDetectMitigationActionsTasks
Int -> ReadS ListDetectMitigationActionsTasks
ReadS [ListDetectMitigationActionsTasks]
(Int -> ReadS ListDetectMitigationActionsTasks)
-> ReadS [ListDetectMitigationActionsTasks]
-> ReadPrec ListDetectMitigationActionsTasks
-> ReadPrec [ListDetectMitigationActionsTasks]
-> Read ListDetectMitigationActionsTasks
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDetectMitigationActionsTasks]
$creadListPrec :: ReadPrec [ListDetectMitigationActionsTasks]
readPrec :: ReadPrec ListDetectMitigationActionsTasks
$creadPrec :: ReadPrec ListDetectMitigationActionsTasks
readList :: ReadS [ListDetectMitigationActionsTasks]
$creadList :: ReadS [ListDetectMitigationActionsTasks]
readsPrec :: Int -> ReadS ListDetectMitigationActionsTasks
$creadsPrec :: Int -> ReadS ListDetectMitigationActionsTasks
Prelude.Read, Int -> ListDetectMitigationActionsTasks -> ShowS
[ListDetectMitigationActionsTasks] -> ShowS
ListDetectMitigationActionsTasks -> String
(Int -> ListDetectMitigationActionsTasks -> ShowS)
-> (ListDetectMitigationActionsTasks -> String)
-> ([ListDetectMitigationActionsTasks] -> ShowS)
-> Show ListDetectMitigationActionsTasks
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDetectMitigationActionsTasks] -> ShowS
$cshowList :: [ListDetectMitigationActionsTasks] -> ShowS
show :: ListDetectMitigationActionsTasks -> String
$cshow :: ListDetectMitigationActionsTasks -> String
showsPrec :: Int -> ListDetectMitigationActionsTasks -> ShowS
$cshowsPrec :: Int -> ListDetectMitigationActionsTasks -> ShowS
Prelude.Show, (forall x.
 ListDetectMitigationActionsTasks
 -> Rep ListDetectMitigationActionsTasks x)
-> (forall x.
    Rep ListDetectMitigationActionsTasks x
    -> ListDetectMitigationActionsTasks)
-> Generic ListDetectMitigationActionsTasks
forall x.
Rep ListDetectMitigationActionsTasks x
-> ListDetectMitigationActionsTasks
forall x.
ListDetectMitigationActionsTasks
-> Rep ListDetectMitigationActionsTasks x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListDetectMitigationActionsTasks x
-> ListDetectMitigationActionsTasks
$cfrom :: forall x.
ListDetectMitigationActionsTasks
-> Rep ListDetectMitigationActionsTasks x
Prelude.Generic)

-- |
-- Create a value of 'ListDetectMitigationActionsTasks' 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', 'listDetectMitigationActionsTasks_nextToken' - The token for the next set of results.
--
-- 'maxResults', 'listDetectMitigationActionsTasks_maxResults' - The maximum number of results to return at one time. The default is 25.
--
-- 'startTime', 'listDetectMitigationActionsTasks_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.
--
-- 'endTime', 'listDetectMitigationActionsTasks_endTime' - The end of the time period for which ML Detect mitigation actions tasks
-- are returned.
newListDetectMitigationActionsTasks ::
  -- | 'startTime'
  Prelude.UTCTime ->
  -- | 'endTime'
  Prelude.UTCTime ->
  ListDetectMitigationActionsTasks
newListDetectMitigationActionsTasks :: UTCTime -> UTCTime -> ListDetectMitigationActionsTasks
newListDetectMitigationActionsTasks
  UTCTime
pStartTime_
  UTCTime
pEndTime_ =
    ListDetectMitigationActionsTasks' :: Maybe Text
-> Maybe Natural
-> POSIX
-> POSIX
-> ListDetectMitigationActionsTasks
ListDetectMitigationActionsTasks'
      { $sel:nextToken:ListDetectMitigationActionsTasks' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListDetectMitigationActionsTasks' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:startTime:ListDetectMitigationActionsTasks' :: POSIX
startTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartTime_,
        $sel:endTime:ListDetectMitigationActionsTasks' :: POSIX
endTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEndTime_
      }

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

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

-- | 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.
listDetectMitigationActionsTasks_startTime :: Lens.Lens' ListDetectMitigationActionsTasks Prelude.UTCTime
listDetectMitigationActionsTasks_startTime :: (UTCTime -> f UTCTime)
-> ListDetectMitigationActionsTasks
-> f ListDetectMitigationActionsTasks
listDetectMitigationActionsTasks_startTime = (ListDetectMitigationActionsTasks -> POSIX)
-> (ListDetectMitigationActionsTasks
    -> POSIX -> ListDetectMitigationActionsTasks)
-> Lens
     ListDetectMitigationActionsTasks
     ListDetectMitigationActionsTasks
     POSIX
     POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDetectMitigationActionsTasks' {POSIX
startTime :: POSIX
$sel:startTime:ListDetectMitigationActionsTasks' :: ListDetectMitigationActionsTasks -> POSIX
startTime} -> POSIX
startTime) (\s :: ListDetectMitigationActionsTasks
s@ListDetectMitigationActionsTasks' {} POSIX
a -> ListDetectMitigationActionsTasks
s {$sel:startTime:ListDetectMitigationActionsTasks' :: POSIX
startTime = POSIX
a} :: ListDetectMitigationActionsTasks) ((POSIX -> f POSIX)
 -> ListDetectMitigationActionsTasks
 -> f ListDetectMitigationActionsTasks)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> ListDetectMitigationActionsTasks
-> f ListDetectMitigationActionsTasks
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The end of the time period for which ML Detect mitigation actions tasks
-- are returned.
listDetectMitigationActionsTasks_endTime :: Lens.Lens' ListDetectMitigationActionsTasks Prelude.UTCTime
listDetectMitigationActionsTasks_endTime :: (UTCTime -> f UTCTime)
-> ListDetectMitigationActionsTasks
-> f ListDetectMitigationActionsTasks
listDetectMitigationActionsTasks_endTime = (ListDetectMitigationActionsTasks -> POSIX)
-> (ListDetectMitigationActionsTasks
    -> POSIX -> ListDetectMitigationActionsTasks)
-> Lens
     ListDetectMitigationActionsTasks
     ListDetectMitigationActionsTasks
     POSIX
     POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDetectMitigationActionsTasks' {POSIX
endTime :: POSIX
$sel:endTime:ListDetectMitigationActionsTasks' :: ListDetectMitigationActionsTasks -> POSIX
endTime} -> POSIX
endTime) (\s :: ListDetectMitigationActionsTasks
s@ListDetectMitigationActionsTasks' {} POSIX
a -> ListDetectMitigationActionsTasks
s {$sel:endTime:ListDetectMitigationActionsTasks' :: POSIX
endTime = POSIX
a} :: ListDetectMitigationActionsTasks) ((POSIX -> f POSIX)
 -> ListDetectMitigationActionsTasks
 -> f ListDetectMitigationActionsTasks)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> ListDetectMitigationActionsTasks
-> f ListDetectMitigationActionsTasks
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

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

instance
  Prelude.NFData
    ListDetectMitigationActionsTasks

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

instance Core.ToPath ListDetectMitigationActionsTasks where
  toPath :: ListDetectMitigationActionsTasks -> ByteString
toPath =
    ByteString -> ListDetectMitigationActionsTasks -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/detect/mitigationactions/tasks"

instance
  Core.ToQuery
    ListDetectMitigationActionsTasks
  where
  toQuery :: ListDetectMitigationActionsTasks -> QueryString
toQuery ListDetectMitigationActionsTasks' {Maybe Natural
Maybe Text
POSIX
endTime :: POSIX
startTime :: POSIX
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:endTime:ListDetectMitigationActionsTasks' :: ListDetectMitigationActionsTasks -> POSIX
$sel:startTime:ListDetectMitigationActionsTasks' :: ListDetectMitigationActionsTasks -> POSIX
$sel:maxResults:ListDetectMitigationActionsTasks' :: ListDetectMitigationActionsTasks -> Maybe Natural
$sel:nextToken:ListDetectMitigationActionsTasks' :: ListDetectMitigationActionsTasks -> 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
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults,
        ByteString
"startTime" ByteString -> POSIX -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: POSIX
startTime,
        ByteString
"endTime" ByteString -> POSIX -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: POSIX
endTime
      ]

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

-- |
-- Create a value of 'ListDetectMitigationActionsTasksResponse' 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:
--
-- 'tasks', 'listDetectMitigationActionsTasksResponse_tasks' - The collection of ML Detect mitigation tasks that matched the filter
-- criteria.
--
-- 'nextToken', 'listDetectMitigationActionsTasksResponse_nextToken' - A token that can be used to retrieve the next set of results, or @null@
-- if there are no additional results.
--
-- 'httpStatus', 'listDetectMitigationActionsTasksResponse_httpStatus' - The response's http status code.
newListDetectMitigationActionsTasksResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListDetectMitigationActionsTasksResponse
newListDetectMitigationActionsTasksResponse :: Int -> ListDetectMitigationActionsTasksResponse
newListDetectMitigationActionsTasksResponse
  Int
pHttpStatus_ =
    ListDetectMitigationActionsTasksResponse' :: Maybe [DetectMitigationActionsTaskSummary]
-> Maybe Text -> Int -> ListDetectMitigationActionsTasksResponse
ListDetectMitigationActionsTasksResponse'
      { $sel:tasks:ListDetectMitigationActionsTasksResponse' :: Maybe [DetectMitigationActionsTaskSummary]
tasks =
          Maybe [DetectMitigationActionsTaskSummary]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:ListDetectMitigationActionsTasksResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListDetectMitigationActionsTasksResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The collection of ML Detect mitigation tasks that matched the filter
-- criteria.
listDetectMitigationActionsTasksResponse_tasks :: Lens.Lens' ListDetectMitigationActionsTasksResponse (Prelude.Maybe [DetectMitigationActionsTaskSummary])
listDetectMitigationActionsTasksResponse_tasks :: (Maybe [DetectMitigationActionsTaskSummary]
 -> f (Maybe [DetectMitigationActionsTaskSummary]))
-> ListDetectMitigationActionsTasksResponse
-> f ListDetectMitigationActionsTasksResponse
listDetectMitigationActionsTasksResponse_tasks = (ListDetectMitigationActionsTasksResponse
 -> Maybe [DetectMitigationActionsTaskSummary])
-> (ListDetectMitigationActionsTasksResponse
    -> Maybe [DetectMitigationActionsTaskSummary]
    -> ListDetectMitigationActionsTasksResponse)
-> Lens'
     ListDetectMitigationActionsTasksResponse
     (Maybe [DetectMitigationActionsTaskSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDetectMitigationActionsTasksResponse' {Maybe [DetectMitigationActionsTaskSummary]
tasks :: Maybe [DetectMitigationActionsTaskSummary]
$sel:tasks:ListDetectMitigationActionsTasksResponse' :: ListDetectMitigationActionsTasksResponse
-> Maybe [DetectMitigationActionsTaskSummary]
tasks} -> Maybe [DetectMitigationActionsTaskSummary]
tasks) (\s :: ListDetectMitigationActionsTasksResponse
s@ListDetectMitigationActionsTasksResponse' {} Maybe [DetectMitigationActionsTaskSummary]
a -> ListDetectMitigationActionsTasksResponse
s {$sel:tasks:ListDetectMitigationActionsTasksResponse' :: Maybe [DetectMitigationActionsTaskSummary]
tasks = Maybe [DetectMitigationActionsTaskSummary]
a} :: ListDetectMitigationActionsTasksResponse) ((Maybe [DetectMitigationActionsTaskSummary]
  -> f (Maybe [DetectMitigationActionsTaskSummary]))
 -> ListDetectMitigationActionsTasksResponse
 -> f ListDetectMitigationActionsTasksResponse)
-> ((Maybe [DetectMitigationActionsTaskSummary]
     -> f (Maybe [DetectMitigationActionsTaskSummary]))
    -> Maybe [DetectMitigationActionsTaskSummary]
    -> f (Maybe [DetectMitigationActionsTaskSummary]))
-> (Maybe [DetectMitigationActionsTaskSummary]
    -> f (Maybe [DetectMitigationActionsTaskSummary]))
-> ListDetectMitigationActionsTasksResponse
-> f ListDetectMitigationActionsTasksResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DetectMitigationActionsTaskSummary]
  [DetectMitigationActionsTaskSummary]
  [DetectMitigationActionsTaskSummary]
  [DetectMitigationActionsTaskSummary]
-> Iso
     (Maybe [DetectMitigationActionsTaskSummary])
     (Maybe [DetectMitigationActionsTaskSummary])
     (Maybe [DetectMitigationActionsTaskSummary])
     (Maybe [DetectMitigationActionsTaskSummary])
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
  [DetectMitigationActionsTaskSummary]
  [DetectMitigationActionsTaskSummary]
  [DetectMitigationActionsTaskSummary]
  [DetectMitigationActionsTaskSummary]
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.
listDetectMitigationActionsTasksResponse_nextToken :: Lens.Lens' ListDetectMitigationActionsTasksResponse (Prelude.Maybe Prelude.Text)
listDetectMitigationActionsTasksResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListDetectMitigationActionsTasksResponse
-> f ListDetectMitigationActionsTasksResponse
listDetectMitigationActionsTasksResponse_nextToken = (ListDetectMitigationActionsTasksResponse -> Maybe Text)
-> (ListDetectMitigationActionsTasksResponse
    -> Maybe Text -> ListDetectMitigationActionsTasksResponse)
-> Lens' ListDetectMitigationActionsTasksResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDetectMitigationActionsTasksResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDetectMitigationActionsTasksResponse' :: ListDetectMitigationActionsTasksResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDetectMitigationActionsTasksResponse
s@ListDetectMitigationActionsTasksResponse' {} Maybe Text
a -> ListDetectMitigationActionsTasksResponse
s {$sel:nextToken:ListDetectMitigationActionsTasksResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListDetectMitigationActionsTasksResponse)

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

instance
  Prelude.NFData
    ListDetectMitigationActionsTasksResponse