{-# 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.SES.DeleteIdentity
-- 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 specified identity (an email address or a domain) from the
-- list of verified identities.
--
-- You can execute this operation no more than once per second.
module Amazonka.SES.DeleteIdentity
  ( -- * Creating a Request
    DeleteIdentity (..),
    newDeleteIdentity,

    -- * Request Lenses
    deleteIdentity_identity,

    -- * Destructuring the Response
    DeleteIdentityResponse (..),
    newDeleteIdentityResponse,

    -- * Response Lenses
    deleteIdentityResponse_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.SES.Types

-- | Represents a request to delete one of your Amazon SES identities (an
-- email address or domain).
--
-- /See:/ 'newDeleteIdentity' smart constructor.
data DeleteIdentity = DeleteIdentity'
  { -- | The identity to be removed from the list of identities for the AWS
    -- Account.
    DeleteIdentity -> Text
identity :: Prelude.Text
  }
  deriving (DeleteIdentity -> DeleteIdentity -> Bool
(DeleteIdentity -> DeleteIdentity -> Bool)
-> (DeleteIdentity -> DeleteIdentity -> Bool) -> Eq DeleteIdentity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteIdentity -> DeleteIdentity -> Bool
$c/= :: DeleteIdentity -> DeleteIdentity -> Bool
== :: DeleteIdentity -> DeleteIdentity -> Bool
$c== :: DeleteIdentity -> DeleteIdentity -> Bool
Prelude.Eq, ReadPrec [DeleteIdentity]
ReadPrec DeleteIdentity
Int -> ReadS DeleteIdentity
ReadS [DeleteIdentity]
(Int -> ReadS DeleteIdentity)
-> ReadS [DeleteIdentity]
-> ReadPrec DeleteIdentity
-> ReadPrec [DeleteIdentity]
-> Read DeleteIdentity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteIdentity]
$creadListPrec :: ReadPrec [DeleteIdentity]
readPrec :: ReadPrec DeleteIdentity
$creadPrec :: ReadPrec DeleteIdentity
readList :: ReadS [DeleteIdentity]
$creadList :: ReadS [DeleteIdentity]
readsPrec :: Int -> ReadS DeleteIdentity
$creadsPrec :: Int -> ReadS DeleteIdentity
Prelude.Read, Int -> DeleteIdentity -> ShowS
[DeleteIdentity] -> ShowS
DeleteIdentity -> String
(Int -> DeleteIdentity -> ShowS)
-> (DeleteIdentity -> String)
-> ([DeleteIdentity] -> ShowS)
-> Show DeleteIdentity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteIdentity] -> ShowS
$cshowList :: [DeleteIdentity] -> ShowS
show :: DeleteIdentity -> String
$cshow :: DeleteIdentity -> String
showsPrec :: Int -> DeleteIdentity -> ShowS
$cshowsPrec :: Int -> DeleteIdentity -> ShowS
Prelude.Show, (forall x. DeleteIdentity -> Rep DeleteIdentity x)
-> (forall x. Rep DeleteIdentity x -> DeleteIdentity)
-> Generic DeleteIdentity
forall x. Rep DeleteIdentity x -> DeleteIdentity
forall x. DeleteIdentity -> Rep DeleteIdentity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteIdentity x -> DeleteIdentity
$cfrom :: forall x. DeleteIdentity -> Rep DeleteIdentity x
Prelude.Generic)

-- |
-- Create a value of 'DeleteIdentity' 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:
--
-- 'identity', 'deleteIdentity_identity' - The identity to be removed from the list of identities for the AWS
-- Account.
newDeleteIdentity ::
  -- | 'identity'
  Prelude.Text ->
  DeleteIdentity
newDeleteIdentity :: Text -> DeleteIdentity
newDeleteIdentity Text
pIdentity_ =
  DeleteIdentity' :: Text -> DeleteIdentity
DeleteIdentity' {$sel:identity:DeleteIdentity' :: Text
identity = Text
pIdentity_}

-- | The identity to be removed from the list of identities for the AWS
-- Account.
deleteIdentity_identity :: Lens.Lens' DeleteIdentity Prelude.Text
deleteIdentity_identity :: (Text -> f Text) -> DeleteIdentity -> f DeleteIdentity
deleteIdentity_identity = (DeleteIdentity -> Text)
-> (DeleteIdentity -> Text -> DeleteIdentity)
-> Lens DeleteIdentity DeleteIdentity Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteIdentity' {Text
identity :: Text
$sel:identity:DeleteIdentity' :: DeleteIdentity -> Text
identity} -> Text
identity) (\s :: DeleteIdentity
s@DeleteIdentity' {} Text
a -> DeleteIdentity
s {$sel:identity:DeleteIdentity' :: Text
identity = Text
a} :: DeleteIdentity)

instance Core.AWSRequest DeleteIdentity where
  type
    AWSResponse DeleteIdentity =
      DeleteIdentityResponse
  request :: DeleteIdentity -> Request DeleteIdentity
request = Service -> DeleteIdentity -> Request DeleteIdentity
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteIdentity
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteIdentity)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DeleteIdentity))
-> Logger
-> Service
-> Proxy DeleteIdentity
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteIdentity)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DeleteIdentityResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> DeleteIdentityResponse
DeleteIdentityResponse'
            (Int -> DeleteIdentityResponse)
-> Either String Int -> Either String DeleteIdentityResponse
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 DeleteIdentity

instance Prelude.NFData DeleteIdentity

instance Core.ToHeaders DeleteIdentity where
  toHeaders :: DeleteIdentity -> ResponseHeaders
toHeaders = ResponseHeaders -> DeleteIdentity -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath DeleteIdentity where
  toPath :: DeleteIdentity -> ByteString
toPath = ByteString -> DeleteIdentity -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DeleteIdentity where
  toQuery :: DeleteIdentity -> QueryString
toQuery DeleteIdentity' {Text
identity :: Text
$sel:identity:DeleteIdentity' :: DeleteIdentity -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DeleteIdentity" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"Identity" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
identity
      ]

-- | An empty element returned on a successful request.
--
-- /See:/ 'newDeleteIdentityResponse' smart constructor.
data DeleteIdentityResponse = DeleteIdentityResponse'
  { -- | The response's http status code.
    DeleteIdentityResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteIdentityResponse -> DeleteIdentityResponse -> Bool
(DeleteIdentityResponse -> DeleteIdentityResponse -> Bool)
-> (DeleteIdentityResponse -> DeleteIdentityResponse -> Bool)
-> Eq DeleteIdentityResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteIdentityResponse -> DeleteIdentityResponse -> Bool
$c/= :: DeleteIdentityResponse -> DeleteIdentityResponse -> Bool
== :: DeleteIdentityResponse -> DeleteIdentityResponse -> Bool
$c== :: DeleteIdentityResponse -> DeleteIdentityResponse -> Bool
Prelude.Eq, ReadPrec [DeleteIdentityResponse]
ReadPrec DeleteIdentityResponse
Int -> ReadS DeleteIdentityResponse
ReadS [DeleteIdentityResponse]
(Int -> ReadS DeleteIdentityResponse)
-> ReadS [DeleteIdentityResponse]
-> ReadPrec DeleteIdentityResponse
-> ReadPrec [DeleteIdentityResponse]
-> Read DeleteIdentityResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteIdentityResponse]
$creadListPrec :: ReadPrec [DeleteIdentityResponse]
readPrec :: ReadPrec DeleteIdentityResponse
$creadPrec :: ReadPrec DeleteIdentityResponse
readList :: ReadS [DeleteIdentityResponse]
$creadList :: ReadS [DeleteIdentityResponse]
readsPrec :: Int -> ReadS DeleteIdentityResponse
$creadsPrec :: Int -> ReadS DeleteIdentityResponse
Prelude.Read, Int -> DeleteIdentityResponse -> ShowS
[DeleteIdentityResponse] -> ShowS
DeleteIdentityResponse -> String
(Int -> DeleteIdentityResponse -> ShowS)
-> (DeleteIdentityResponse -> String)
-> ([DeleteIdentityResponse] -> ShowS)
-> Show DeleteIdentityResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteIdentityResponse] -> ShowS
$cshowList :: [DeleteIdentityResponse] -> ShowS
show :: DeleteIdentityResponse -> String
$cshow :: DeleteIdentityResponse -> String
showsPrec :: Int -> DeleteIdentityResponse -> ShowS
$cshowsPrec :: Int -> DeleteIdentityResponse -> ShowS
Prelude.Show, (forall x. DeleteIdentityResponse -> Rep DeleteIdentityResponse x)
-> (forall x.
    Rep DeleteIdentityResponse x -> DeleteIdentityResponse)
-> Generic DeleteIdentityResponse
forall x. Rep DeleteIdentityResponse x -> DeleteIdentityResponse
forall x. DeleteIdentityResponse -> Rep DeleteIdentityResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteIdentityResponse x -> DeleteIdentityResponse
$cfrom :: forall x. DeleteIdentityResponse -> Rep DeleteIdentityResponse x
Prelude.Generic)

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

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

instance Prelude.NFData DeleteIdentityResponse