{-# 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.GuardDuty.DeletePublishingDestination
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes the publishing definition with the specified @destinationId@.
module Amazonka.GuardDuty.DeletePublishingDestination
  ( -- * Creating a Request
    DeletePublishingDestination (..),
    newDeletePublishingDestination,

    -- * Request Lenses
    deletePublishingDestination_detectorId,
    deletePublishingDestination_destinationId,

    -- * Destructuring the Response
    DeletePublishingDestinationResponse (..),
    newDeletePublishingDestinationResponse,

    -- * Response Lenses
    deletePublishingDestinationResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GuardDuty.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeletePublishingDestination' smart constructor.
data DeletePublishingDestination = DeletePublishingDestination'
  { -- | The unique ID of the detector associated with the publishing destination
    -- to delete.
    DeletePublishingDestination -> Text
detectorId :: Prelude.Text,
    -- | The ID of the publishing destination to delete.
    DeletePublishingDestination -> Text
destinationId :: Prelude.Text
  }
  deriving (DeletePublishingDestination -> DeletePublishingDestination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletePublishingDestination -> DeletePublishingDestination -> Bool
$c/= :: DeletePublishingDestination -> DeletePublishingDestination -> Bool
== :: DeletePublishingDestination -> DeletePublishingDestination -> Bool
$c== :: DeletePublishingDestination -> DeletePublishingDestination -> Bool
Prelude.Eq, ReadPrec [DeletePublishingDestination]
ReadPrec DeletePublishingDestination
Int -> ReadS DeletePublishingDestination
ReadS [DeletePublishingDestination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletePublishingDestination]
$creadListPrec :: ReadPrec [DeletePublishingDestination]
readPrec :: ReadPrec DeletePublishingDestination
$creadPrec :: ReadPrec DeletePublishingDestination
readList :: ReadS [DeletePublishingDestination]
$creadList :: ReadS [DeletePublishingDestination]
readsPrec :: Int -> ReadS DeletePublishingDestination
$creadsPrec :: Int -> ReadS DeletePublishingDestination
Prelude.Read, Int -> DeletePublishingDestination -> ShowS
[DeletePublishingDestination] -> ShowS
DeletePublishingDestination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletePublishingDestination] -> ShowS
$cshowList :: [DeletePublishingDestination] -> ShowS
show :: DeletePublishingDestination -> String
$cshow :: DeletePublishingDestination -> String
showsPrec :: Int -> DeletePublishingDestination -> ShowS
$cshowsPrec :: Int -> DeletePublishingDestination -> ShowS
Prelude.Show, forall x.
Rep DeletePublishingDestination x -> DeletePublishingDestination
forall x.
DeletePublishingDestination -> Rep DeletePublishingDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeletePublishingDestination x -> DeletePublishingDestination
$cfrom :: forall x.
DeletePublishingDestination -> Rep DeletePublishingDestination x
Prelude.Generic)

-- |
-- Create a value of 'DeletePublishingDestination' 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:
--
-- 'detectorId', 'deletePublishingDestination_detectorId' - The unique ID of the detector associated with the publishing destination
-- to delete.
--
-- 'destinationId', 'deletePublishingDestination_destinationId' - The ID of the publishing destination to delete.
newDeletePublishingDestination ::
  -- | 'detectorId'
  Prelude.Text ->
  -- | 'destinationId'
  Prelude.Text ->
  DeletePublishingDestination
newDeletePublishingDestination :: Text -> Text -> DeletePublishingDestination
newDeletePublishingDestination
  Text
pDetectorId_
  Text
pDestinationId_ =
    DeletePublishingDestination'
      { $sel:detectorId:DeletePublishingDestination' :: Text
detectorId =
          Text
pDetectorId_,
        $sel:destinationId:DeletePublishingDestination' :: Text
destinationId = Text
pDestinationId_
      }

-- | The unique ID of the detector associated with the publishing destination
-- to delete.
deletePublishingDestination_detectorId :: Lens.Lens' DeletePublishingDestination Prelude.Text
deletePublishingDestination_detectorId :: Lens' DeletePublishingDestination Text
deletePublishingDestination_detectorId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePublishingDestination' {Text
detectorId :: Text
$sel:detectorId:DeletePublishingDestination' :: DeletePublishingDestination -> Text
detectorId} -> Text
detectorId) (\s :: DeletePublishingDestination
s@DeletePublishingDestination' {} Text
a -> DeletePublishingDestination
s {$sel:detectorId:DeletePublishingDestination' :: Text
detectorId = Text
a} :: DeletePublishingDestination)

-- | The ID of the publishing destination to delete.
deletePublishingDestination_destinationId :: Lens.Lens' DeletePublishingDestination Prelude.Text
deletePublishingDestination_destinationId :: Lens' DeletePublishingDestination Text
deletePublishingDestination_destinationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePublishingDestination' {Text
destinationId :: Text
$sel:destinationId:DeletePublishingDestination' :: DeletePublishingDestination -> Text
destinationId} -> Text
destinationId) (\s :: DeletePublishingDestination
s@DeletePublishingDestination' {} Text
a -> DeletePublishingDestination
s {$sel:destinationId:DeletePublishingDestination' :: Text
destinationId = Text
a} :: DeletePublishingDestination)

instance Core.AWSRequest DeletePublishingDestination where
  type
    AWSResponse DeletePublishingDestination =
      DeletePublishingDestinationResponse
  request :: (Service -> Service)
-> DeletePublishingDestination
-> Request DeletePublishingDestination
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeletePublishingDestination
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePublishingDestination)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeletePublishingDestinationResponse
DeletePublishingDestinationResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeletePublishingDestination where
  hashWithSalt :: Int -> DeletePublishingDestination -> Int
hashWithSalt Int
_salt DeletePublishingDestination' {Text
destinationId :: Text
detectorId :: Text
$sel:destinationId:DeletePublishingDestination' :: DeletePublishingDestination -> Text
$sel:detectorId:DeletePublishingDestination' :: DeletePublishingDestination -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
detectorId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
destinationId

instance Prelude.NFData DeletePublishingDestination where
  rnf :: DeletePublishingDestination -> ()
rnf DeletePublishingDestination' {Text
destinationId :: Text
detectorId :: Text
$sel:destinationId:DeletePublishingDestination' :: DeletePublishingDestination -> Text
$sel:detectorId:DeletePublishingDestination' :: DeletePublishingDestination -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
detectorId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
destinationId

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

instance Data.ToPath DeletePublishingDestination where
  toPath :: DeletePublishingDestination -> ByteString
toPath DeletePublishingDestination' {Text
destinationId :: Text
detectorId :: Text
$sel:destinationId:DeletePublishingDestination' :: DeletePublishingDestination -> Text
$sel:detectorId:DeletePublishingDestination' :: DeletePublishingDestination -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/detector/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
detectorId,
        ByteString
"/publishingDestination/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
destinationId
      ]

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

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

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

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

instance
  Prelude.NFData
    DeletePublishingDestinationResponse
  where
  rnf :: DeletePublishingDestinationResponse -> ()
rnf DeletePublishingDestinationResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeletePublishingDestinationResponse' :: DeletePublishingDestinationResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus