{-# 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.PinpointEmail.DeleteConfigurationSetEventDestination
-- 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)
--
-- Delete an event destination.
--
-- In Amazon Pinpoint, /events/ include message sends, deliveries, opens,
-- clicks, bounces, and complaints. /Event destinations/ are places that
-- you can send information about these events to. For example, you can
-- send event data to Amazon SNS to receive notifications when you receive
-- bounces or complaints, or you can use Amazon Kinesis Data Firehose to
-- stream data to Amazon S3 for long-term storage.
module Amazonka.PinpointEmail.DeleteConfigurationSetEventDestination
  ( -- * Creating a Request
    DeleteConfigurationSetEventDestination (..),
    newDeleteConfigurationSetEventDestination,

    -- * Request Lenses
    deleteConfigurationSetEventDestination_configurationSetName,
    deleteConfigurationSetEventDestination_eventDestinationName,

    -- * Destructuring the Response
    DeleteConfigurationSetEventDestinationResponse (..),
    newDeleteConfigurationSetEventDestinationResponse,

    -- * Response Lenses
    deleteConfigurationSetEventDestinationResponse_httpStatus,
  )
where

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

-- | A request to delete an event destination from a configuration set.
--
-- /See:/ 'newDeleteConfigurationSetEventDestination' smart constructor.
data DeleteConfigurationSetEventDestination = DeleteConfigurationSetEventDestination'
  { -- | The name of the configuration set that contains the event destination
    -- that you want to delete.
    DeleteConfigurationSetEventDestination -> Text
configurationSetName :: Prelude.Text,
    -- | The name of the event destination that you want to delete.
    DeleteConfigurationSetEventDestination -> Text
eventDestinationName :: Prelude.Text
  }
  deriving (DeleteConfigurationSetEventDestination
-> DeleteConfigurationSetEventDestination -> Bool
(DeleteConfigurationSetEventDestination
 -> DeleteConfigurationSetEventDestination -> Bool)
-> (DeleteConfigurationSetEventDestination
    -> DeleteConfigurationSetEventDestination -> Bool)
-> Eq DeleteConfigurationSetEventDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteConfigurationSetEventDestination
-> DeleteConfigurationSetEventDestination -> Bool
$c/= :: DeleteConfigurationSetEventDestination
-> DeleteConfigurationSetEventDestination -> Bool
== :: DeleteConfigurationSetEventDestination
-> DeleteConfigurationSetEventDestination -> Bool
$c== :: DeleteConfigurationSetEventDestination
-> DeleteConfigurationSetEventDestination -> Bool
Prelude.Eq, ReadPrec [DeleteConfigurationSetEventDestination]
ReadPrec DeleteConfigurationSetEventDestination
Int -> ReadS DeleteConfigurationSetEventDestination
ReadS [DeleteConfigurationSetEventDestination]
(Int -> ReadS DeleteConfigurationSetEventDestination)
-> ReadS [DeleteConfigurationSetEventDestination]
-> ReadPrec DeleteConfigurationSetEventDestination
-> ReadPrec [DeleteConfigurationSetEventDestination]
-> Read DeleteConfigurationSetEventDestination
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteConfigurationSetEventDestination]
$creadListPrec :: ReadPrec [DeleteConfigurationSetEventDestination]
readPrec :: ReadPrec DeleteConfigurationSetEventDestination
$creadPrec :: ReadPrec DeleteConfigurationSetEventDestination
readList :: ReadS [DeleteConfigurationSetEventDestination]
$creadList :: ReadS [DeleteConfigurationSetEventDestination]
readsPrec :: Int -> ReadS DeleteConfigurationSetEventDestination
$creadsPrec :: Int -> ReadS DeleteConfigurationSetEventDestination
Prelude.Read, Int -> DeleteConfigurationSetEventDestination -> ShowS
[DeleteConfigurationSetEventDestination] -> ShowS
DeleteConfigurationSetEventDestination -> String
(Int -> DeleteConfigurationSetEventDestination -> ShowS)
-> (DeleteConfigurationSetEventDestination -> String)
-> ([DeleteConfigurationSetEventDestination] -> ShowS)
-> Show DeleteConfigurationSetEventDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteConfigurationSetEventDestination] -> ShowS
$cshowList :: [DeleteConfigurationSetEventDestination] -> ShowS
show :: DeleteConfigurationSetEventDestination -> String
$cshow :: DeleteConfigurationSetEventDestination -> String
showsPrec :: Int -> DeleteConfigurationSetEventDestination -> ShowS
$cshowsPrec :: Int -> DeleteConfigurationSetEventDestination -> ShowS
Prelude.Show, (forall x.
 DeleteConfigurationSetEventDestination
 -> Rep DeleteConfigurationSetEventDestination x)
-> (forall x.
    Rep DeleteConfigurationSetEventDestination x
    -> DeleteConfigurationSetEventDestination)
-> Generic DeleteConfigurationSetEventDestination
forall x.
Rep DeleteConfigurationSetEventDestination x
-> DeleteConfigurationSetEventDestination
forall x.
DeleteConfigurationSetEventDestination
-> Rep DeleteConfigurationSetEventDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteConfigurationSetEventDestination x
-> DeleteConfigurationSetEventDestination
$cfrom :: forall x.
DeleteConfigurationSetEventDestination
-> Rep DeleteConfigurationSetEventDestination x
Prelude.Generic)

-- |
-- Create a value of 'DeleteConfigurationSetEventDestination' 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:
--
-- 'configurationSetName', 'deleteConfigurationSetEventDestination_configurationSetName' - The name of the configuration set that contains the event destination
-- that you want to delete.
--
-- 'eventDestinationName', 'deleteConfigurationSetEventDestination_eventDestinationName' - The name of the event destination that you want to delete.
newDeleteConfigurationSetEventDestination ::
  -- | 'configurationSetName'
  Prelude.Text ->
  -- | 'eventDestinationName'
  Prelude.Text ->
  DeleteConfigurationSetEventDestination
newDeleteConfigurationSetEventDestination :: Text -> Text -> DeleteConfigurationSetEventDestination
newDeleteConfigurationSetEventDestination
  Text
pConfigurationSetName_
  Text
pEventDestinationName_ =
    DeleteConfigurationSetEventDestination' :: Text -> Text -> DeleteConfigurationSetEventDestination
DeleteConfigurationSetEventDestination'
      { $sel:configurationSetName:DeleteConfigurationSetEventDestination' :: Text
configurationSetName =
          Text
pConfigurationSetName_,
        $sel:eventDestinationName:DeleteConfigurationSetEventDestination' :: Text
eventDestinationName =
          Text
pEventDestinationName_
      }

-- | The name of the configuration set that contains the event destination
-- that you want to delete.
deleteConfigurationSetEventDestination_configurationSetName :: Lens.Lens' DeleteConfigurationSetEventDestination Prelude.Text
deleteConfigurationSetEventDestination_configurationSetName :: (Text -> f Text)
-> DeleteConfigurationSetEventDestination
-> f DeleteConfigurationSetEventDestination
deleteConfigurationSetEventDestination_configurationSetName = (DeleteConfigurationSetEventDestination -> Text)
-> (DeleteConfigurationSetEventDestination
    -> Text -> DeleteConfigurationSetEventDestination)
-> Lens
     DeleteConfigurationSetEventDestination
     DeleteConfigurationSetEventDestination
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteConfigurationSetEventDestination' {Text
configurationSetName :: Text
$sel:configurationSetName:DeleteConfigurationSetEventDestination' :: DeleteConfigurationSetEventDestination -> Text
configurationSetName} -> Text
configurationSetName) (\s :: DeleteConfigurationSetEventDestination
s@DeleteConfigurationSetEventDestination' {} Text
a -> DeleteConfigurationSetEventDestination
s {$sel:configurationSetName:DeleteConfigurationSetEventDestination' :: Text
configurationSetName = Text
a} :: DeleteConfigurationSetEventDestination)

-- | The name of the event destination that you want to delete.
deleteConfigurationSetEventDestination_eventDestinationName :: Lens.Lens' DeleteConfigurationSetEventDestination Prelude.Text
deleteConfigurationSetEventDestination_eventDestinationName :: (Text -> f Text)
-> DeleteConfigurationSetEventDestination
-> f DeleteConfigurationSetEventDestination
deleteConfigurationSetEventDestination_eventDestinationName = (DeleteConfigurationSetEventDestination -> Text)
-> (DeleteConfigurationSetEventDestination
    -> Text -> DeleteConfigurationSetEventDestination)
-> Lens
     DeleteConfigurationSetEventDestination
     DeleteConfigurationSetEventDestination
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteConfigurationSetEventDestination' {Text
eventDestinationName :: Text
$sel:eventDestinationName:DeleteConfigurationSetEventDestination' :: DeleteConfigurationSetEventDestination -> Text
eventDestinationName} -> Text
eventDestinationName) (\s :: DeleteConfigurationSetEventDestination
s@DeleteConfigurationSetEventDestination' {} Text
a -> DeleteConfigurationSetEventDestination
s {$sel:eventDestinationName:DeleteConfigurationSetEventDestination' :: Text
eventDestinationName = Text
a} :: DeleteConfigurationSetEventDestination)

instance
  Core.AWSRequest
    DeleteConfigurationSetEventDestination
  where
  type
    AWSResponse
      DeleteConfigurationSetEventDestination =
      DeleteConfigurationSetEventDestinationResponse
  request :: DeleteConfigurationSetEventDestination
-> Request DeleteConfigurationSetEventDestination
request = Service
-> DeleteConfigurationSetEventDestination
-> Request DeleteConfigurationSetEventDestination
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteConfigurationSetEventDestination
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DeleteConfigurationSetEventDestination)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either
      String (AWSResponse DeleteConfigurationSetEventDestination))
-> Logger
-> Service
-> Proxy DeleteConfigurationSetEventDestination
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse DeleteConfigurationSetEventDestination)))
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 -> DeleteConfigurationSetEventDestinationResponse
DeleteConfigurationSetEventDestinationResponse'
            (Int -> DeleteConfigurationSetEventDestinationResponse)
-> Either String Int
-> Either String DeleteConfigurationSetEventDestinationResponse
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
    DeleteConfigurationSetEventDestination

instance
  Prelude.NFData
    DeleteConfigurationSetEventDestination

instance
  Core.ToHeaders
    DeleteConfigurationSetEventDestination
  where
  toHeaders :: DeleteConfigurationSetEventDestination -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DeleteConfigurationSetEventDestination -> 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
    DeleteConfigurationSetEventDestination
  where
  toPath :: DeleteConfigurationSetEventDestination -> ByteString
toPath DeleteConfigurationSetEventDestination' {Text
eventDestinationName :: Text
configurationSetName :: Text
$sel:eventDestinationName:DeleteConfigurationSetEventDestination' :: DeleteConfigurationSetEventDestination -> Text
$sel:configurationSetName:DeleteConfigurationSetEventDestination' :: DeleteConfigurationSetEventDestination -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v1/email/configuration-sets/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
configurationSetName,
        ByteString
"/event-destinations/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
eventDestinationName
      ]

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

-- | An HTTP 200 response if the request succeeds, or an error message if the
-- request fails.
--
-- /See:/ 'newDeleteConfigurationSetEventDestinationResponse' smart constructor.
data DeleteConfigurationSetEventDestinationResponse = DeleteConfigurationSetEventDestinationResponse'
  { -- | The response's http status code.
    DeleteConfigurationSetEventDestinationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteConfigurationSetEventDestinationResponse
-> DeleteConfigurationSetEventDestinationResponse -> Bool
(DeleteConfigurationSetEventDestinationResponse
 -> DeleteConfigurationSetEventDestinationResponse -> Bool)
-> (DeleteConfigurationSetEventDestinationResponse
    -> DeleteConfigurationSetEventDestinationResponse -> Bool)
-> Eq DeleteConfigurationSetEventDestinationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteConfigurationSetEventDestinationResponse
-> DeleteConfigurationSetEventDestinationResponse -> Bool
$c/= :: DeleteConfigurationSetEventDestinationResponse
-> DeleteConfigurationSetEventDestinationResponse -> Bool
== :: DeleteConfigurationSetEventDestinationResponse
-> DeleteConfigurationSetEventDestinationResponse -> Bool
$c== :: DeleteConfigurationSetEventDestinationResponse
-> DeleteConfigurationSetEventDestinationResponse -> Bool
Prelude.Eq, ReadPrec [DeleteConfigurationSetEventDestinationResponse]
ReadPrec DeleteConfigurationSetEventDestinationResponse
Int -> ReadS DeleteConfigurationSetEventDestinationResponse
ReadS [DeleteConfigurationSetEventDestinationResponse]
(Int -> ReadS DeleteConfigurationSetEventDestinationResponse)
-> ReadS [DeleteConfigurationSetEventDestinationResponse]
-> ReadPrec DeleteConfigurationSetEventDestinationResponse
-> ReadPrec [DeleteConfigurationSetEventDestinationResponse]
-> Read DeleteConfigurationSetEventDestinationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteConfigurationSetEventDestinationResponse]
$creadListPrec :: ReadPrec [DeleteConfigurationSetEventDestinationResponse]
readPrec :: ReadPrec DeleteConfigurationSetEventDestinationResponse
$creadPrec :: ReadPrec DeleteConfigurationSetEventDestinationResponse
readList :: ReadS [DeleteConfigurationSetEventDestinationResponse]
$creadList :: ReadS [DeleteConfigurationSetEventDestinationResponse]
readsPrec :: Int -> ReadS DeleteConfigurationSetEventDestinationResponse
$creadsPrec :: Int -> ReadS DeleteConfigurationSetEventDestinationResponse
Prelude.Read, Int -> DeleteConfigurationSetEventDestinationResponse -> ShowS
[DeleteConfigurationSetEventDestinationResponse] -> ShowS
DeleteConfigurationSetEventDestinationResponse -> String
(Int -> DeleteConfigurationSetEventDestinationResponse -> ShowS)
-> (DeleteConfigurationSetEventDestinationResponse -> String)
-> ([DeleteConfigurationSetEventDestinationResponse] -> ShowS)
-> Show DeleteConfigurationSetEventDestinationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteConfigurationSetEventDestinationResponse] -> ShowS
$cshowList :: [DeleteConfigurationSetEventDestinationResponse] -> ShowS
show :: DeleteConfigurationSetEventDestinationResponse -> String
$cshow :: DeleteConfigurationSetEventDestinationResponse -> String
showsPrec :: Int -> DeleteConfigurationSetEventDestinationResponse -> ShowS
$cshowsPrec :: Int -> DeleteConfigurationSetEventDestinationResponse -> ShowS
Prelude.Show, (forall x.
 DeleteConfigurationSetEventDestinationResponse
 -> Rep DeleteConfigurationSetEventDestinationResponse x)
-> (forall x.
    Rep DeleteConfigurationSetEventDestinationResponse x
    -> DeleteConfigurationSetEventDestinationResponse)
-> Generic DeleteConfigurationSetEventDestinationResponse
forall x.
Rep DeleteConfigurationSetEventDestinationResponse x
-> DeleteConfigurationSetEventDestinationResponse
forall x.
DeleteConfigurationSetEventDestinationResponse
-> Rep DeleteConfigurationSetEventDestinationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteConfigurationSetEventDestinationResponse x
-> DeleteConfigurationSetEventDestinationResponse
$cfrom :: forall x.
DeleteConfigurationSetEventDestinationResponse
-> Rep DeleteConfigurationSetEventDestinationResponse x
Prelude.Generic)

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

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

instance
  Prelude.NFData
    DeleteConfigurationSetEventDestinationResponse