{-# 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-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 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 Amazonka.GuardDuty.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:/ '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
(DeletePublishingDestination
 -> DeletePublishingDestination -> Bool)
-> (DeletePublishingDestination
    -> DeletePublishingDestination -> Bool)
-> Eq DeletePublishingDestination
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]
(Int -> ReadS DeletePublishingDestination)
-> ReadS [DeletePublishingDestination]
-> ReadPrec DeletePublishingDestination
-> ReadPrec [DeletePublishingDestination]
-> Read 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
(Int -> DeletePublishingDestination -> ShowS)
-> (DeletePublishingDestination -> String)
-> ([DeletePublishingDestination] -> ShowS)
-> Show DeletePublishingDestination
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.
 DeletePublishingDestination -> Rep DeletePublishingDestination x)
-> (forall x.
    Rep DeletePublishingDestination x -> DeletePublishingDestination)
-> Generic DeletePublishingDestination
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' :: Text -> Text -> DeletePublishingDestination
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 :: (Text -> f Text)
-> DeletePublishingDestination -> f DeletePublishingDestination
deletePublishingDestination_detectorId = (DeletePublishingDestination -> Text)
-> (DeletePublishingDestination
    -> Text -> DeletePublishingDestination)
-> Lens
     DeletePublishingDestination DeletePublishingDestination Text Text
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 :: (Text -> f Text)
-> DeletePublishingDestination -> f DeletePublishingDestination
deletePublishingDestination_destinationId = (DeletePublishingDestination -> Text)
-> (DeletePublishingDestination
    -> Text -> DeletePublishingDestination)
-> Lens
     DeletePublishingDestination DeletePublishingDestination Text Text
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 :: DeletePublishingDestination -> Request DeletePublishingDestination
request = Service
-> DeletePublishingDestination
-> Request DeletePublishingDestination
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeletePublishingDestination
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePublishingDestination)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeletePublishingDestination))
-> Logger
-> Service
-> Proxy DeletePublishingDestination
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePublishingDestination)))
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 -> DeletePublishingDestinationResponse
DeletePublishingDestinationResponse'
            (Int -> DeletePublishingDestinationResponse)
-> Either String Int
-> Either String DeletePublishingDestinationResponse
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 DeletePublishingDestination

instance Prelude.NFData DeletePublishingDestination

instance Core.ToHeaders DeletePublishingDestination where
  toHeaders :: DeletePublishingDestination -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeletePublishingDestination -> 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 DeletePublishingDestination where
  toPath :: DeletePublishingDestination -> ByteString
toPath DeletePublishingDestination' {Text
destinationId :: Text
detectorId :: Text
$sel:destinationId:DeletePublishingDestination' :: DeletePublishingDestination -> Text
$sel:detectorId:DeletePublishingDestination' :: DeletePublishingDestination -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/detector/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
detectorId,
        ByteString
"/publishingDestination/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
destinationId
      ]

instance Core.ToQuery DeletePublishingDestination where
  toQuery :: DeletePublishingDestination -> QueryString
toQuery = QueryString -> DeletePublishingDestination -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeletePublishingDestinationResponse
 -> DeletePublishingDestinationResponse -> Bool)
-> (DeletePublishingDestinationResponse
    -> DeletePublishingDestinationResponse -> Bool)
-> Eq DeletePublishingDestinationResponse
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]
(Int -> ReadS DeletePublishingDestinationResponse)
-> ReadS [DeletePublishingDestinationResponse]
-> ReadPrec DeletePublishingDestinationResponse
-> ReadPrec [DeletePublishingDestinationResponse]
-> Read 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
(Int -> DeletePublishingDestinationResponse -> ShowS)
-> (DeletePublishingDestinationResponse -> String)
-> ([DeletePublishingDestinationResponse] -> ShowS)
-> Show DeletePublishingDestinationResponse
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.
 DeletePublishingDestinationResponse
 -> Rep DeletePublishingDestinationResponse x)
-> (forall x.
    Rep DeletePublishingDestinationResponse x
    -> DeletePublishingDestinationResponse)
-> Generic DeletePublishingDestinationResponse
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' :: Int -> DeletePublishingDestinationResponse
DeletePublishingDestinationResponse'
    { $sel:httpStatus:DeletePublishingDestinationResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deletePublishingDestinationResponse_httpStatus :: Lens.Lens' DeletePublishingDestinationResponse Prelude.Int
deletePublishingDestinationResponse_httpStatus :: (Int -> f Int)
-> DeletePublishingDestinationResponse
-> f DeletePublishingDestinationResponse
deletePublishingDestinationResponse_httpStatus = (DeletePublishingDestinationResponse -> Int)
-> (DeletePublishingDestinationResponse
    -> Int -> DeletePublishingDestinationResponse)
-> Lens
     DeletePublishingDestinationResponse
     DeletePublishingDestinationResponse
     Int
     Int
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