{-# 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.SecurityHub.DeleteActionTarget
-- 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 custom action target from Security Hub.
--
-- Deleting a custom action target does not affect any findings or insights
-- that were already sent to Amazon CloudWatch Events using the custom
-- action.
module Amazonka.SecurityHub.DeleteActionTarget
  ( -- * Creating a Request
    DeleteActionTarget (..),
    newDeleteActionTarget,

    -- * Request Lenses
    deleteActionTarget_actionTargetArn,

    -- * Destructuring the Response
    DeleteActionTargetResponse (..),
    newDeleteActionTargetResponse,

    -- * Response Lenses
    deleteActionTargetResponse_httpStatus,
    deleteActionTargetResponse_actionTargetArn,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SecurityHub.Types

-- | /See:/ 'newDeleteActionTarget' smart constructor.
data DeleteActionTarget = DeleteActionTarget'
  { -- | The ARN of the custom action target to delete.
    DeleteActionTarget -> Text
actionTargetArn :: Prelude.Text
  }
  deriving (DeleteActionTarget -> DeleteActionTarget -> Bool
(DeleteActionTarget -> DeleteActionTarget -> Bool)
-> (DeleteActionTarget -> DeleteActionTarget -> Bool)
-> Eq DeleteActionTarget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteActionTarget -> DeleteActionTarget -> Bool
$c/= :: DeleteActionTarget -> DeleteActionTarget -> Bool
== :: DeleteActionTarget -> DeleteActionTarget -> Bool
$c== :: DeleteActionTarget -> DeleteActionTarget -> Bool
Prelude.Eq, ReadPrec [DeleteActionTarget]
ReadPrec DeleteActionTarget
Int -> ReadS DeleteActionTarget
ReadS [DeleteActionTarget]
(Int -> ReadS DeleteActionTarget)
-> ReadS [DeleteActionTarget]
-> ReadPrec DeleteActionTarget
-> ReadPrec [DeleteActionTarget]
-> Read DeleteActionTarget
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteActionTarget]
$creadListPrec :: ReadPrec [DeleteActionTarget]
readPrec :: ReadPrec DeleteActionTarget
$creadPrec :: ReadPrec DeleteActionTarget
readList :: ReadS [DeleteActionTarget]
$creadList :: ReadS [DeleteActionTarget]
readsPrec :: Int -> ReadS DeleteActionTarget
$creadsPrec :: Int -> ReadS DeleteActionTarget
Prelude.Read, Int -> DeleteActionTarget -> ShowS
[DeleteActionTarget] -> ShowS
DeleteActionTarget -> String
(Int -> DeleteActionTarget -> ShowS)
-> (DeleteActionTarget -> String)
-> ([DeleteActionTarget] -> ShowS)
-> Show DeleteActionTarget
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteActionTarget] -> ShowS
$cshowList :: [DeleteActionTarget] -> ShowS
show :: DeleteActionTarget -> String
$cshow :: DeleteActionTarget -> String
showsPrec :: Int -> DeleteActionTarget -> ShowS
$cshowsPrec :: Int -> DeleteActionTarget -> ShowS
Prelude.Show, (forall x. DeleteActionTarget -> Rep DeleteActionTarget x)
-> (forall x. Rep DeleteActionTarget x -> DeleteActionTarget)
-> Generic DeleteActionTarget
forall x. Rep DeleteActionTarget x -> DeleteActionTarget
forall x. DeleteActionTarget -> Rep DeleteActionTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteActionTarget x -> DeleteActionTarget
$cfrom :: forall x. DeleteActionTarget -> Rep DeleteActionTarget x
Prelude.Generic)

-- |
-- Create a value of 'DeleteActionTarget' 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:
--
-- 'actionTargetArn', 'deleteActionTarget_actionTargetArn' - The ARN of the custom action target to delete.
newDeleteActionTarget ::
  -- | 'actionTargetArn'
  Prelude.Text ->
  DeleteActionTarget
newDeleteActionTarget :: Text -> DeleteActionTarget
newDeleteActionTarget Text
pActionTargetArn_ =
  DeleteActionTarget' :: Text -> DeleteActionTarget
DeleteActionTarget'
    { $sel:actionTargetArn:DeleteActionTarget' :: Text
actionTargetArn =
        Text
pActionTargetArn_
    }

-- | The ARN of the custom action target to delete.
deleteActionTarget_actionTargetArn :: Lens.Lens' DeleteActionTarget Prelude.Text
deleteActionTarget_actionTargetArn :: (Text -> f Text) -> DeleteActionTarget -> f DeleteActionTarget
deleteActionTarget_actionTargetArn = (DeleteActionTarget -> Text)
-> (DeleteActionTarget -> Text -> DeleteActionTarget)
-> Lens DeleteActionTarget DeleteActionTarget Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteActionTarget' {Text
actionTargetArn :: Text
$sel:actionTargetArn:DeleteActionTarget' :: DeleteActionTarget -> Text
actionTargetArn} -> Text
actionTargetArn) (\s :: DeleteActionTarget
s@DeleteActionTarget' {} Text
a -> DeleteActionTarget
s {$sel:actionTargetArn:DeleteActionTarget' :: Text
actionTargetArn = Text
a} :: DeleteActionTarget)

instance Core.AWSRequest DeleteActionTarget where
  type
    AWSResponse DeleteActionTarget =
      DeleteActionTargetResponse
  request :: DeleteActionTarget -> Request DeleteActionTarget
request = Service -> DeleteActionTarget -> Request DeleteActionTarget
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteActionTarget
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteActionTarget)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteActionTarget))
-> Logger
-> Service
-> Proxy DeleteActionTarget
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteActionTarget)))
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 ->
          Int -> Text -> DeleteActionTargetResponse
DeleteActionTargetResponse'
            (Int -> Text -> DeleteActionTargetResponse)
-> Either String Int
-> Either String (Text -> DeleteActionTargetResponse)
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))
            Either String (Text -> DeleteActionTargetResponse)
-> Either String Text -> Either String DeleteActionTargetResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"ActionTargetArn")
      )

instance Prelude.Hashable DeleteActionTarget

instance Prelude.NFData DeleteActionTarget

instance Core.ToHeaders DeleteActionTarget where
  toHeaders :: DeleteActionTarget -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteActionTarget -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

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

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

-- |
-- Create a value of 'DeleteActionTargetResponse' 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', 'deleteActionTargetResponse_httpStatus' - The response's http status code.
--
-- 'actionTargetArn', 'deleteActionTargetResponse_actionTargetArn' - The ARN of the custom action target that was deleted.
newDeleteActionTargetResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'actionTargetArn'
  Prelude.Text ->
  DeleteActionTargetResponse
newDeleteActionTargetResponse :: Int -> Text -> DeleteActionTargetResponse
newDeleteActionTargetResponse
  Int
pHttpStatus_
  Text
pActionTargetArn_ =
    DeleteActionTargetResponse' :: Int -> Text -> DeleteActionTargetResponse
DeleteActionTargetResponse'
      { $sel:httpStatus:DeleteActionTargetResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:actionTargetArn:DeleteActionTargetResponse' :: Text
actionTargetArn = Text
pActionTargetArn_
      }

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

-- | The ARN of the custom action target that was deleted.
deleteActionTargetResponse_actionTargetArn :: Lens.Lens' DeleteActionTargetResponse Prelude.Text
deleteActionTargetResponse_actionTargetArn :: (Text -> f Text)
-> DeleteActionTargetResponse -> f DeleteActionTargetResponse
deleteActionTargetResponse_actionTargetArn = (DeleteActionTargetResponse -> Text)
-> (DeleteActionTargetResponse
    -> Text -> DeleteActionTargetResponse)
-> Lens
     DeleteActionTargetResponse DeleteActionTargetResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteActionTargetResponse' {Text
actionTargetArn :: Text
$sel:actionTargetArn:DeleteActionTargetResponse' :: DeleteActionTargetResponse -> Text
actionTargetArn} -> Text
actionTargetArn) (\s :: DeleteActionTargetResponse
s@DeleteActionTargetResponse' {} Text
a -> DeleteActionTargetResponse
s {$sel:actionTargetArn:DeleteActionTargetResponse' :: Text
actionTargetArn = Text
a} :: DeleteActionTargetResponse)

instance Prelude.NFData DeleteActionTargetResponse