{-# 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.SESV2.DeleteSuppressedDestination
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Removes an email address from the suppression list for your account.
module Amazonka.SESV2.DeleteSuppressedDestination
  ( -- * Creating a Request
    DeleteSuppressedDestination (..),
    newDeleteSuppressedDestination,

    -- * Request Lenses
    deleteSuppressedDestination_emailAddress,

    -- * Destructuring the Response
    DeleteSuppressedDestinationResponse (..),
    newDeleteSuppressedDestinationResponse,

    -- * Response Lenses
    deleteSuppressedDestinationResponse_httpStatus,
  )
where

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

-- | A request to remove an email address from the suppression list for your
-- account.
--
-- /See:/ 'newDeleteSuppressedDestination' smart constructor.
data DeleteSuppressedDestination = DeleteSuppressedDestination'
  { -- | The suppressed email destination to remove from the account suppression
    -- list.
    DeleteSuppressedDestination -> Text
emailAddress :: Prelude.Text
  }
  deriving (DeleteSuppressedDestination -> DeleteSuppressedDestination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteSuppressedDestination -> DeleteSuppressedDestination -> Bool
$c/= :: DeleteSuppressedDestination -> DeleteSuppressedDestination -> Bool
== :: DeleteSuppressedDestination -> DeleteSuppressedDestination -> Bool
$c== :: DeleteSuppressedDestination -> DeleteSuppressedDestination -> Bool
Prelude.Eq, ReadPrec [DeleteSuppressedDestination]
ReadPrec DeleteSuppressedDestination
Int -> ReadS DeleteSuppressedDestination
ReadS [DeleteSuppressedDestination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteSuppressedDestination]
$creadListPrec :: ReadPrec [DeleteSuppressedDestination]
readPrec :: ReadPrec DeleteSuppressedDestination
$creadPrec :: ReadPrec DeleteSuppressedDestination
readList :: ReadS [DeleteSuppressedDestination]
$creadList :: ReadS [DeleteSuppressedDestination]
readsPrec :: Int -> ReadS DeleteSuppressedDestination
$creadsPrec :: Int -> ReadS DeleteSuppressedDestination
Prelude.Read, Int -> DeleteSuppressedDestination -> ShowS
[DeleteSuppressedDestination] -> ShowS
DeleteSuppressedDestination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteSuppressedDestination] -> ShowS
$cshowList :: [DeleteSuppressedDestination] -> ShowS
show :: DeleteSuppressedDestination -> String
$cshow :: DeleteSuppressedDestination -> String
showsPrec :: Int -> DeleteSuppressedDestination -> ShowS
$cshowsPrec :: Int -> DeleteSuppressedDestination -> ShowS
Prelude.Show, forall x.
Rep DeleteSuppressedDestination x -> DeleteSuppressedDestination
forall x.
DeleteSuppressedDestination -> Rep DeleteSuppressedDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteSuppressedDestination x -> DeleteSuppressedDestination
$cfrom :: forall x.
DeleteSuppressedDestination -> Rep DeleteSuppressedDestination x
Prelude.Generic)

-- |
-- Create a value of 'DeleteSuppressedDestination' 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:
--
-- 'emailAddress', 'deleteSuppressedDestination_emailAddress' - The suppressed email destination to remove from the account suppression
-- list.
newDeleteSuppressedDestination ::
  -- | 'emailAddress'
  Prelude.Text ->
  DeleteSuppressedDestination
newDeleteSuppressedDestination :: Text -> DeleteSuppressedDestination
newDeleteSuppressedDestination Text
pEmailAddress_ =
  DeleteSuppressedDestination'
    { $sel:emailAddress:DeleteSuppressedDestination' :: Text
emailAddress =
        Text
pEmailAddress_
    }

-- | The suppressed email destination to remove from the account suppression
-- list.
deleteSuppressedDestination_emailAddress :: Lens.Lens' DeleteSuppressedDestination Prelude.Text
deleteSuppressedDestination_emailAddress :: Lens' DeleteSuppressedDestination Text
deleteSuppressedDestination_emailAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSuppressedDestination' {Text
emailAddress :: Text
$sel:emailAddress:DeleteSuppressedDestination' :: DeleteSuppressedDestination -> Text
emailAddress} -> Text
emailAddress) (\s :: DeleteSuppressedDestination
s@DeleteSuppressedDestination' {} Text
a -> DeleteSuppressedDestination
s {$sel:emailAddress:DeleteSuppressedDestination' :: Text
emailAddress = Text
a} :: DeleteSuppressedDestination)

instance Core.AWSRequest DeleteSuppressedDestination where
  type
    AWSResponse DeleteSuppressedDestination =
      DeleteSuppressedDestinationResponse
  request :: (Service -> Service)
-> DeleteSuppressedDestination
-> Request DeleteSuppressedDestination
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 DeleteSuppressedDestination
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteSuppressedDestination)))
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 -> DeleteSuppressedDestinationResponse
DeleteSuppressedDestinationResponse'
            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 DeleteSuppressedDestination where
  hashWithSalt :: Int -> DeleteSuppressedDestination -> Int
hashWithSalt Int
_salt DeleteSuppressedDestination' {Text
emailAddress :: Text
$sel:emailAddress:DeleteSuppressedDestination' :: DeleteSuppressedDestination -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
emailAddress

instance Prelude.NFData DeleteSuppressedDestination where
  rnf :: DeleteSuppressedDestination -> ()
rnf DeleteSuppressedDestination' {Text
emailAddress :: Text
$sel:emailAddress:DeleteSuppressedDestination' :: DeleteSuppressedDestination -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
emailAddress

instance Data.ToHeaders DeleteSuppressedDestination where
  toHeaders :: DeleteSuppressedDestination -> 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 DeleteSuppressedDestination where
  toPath :: DeleteSuppressedDestination -> ByteString
toPath DeleteSuppressedDestination' {Text
emailAddress :: Text
$sel:emailAddress:DeleteSuppressedDestination' :: DeleteSuppressedDestination -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v2/email/suppression/addresses/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
emailAddress
      ]

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

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

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

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

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