{-# 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.DescribeDetectMitigationActionsTask
-- 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 information about a Device Defender ML Detect mitigation action.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions DescribeDetectMitigationActionsTask>
-- action.
module Amazonka.IoT.DescribeDetectMitigationActionsTask
  ( -- * Creating a Request
    DescribeDetectMitigationActionsTask (..),
    newDescribeDetectMitigationActionsTask,

    -- * Request Lenses
    describeDetectMitigationActionsTask_taskId,

    -- * Destructuring the Response
    DescribeDetectMitigationActionsTaskResponse (..),
    newDescribeDetectMitigationActionsTaskResponse,

    -- * Response Lenses
    describeDetectMitigationActionsTaskResponse_taskSummary,
    describeDetectMitigationActionsTaskResponse_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:/ 'newDescribeDetectMitigationActionsTask' smart constructor.
data DescribeDetectMitigationActionsTask = DescribeDetectMitigationActionsTask'
  { -- | The unique identifier of the task.
    DescribeDetectMitigationActionsTask -> Text
taskId :: Prelude.Text
  }
  deriving (DescribeDetectMitigationActionsTask
-> DescribeDetectMitigationActionsTask -> Bool
(DescribeDetectMitigationActionsTask
 -> DescribeDetectMitigationActionsTask -> Bool)
-> (DescribeDetectMitigationActionsTask
    -> DescribeDetectMitigationActionsTask -> Bool)
-> Eq DescribeDetectMitigationActionsTask
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDetectMitigationActionsTask
-> DescribeDetectMitigationActionsTask -> Bool
$c/= :: DescribeDetectMitigationActionsTask
-> DescribeDetectMitigationActionsTask -> Bool
== :: DescribeDetectMitigationActionsTask
-> DescribeDetectMitigationActionsTask -> Bool
$c== :: DescribeDetectMitigationActionsTask
-> DescribeDetectMitigationActionsTask -> Bool
Prelude.Eq, ReadPrec [DescribeDetectMitigationActionsTask]
ReadPrec DescribeDetectMitigationActionsTask
Int -> ReadS DescribeDetectMitigationActionsTask
ReadS [DescribeDetectMitigationActionsTask]
(Int -> ReadS DescribeDetectMitigationActionsTask)
-> ReadS [DescribeDetectMitigationActionsTask]
-> ReadPrec DescribeDetectMitigationActionsTask
-> ReadPrec [DescribeDetectMitigationActionsTask]
-> Read DescribeDetectMitigationActionsTask
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDetectMitigationActionsTask]
$creadListPrec :: ReadPrec [DescribeDetectMitigationActionsTask]
readPrec :: ReadPrec DescribeDetectMitigationActionsTask
$creadPrec :: ReadPrec DescribeDetectMitigationActionsTask
readList :: ReadS [DescribeDetectMitigationActionsTask]
$creadList :: ReadS [DescribeDetectMitigationActionsTask]
readsPrec :: Int -> ReadS DescribeDetectMitigationActionsTask
$creadsPrec :: Int -> ReadS DescribeDetectMitigationActionsTask
Prelude.Read, Int -> DescribeDetectMitigationActionsTask -> ShowS
[DescribeDetectMitigationActionsTask] -> ShowS
DescribeDetectMitigationActionsTask -> String
(Int -> DescribeDetectMitigationActionsTask -> ShowS)
-> (DescribeDetectMitigationActionsTask -> String)
-> ([DescribeDetectMitigationActionsTask] -> ShowS)
-> Show DescribeDetectMitigationActionsTask
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDetectMitigationActionsTask] -> ShowS
$cshowList :: [DescribeDetectMitigationActionsTask] -> ShowS
show :: DescribeDetectMitigationActionsTask -> String
$cshow :: DescribeDetectMitigationActionsTask -> String
showsPrec :: Int -> DescribeDetectMitigationActionsTask -> ShowS
$cshowsPrec :: Int -> DescribeDetectMitigationActionsTask -> ShowS
Prelude.Show, (forall x.
 DescribeDetectMitigationActionsTask
 -> Rep DescribeDetectMitigationActionsTask x)
-> (forall x.
    Rep DescribeDetectMitigationActionsTask x
    -> DescribeDetectMitigationActionsTask)
-> Generic DescribeDetectMitigationActionsTask
forall x.
Rep DescribeDetectMitigationActionsTask x
-> DescribeDetectMitigationActionsTask
forall x.
DescribeDetectMitigationActionsTask
-> Rep DescribeDetectMitigationActionsTask x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDetectMitigationActionsTask x
-> DescribeDetectMitigationActionsTask
$cfrom :: forall x.
DescribeDetectMitigationActionsTask
-> Rep DescribeDetectMitigationActionsTask x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDetectMitigationActionsTask' 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:
--
-- 'taskId', 'describeDetectMitigationActionsTask_taskId' - The unique identifier of the task.
newDescribeDetectMitigationActionsTask ::
  -- | 'taskId'
  Prelude.Text ->
  DescribeDetectMitigationActionsTask
newDescribeDetectMitigationActionsTask :: Text -> DescribeDetectMitigationActionsTask
newDescribeDetectMitigationActionsTask Text
pTaskId_ =
  DescribeDetectMitigationActionsTask' :: Text -> DescribeDetectMitigationActionsTask
DescribeDetectMitigationActionsTask'
    { $sel:taskId:DescribeDetectMitigationActionsTask' :: Text
taskId =
        Text
pTaskId_
    }

-- | The unique identifier of the task.
describeDetectMitigationActionsTask_taskId :: Lens.Lens' DescribeDetectMitigationActionsTask Prelude.Text
describeDetectMitigationActionsTask_taskId :: (Text -> f Text)
-> DescribeDetectMitigationActionsTask
-> f DescribeDetectMitigationActionsTask
describeDetectMitigationActionsTask_taskId = (DescribeDetectMitigationActionsTask -> Text)
-> (DescribeDetectMitigationActionsTask
    -> Text -> DescribeDetectMitigationActionsTask)
-> Lens
     DescribeDetectMitigationActionsTask
     DescribeDetectMitigationActionsTask
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDetectMitigationActionsTask' {Text
taskId :: Text
$sel:taskId:DescribeDetectMitigationActionsTask' :: DescribeDetectMitigationActionsTask -> Text
taskId} -> Text
taskId) (\s :: DescribeDetectMitigationActionsTask
s@DescribeDetectMitigationActionsTask' {} Text
a -> DescribeDetectMitigationActionsTask
s {$sel:taskId:DescribeDetectMitigationActionsTask' :: Text
taskId = Text
a} :: DescribeDetectMitigationActionsTask)

instance
  Core.AWSRequest
    DescribeDetectMitigationActionsTask
  where
  type
    AWSResponse DescribeDetectMitigationActionsTask =
      DescribeDetectMitigationActionsTaskResponse
  request :: DescribeDetectMitigationActionsTask
-> Request DescribeDetectMitigationActionsTask
request = Service
-> DescribeDetectMitigationActionsTask
-> Request DescribeDetectMitigationActionsTask
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeDetectMitigationActionsTask
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeDetectMitigationActionsTask)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeDetectMitigationActionsTask))
-> Logger
-> Service
-> Proxy DescribeDetectMitigationActionsTask
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeDetectMitigationActionsTask)))
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
-> Int -> DescribeDetectMitigationActionsTaskResponse
DescribeDetectMitigationActionsTaskResponse'
            (Maybe DetectMitigationActionsTaskSummary
 -> Int -> DescribeDetectMitigationActionsTaskResponse)
-> Either String (Maybe DetectMitigationActionsTaskSummary)
-> Either
     String (Int -> DescribeDetectMitigationActionsTaskResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Either String (Maybe DetectMitigationActionsTaskSummary)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"taskSummary")
              Either String (Int -> DescribeDetectMitigationActionsTaskResponse)
-> Either String Int
-> Either String DescribeDetectMitigationActionsTaskResponse
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
    DescribeDetectMitigationActionsTask

instance
  Prelude.NFData
    DescribeDetectMitigationActionsTask

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

instance
  Core.ToPath
    DescribeDetectMitigationActionsTask
  where
  toPath :: DescribeDetectMitigationActionsTask -> ByteString
toPath DescribeDetectMitigationActionsTask' {Text
taskId :: Text
$sel:taskId:DescribeDetectMitigationActionsTask' :: DescribeDetectMitigationActionsTask -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/detect/mitigationactions/tasks/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
taskId
      ]

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

-- | /See:/ 'newDescribeDetectMitigationActionsTaskResponse' smart constructor.
data DescribeDetectMitigationActionsTaskResponse = DescribeDetectMitigationActionsTaskResponse'
  { -- | The description of a task.
    DescribeDetectMitigationActionsTaskResponse
-> Maybe DetectMitigationActionsTaskSummary
taskSummary :: Prelude.Maybe DetectMitigationActionsTaskSummary,
    -- | The response's http status code.
    DescribeDetectMitigationActionsTaskResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeDetectMitigationActionsTaskResponse
-> DescribeDetectMitigationActionsTaskResponse -> Bool
(DescribeDetectMitigationActionsTaskResponse
 -> DescribeDetectMitigationActionsTaskResponse -> Bool)
-> (DescribeDetectMitigationActionsTaskResponse
    -> DescribeDetectMitigationActionsTaskResponse -> Bool)
-> Eq DescribeDetectMitigationActionsTaskResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDetectMitigationActionsTaskResponse
-> DescribeDetectMitigationActionsTaskResponse -> Bool
$c/= :: DescribeDetectMitigationActionsTaskResponse
-> DescribeDetectMitigationActionsTaskResponse -> Bool
== :: DescribeDetectMitigationActionsTaskResponse
-> DescribeDetectMitigationActionsTaskResponse -> Bool
$c== :: DescribeDetectMitigationActionsTaskResponse
-> DescribeDetectMitigationActionsTaskResponse -> Bool
Prelude.Eq, ReadPrec [DescribeDetectMitigationActionsTaskResponse]
ReadPrec DescribeDetectMitigationActionsTaskResponse
Int -> ReadS DescribeDetectMitigationActionsTaskResponse
ReadS [DescribeDetectMitigationActionsTaskResponse]
(Int -> ReadS DescribeDetectMitigationActionsTaskResponse)
-> ReadS [DescribeDetectMitigationActionsTaskResponse]
-> ReadPrec DescribeDetectMitigationActionsTaskResponse
-> ReadPrec [DescribeDetectMitigationActionsTaskResponse]
-> Read DescribeDetectMitigationActionsTaskResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDetectMitigationActionsTaskResponse]
$creadListPrec :: ReadPrec [DescribeDetectMitigationActionsTaskResponse]
readPrec :: ReadPrec DescribeDetectMitigationActionsTaskResponse
$creadPrec :: ReadPrec DescribeDetectMitigationActionsTaskResponse
readList :: ReadS [DescribeDetectMitigationActionsTaskResponse]
$creadList :: ReadS [DescribeDetectMitigationActionsTaskResponse]
readsPrec :: Int -> ReadS DescribeDetectMitigationActionsTaskResponse
$creadsPrec :: Int -> ReadS DescribeDetectMitigationActionsTaskResponse
Prelude.Read, Int -> DescribeDetectMitigationActionsTaskResponse -> ShowS
[DescribeDetectMitigationActionsTaskResponse] -> ShowS
DescribeDetectMitigationActionsTaskResponse -> String
(Int -> DescribeDetectMitigationActionsTaskResponse -> ShowS)
-> (DescribeDetectMitigationActionsTaskResponse -> String)
-> ([DescribeDetectMitigationActionsTaskResponse] -> ShowS)
-> Show DescribeDetectMitigationActionsTaskResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDetectMitigationActionsTaskResponse] -> ShowS
$cshowList :: [DescribeDetectMitigationActionsTaskResponse] -> ShowS
show :: DescribeDetectMitigationActionsTaskResponse -> String
$cshow :: DescribeDetectMitigationActionsTaskResponse -> String
showsPrec :: Int -> DescribeDetectMitigationActionsTaskResponse -> ShowS
$cshowsPrec :: Int -> DescribeDetectMitigationActionsTaskResponse -> ShowS
Prelude.Show, (forall x.
 DescribeDetectMitigationActionsTaskResponse
 -> Rep DescribeDetectMitigationActionsTaskResponse x)
-> (forall x.
    Rep DescribeDetectMitigationActionsTaskResponse x
    -> DescribeDetectMitigationActionsTaskResponse)
-> Generic DescribeDetectMitigationActionsTaskResponse
forall x.
Rep DescribeDetectMitigationActionsTaskResponse x
-> DescribeDetectMitigationActionsTaskResponse
forall x.
DescribeDetectMitigationActionsTaskResponse
-> Rep DescribeDetectMitigationActionsTaskResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDetectMitigationActionsTaskResponse x
-> DescribeDetectMitigationActionsTaskResponse
$cfrom :: forall x.
DescribeDetectMitigationActionsTaskResponse
-> Rep DescribeDetectMitigationActionsTaskResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDetectMitigationActionsTaskResponse' 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:
--
-- 'taskSummary', 'describeDetectMitigationActionsTaskResponse_taskSummary' - The description of a task.
--
-- 'httpStatus', 'describeDetectMitigationActionsTaskResponse_httpStatus' - The response's http status code.
newDescribeDetectMitigationActionsTaskResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeDetectMitigationActionsTaskResponse
newDescribeDetectMitigationActionsTaskResponse :: Int -> DescribeDetectMitigationActionsTaskResponse
newDescribeDetectMitigationActionsTaskResponse
  Int
pHttpStatus_ =
    DescribeDetectMitigationActionsTaskResponse' :: Maybe DetectMitigationActionsTaskSummary
-> Int -> DescribeDetectMitigationActionsTaskResponse
DescribeDetectMitigationActionsTaskResponse'
      { $sel:taskSummary:DescribeDetectMitigationActionsTaskResponse' :: Maybe DetectMitigationActionsTaskSummary
taskSummary =
          Maybe DetectMitigationActionsTaskSummary
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeDetectMitigationActionsTaskResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The description of a task.
describeDetectMitigationActionsTaskResponse_taskSummary :: Lens.Lens' DescribeDetectMitigationActionsTaskResponse (Prelude.Maybe DetectMitigationActionsTaskSummary)
describeDetectMitigationActionsTaskResponse_taskSummary :: (Maybe DetectMitigationActionsTaskSummary
 -> f (Maybe DetectMitigationActionsTaskSummary))
-> DescribeDetectMitigationActionsTaskResponse
-> f DescribeDetectMitigationActionsTaskResponse
describeDetectMitigationActionsTaskResponse_taskSummary = (DescribeDetectMitigationActionsTaskResponse
 -> Maybe DetectMitigationActionsTaskSummary)
-> (DescribeDetectMitigationActionsTaskResponse
    -> Maybe DetectMitigationActionsTaskSummary
    -> DescribeDetectMitigationActionsTaskResponse)
-> Lens
     DescribeDetectMitigationActionsTaskResponse
     DescribeDetectMitigationActionsTaskResponse
     (Maybe DetectMitigationActionsTaskSummary)
     (Maybe DetectMitigationActionsTaskSummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDetectMitigationActionsTaskResponse' {Maybe DetectMitigationActionsTaskSummary
taskSummary :: Maybe DetectMitigationActionsTaskSummary
$sel:taskSummary:DescribeDetectMitigationActionsTaskResponse' :: DescribeDetectMitigationActionsTaskResponse
-> Maybe DetectMitigationActionsTaskSummary
taskSummary} -> Maybe DetectMitigationActionsTaskSummary
taskSummary) (\s :: DescribeDetectMitigationActionsTaskResponse
s@DescribeDetectMitigationActionsTaskResponse' {} Maybe DetectMitigationActionsTaskSummary
a -> DescribeDetectMitigationActionsTaskResponse
s {$sel:taskSummary:DescribeDetectMitigationActionsTaskResponse' :: Maybe DetectMitigationActionsTaskSummary
taskSummary = Maybe DetectMitigationActionsTaskSummary
a} :: DescribeDetectMitigationActionsTaskResponse)

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

instance
  Prelude.NFData
    DescribeDetectMitigationActionsTaskResponse