{-# 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.DeleteEmailIdentity
-- 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 an email identity. An identity can be either an email address or
-- a domain name.
module Amazonka.SESV2.DeleteEmailIdentity
  ( -- * Creating a Request
    DeleteEmailIdentity (..),
    newDeleteEmailIdentity,

    -- * Request Lenses
    deleteEmailIdentity_emailIdentity,

    -- * Destructuring the Response
    DeleteEmailIdentityResponse (..),
    newDeleteEmailIdentityResponse,

    -- * Response Lenses
    deleteEmailIdentityResponse_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 delete an existing email identity. When you delete an
-- identity, you lose the ability to send email from that identity. You can
-- restore your ability to send email by completing the verification
-- process for the identity again.
--
-- /See:/ 'newDeleteEmailIdentity' smart constructor.
data DeleteEmailIdentity = DeleteEmailIdentity'
  { -- | The identity (that is, the email address or domain) to delete.
    DeleteEmailIdentity -> Text
emailIdentity :: Prelude.Text
  }
  deriving (DeleteEmailIdentity -> DeleteEmailIdentity -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteEmailIdentity -> DeleteEmailIdentity -> Bool
$c/= :: DeleteEmailIdentity -> DeleteEmailIdentity -> Bool
== :: DeleteEmailIdentity -> DeleteEmailIdentity -> Bool
$c== :: DeleteEmailIdentity -> DeleteEmailIdentity -> Bool
Prelude.Eq, ReadPrec [DeleteEmailIdentity]
ReadPrec DeleteEmailIdentity
Int -> ReadS DeleteEmailIdentity
ReadS [DeleteEmailIdentity]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteEmailIdentity]
$creadListPrec :: ReadPrec [DeleteEmailIdentity]
readPrec :: ReadPrec DeleteEmailIdentity
$creadPrec :: ReadPrec DeleteEmailIdentity
readList :: ReadS [DeleteEmailIdentity]
$creadList :: ReadS [DeleteEmailIdentity]
readsPrec :: Int -> ReadS DeleteEmailIdentity
$creadsPrec :: Int -> ReadS DeleteEmailIdentity
Prelude.Read, Int -> DeleteEmailIdentity -> ShowS
[DeleteEmailIdentity] -> ShowS
DeleteEmailIdentity -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteEmailIdentity] -> ShowS
$cshowList :: [DeleteEmailIdentity] -> ShowS
show :: DeleteEmailIdentity -> String
$cshow :: DeleteEmailIdentity -> String
showsPrec :: Int -> DeleteEmailIdentity -> ShowS
$cshowsPrec :: Int -> DeleteEmailIdentity -> ShowS
Prelude.Show, forall x. Rep DeleteEmailIdentity x -> DeleteEmailIdentity
forall x. DeleteEmailIdentity -> Rep DeleteEmailIdentity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteEmailIdentity x -> DeleteEmailIdentity
$cfrom :: forall x. DeleteEmailIdentity -> Rep DeleteEmailIdentity x
Prelude.Generic)

-- |
-- Create a value of 'DeleteEmailIdentity' 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:
--
-- 'emailIdentity', 'deleteEmailIdentity_emailIdentity' - The identity (that is, the email address or domain) to delete.
newDeleteEmailIdentity ::
  -- | 'emailIdentity'
  Prelude.Text ->
  DeleteEmailIdentity
newDeleteEmailIdentity :: Text -> DeleteEmailIdentity
newDeleteEmailIdentity Text
pEmailIdentity_ =
  DeleteEmailIdentity'
    { $sel:emailIdentity:DeleteEmailIdentity' :: Text
emailIdentity =
        Text
pEmailIdentity_
    }

-- | The identity (that is, the email address or domain) to delete.
deleteEmailIdentity_emailIdentity :: Lens.Lens' DeleteEmailIdentity Prelude.Text
deleteEmailIdentity_emailIdentity :: Lens' DeleteEmailIdentity Text
deleteEmailIdentity_emailIdentity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEmailIdentity' {Text
emailIdentity :: Text
$sel:emailIdentity:DeleteEmailIdentity' :: DeleteEmailIdentity -> Text
emailIdentity} -> Text
emailIdentity) (\s :: DeleteEmailIdentity
s@DeleteEmailIdentity' {} Text
a -> DeleteEmailIdentity
s {$sel:emailIdentity:DeleteEmailIdentity' :: Text
emailIdentity = Text
a} :: DeleteEmailIdentity)

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

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

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

instance Data.ToQuery DeleteEmailIdentity where
  toQuery :: DeleteEmailIdentity -> 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:/ 'newDeleteEmailIdentityResponse' smart constructor.
data DeleteEmailIdentityResponse = DeleteEmailIdentityResponse'
  { -- | The response's http status code.
    DeleteEmailIdentityResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteEmailIdentityResponse -> DeleteEmailIdentityResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteEmailIdentityResponse -> DeleteEmailIdentityResponse -> Bool
$c/= :: DeleteEmailIdentityResponse -> DeleteEmailIdentityResponse -> Bool
== :: DeleteEmailIdentityResponse -> DeleteEmailIdentityResponse -> Bool
$c== :: DeleteEmailIdentityResponse -> DeleteEmailIdentityResponse -> Bool
Prelude.Eq, ReadPrec [DeleteEmailIdentityResponse]
ReadPrec DeleteEmailIdentityResponse
Int -> ReadS DeleteEmailIdentityResponse
ReadS [DeleteEmailIdentityResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteEmailIdentityResponse]
$creadListPrec :: ReadPrec [DeleteEmailIdentityResponse]
readPrec :: ReadPrec DeleteEmailIdentityResponse
$creadPrec :: ReadPrec DeleteEmailIdentityResponse
readList :: ReadS [DeleteEmailIdentityResponse]
$creadList :: ReadS [DeleteEmailIdentityResponse]
readsPrec :: Int -> ReadS DeleteEmailIdentityResponse
$creadsPrec :: Int -> ReadS DeleteEmailIdentityResponse
Prelude.Read, Int -> DeleteEmailIdentityResponse -> ShowS
[DeleteEmailIdentityResponse] -> ShowS
DeleteEmailIdentityResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteEmailIdentityResponse] -> ShowS
$cshowList :: [DeleteEmailIdentityResponse] -> ShowS
show :: DeleteEmailIdentityResponse -> String
$cshow :: DeleteEmailIdentityResponse -> String
showsPrec :: Int -> DeleteEmailIdentityResponse -> ShowS
$cshowsPrec :: Int -> DeleteEmailIdentityResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteEmailIdentityResponse x -> DeleteEmailIdentityResponse
forall x.
DeleteEmailIdentityResponse -> Rep DeleteEmailIdentityResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteEmailIdentityResponse x -> DeleteEmailIdentityResponse
$cfrom :: forall x.
DeleteEmailIdentityResponse -> Rep DeleteEmailIdentityResponse x
Prelude.Generic)

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

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

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