{-# 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.DeleteMitigationAction
-- 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)
--
-- Deletes a defined mitigation action from your Amazon Web Services
-- accounts.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions DeleteMitigationAction>
-- action.
module Amazonka.IoT.DeleteMitigationAction
  ( -- * Creating a Request
    DeleteMitigationAction (..),
    newDeleteMitigationAction,

    -- * Request Lenses
    deleteMitigationAction_actionName,

    -- * Destructuring the Response
    DeleteMitigationActionResponse (..),
    newDeleteMitigationActionResponse,

    -- * Response Lenses
    deleteMitigationActionResponse_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:/ 'newDeleteMitigationAction' smart constructor.
data DeleteMitigationAction = DeleteMitigationAction'
  { -- | The name of the mitigation action that you want to delete.
    DeleteMitigationAction -> Text
actionName :: Prelude.Text
  }
  deriving (DeleteMitigationAction -> DeleteMitigationAction -> Bool
(DeleteMitigationAction -> DeleteMitigationAction -> Bool)
-> (DeleteMitigationAction -> DeleteMitigationAction -> Bool)
-> Eq DeleteMitigationAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteMitigationAction -> DeleteMitigationAction -> Bool
$c/= :: DeleteMitigationAction -> DeleteMitigationAction -> Bool
== :: DeleteMitigationAction -> DeleteMitigationAction -> Bool
$c== :: DeleteMitigationAction -> DeleteMitigationAction -> Bool
Prelude.Eq, ReadPrec [DeleteMitigationAction]
ReadPrec DeleteMitigationAction
Int -> ReadS DeleteMitigationAction
ReadS [DeleteMitigationAction]
(Int -> ReadS DeleteMitigationAction)
-> ReadS [DeleteMitigationAction]
-> ReadPrec DeleteMitigationAction
-> ReadPrec [DeleteMitigationAction]
-> Read DeleteMitigationAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteMitigationAction]
$creadListPrec :: ReadPrec [DeleteMitigationAction]
readPrec :: ReadPrec DeleteMitigationAction
$creadPrec :: ReadPrec DeleteMitigationAction
readList :: ReadS [DeleteMitigationAction]
$creadList :: ReadS [DeleteMitigationAction]
readsPrec :: Int -> ReadS DeleteMitigationAction
$creadsPrec :: Int -> ReadS DeleteMitigationAction
Prelude.Read, Int -> DeleteMitigationAction -> ShowS
[DeleteMitigationAction] -> ShowS
DeleteMitigationAction -> String
(Int -> DeleteMitigationAction -> ShowS)
-> (DeleteMitigationAction -> String)
-> ([DeleteMitigationAction] -> ShowS)
-> Show DeleteMitigationAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteMitigationAction] -> ShowS
$cshowList :: [DeleteMitigationAction] -> ShowS
show :: DeleteMitigationAction -> String
$cshow :: DeleteMitigationAction -> String
showsPrec :: Int -> DeleteMitigationAction -> ShowS
$cshowsPrec :: Int -> DeleteMitigationAction -> ShowS
Prelude.Show, (forall x. DeleteMitigationAction -> Rep DeleteMitigationAction x)
-> (forall x.
    Rep DeleteMitigationAction x -> DeleteMitigationAction)
-> Generic DeleteMitigationAction
forall x. Rep DeleteMitigationAction x -> DeleteMitigationAction
forall x. DeleteMitigationAction -> Rep DeleteMitigationAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteMitigationAction x -> DeleteMitigationAction
$cfrom :: forall x. DeleteMitigationAction -> Rep DeleteMitigationAction x
Prelude.Generic)

-- |
-- Create a value of 'DeleteMitigationAction' 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:
--
-- 'actionName', 'deleteMitigationAction_actionName' - The name of the mitigation action that you want to delete.
newDeleteMitigationAction ::
  -- | 'actionName'
  Prelude.Text ->
  DeleteMitigationAction
newDeleteMitigationAction :: Text -> DeleteMitigationAction
newDeleteMitigationAction Text
pActionName_ =
  DeleteMitigationAction' :: Text -> DeleteMitigationAction
DeleteMitigationAction' {$sel:actionName:DeleteMitigationAction' :: Text
actionName = Text
pActionName_}

-- | The name of the mitigation action that you want to delete.
deleteMitigationAction_actionName :: Lens.Lens' DeleteMitigationAction Prelude.Text
deleteMitigationAction_actionName :: (Text -> f Text)
-> DeleteMitigationAction -> f DeleteMitigationAction
deleteMitigationAction_actionName = (DeleteMitigationAction -> Text)
-> (DeleteMitigationAction -> Text -> DeleteMitigationAction)
-> Lens DeleteMitigationAction DeleteMitigationAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMitigationAction' {Text
actionName :: Text
$sel:actionName:DeleteMitigationAction' :: DeleteMitigationAction -> Text
actionName} -> Text
actionName) (\s :: DeleteMitigationAction
s@DeleteMitigationAction' {} Text
a -> DeleteMitigationAction
s {$sel:actionName:DeleteMitigationAction' :: Text
actionName = Text
a} :: DeleteMitigationAction)

instance Core.AWSRequest DeleteMitigationAction where
  type
    AWSResponse DeleteMitigationAction =
      DeleteMitigationActionResponse
  request :: DeleteMitigationAction -> Request DeleteMitigationAction
request = Service -> DeleteMitigationAction -> Request DeleteMitigationAction
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteMitigationAction
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteMitigationAction)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteMitigationAction))
-> Logger
-> Service
-> Proxy DeleteMitigationAction
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteMitigationAction)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteMitigationActionResponse
DeleteMitigationActionResponse'
            (Int -> DeleteMitigationActionResponse)
-> Either String Int
-> Either String DeleteMitigationActionResponse
forall (f :: * -> *) a b. Functor 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 DeleteMitigationAction

instance Prelude.NFData DeleteMitigationAction

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

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

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

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

-- |
-- Create a value of 'DeleteMitigationActionResponse' 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:
--
-- 'httpStatus', 'deleteMitigationActionResponse_httpStatus' - The response's http status code.
newDeleteMitigationActionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteMitigationActionResponse
newDeleteMitigationActionResponse :: Int -> DeleteMitigationActionResponse
newDeleteMitigationActionResponse Int
pHttpStatus_ =
  DeleteMitigationActionResponse' :: Int -> DeleteMitigationActionResponse
DeleteMitigationActionResponse'
    { $sel:httpStatus:DeleteMitigationActionResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance
  Prelude.NFData
    DeleteMitigationActionResponse