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

instance Prelude.NFData DeleteSuppressedDestination

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

instance Core.ToQuery DeleteSuppressedDestination where
  toQuery :: DeleteSuppressedDestination -> QueryString
toQuery = QueryString -> DeleteSuppressedDestination -> 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:/ 'newDeleteSuppressedDestinationResponse' smart constructor.
data DeleteSuppressedDestinationResponse = DeleteSuppressedDestinationResponse'
  { -- | The response's http status code.
    DeleteSuppressedDestinationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteSuppressedDestinationResponse
-> DeleteSuppressedDestinationResponse -> Bool
(DeleteSuppressedDestinationResponse
 -> DeleteSuppressedDestinationResponse -> Bool)
-> (DeleteSuppressedDestinationResponse
    -> DeleteSuppressedDestinationResponse -> Bool)
-> Eq DeleteSuppressedDestinationResponse
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]
(Int -> ReadS DeleteSuppressedDestinationResponse)
-> ReadS [DeleteSuppressedDestinationResponse]
-> ReadPrec DeleteSuppressedDestinationResponse
-> ReadPrec [DeleteSuppressedDestinationResponse]
-> Read 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
(Int -> DeleteSuppressedDestinationResponse -> ShowS)
-> (DeleteSuppressedDestinationResponse -> String)
-> ([DeleteSuppressedDestinationResponse] -> ShowS)
-> Show DeleteSuppressedDestinationResponse
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.
 DeleteSuppressedDestinationResponse
 -> Rep DeleteSuppressedDestinationResponse x)
-> (forall x.
    Rep DeleteSuppressedDestinationResponse x
    -> DeleteSuppressedDestinationResponse)
-> Generic DeleteSuppressedDestinationResponse
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' :: Int -> DeleteSuppressedDestinationResponse
DeleteSuppressedDestinationResponse'
    { $sel:httpStatus:DeleteSuppressedDestinationResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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