{-# 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.DeleteReceiptRuleSet
-- 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 the specified receipt rule set and all of the receipt rules it
-- contains.
--
-- The currently active rule set cannot be deleted.
--
-- For information about managing receipt rule sets, see the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-managing-receipt-rule-sets.html Amazon SES Developer Guide>.
--
-- You can execute this operation no more than once per second.
module Amazonka.SES.DeleteReceiptRuleSet
  ( -- * Creating a Request
    DeleteReceiptRuleSet (..),
    newDeleteReceiptRuleSet,

    -- * Request Lenses
    deleteReceiptRuleSet_ruleSetName,

    -- * Destructuring the Response
    DeleteReceiptRuleSetResponse (..),
    newDeleteReceiptRuleSetResponse,

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

-- | Represents a request to delete a receipt rule set and all of the receipt
-- rules it contains. You use receipt rule sets to receive email with
-- Amazon SES. For more information, see the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-concepts.html Amazon SES Developer Guide>.
--
-- /See:/ 'newDeleteReceiptRuleSet' smart constructor.
data DeleteReceiptRuleSet = DeleteReceiptRuleSet'
  { -- | The name of the receipt rule set to delete.
    DeleteReceiptRuleSet -> Text
ruleSetName :: Prelude.Text
  }
  deriving (DeleteReceiptRuleSet -> DeleteReceiptRuleSet -> Bool
(DeleteReceiptRuleSet -> DeleteReceiptRuleSet -> Bool)
-> (DeleteReceiptRuleSet -> DeleteReceiptRuleSet -> Bool)
-> Eq DeleteReceiptRuleSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DeleteReceiptRuleSet -> DeleteReceiptRuleSet -> Bool
== :: DeleteReceiptRuleSet -> DeleteReceiptRuleSet -> Bool
$c/= :: DeleteReceiptRuleSet -> DeleteReceiptRuleSet -> Bool
/= :: DeleteReceiptRuleSet -> DeleteReceiptRuleSet -> Bool
Prelude.Eq, ReadPrec [DeleteReceiptRuleSet]
ReadPrec DeleteReceiptRuleSet
Int -> ReadS DeleteReceiptRuleSet
ReadS [DeleteReceiptRuleSet]
(Int -> ReadS DeleteReceiptRuleSet)
-> ReadS [DeleteReceiptRuleSet]
-> ReadPrec DeleteReceiptRuleSet
-> ReadPrec [DeleteReceiptRuleSet]
-> Read DeleteReceiptRuleSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS DeleteReceiptRuleSet
readsPrec :: Int -> ReadS DeleteReceiptRuleSet
$creadList :: ReadS [DeleteReceiptRuleSet]
readList :: ReadS [DeleteReceiptRuleSet]
$creadPrec :: ReadPrec DeleteReceiptRuleSet
readPrec :: ReadPrec DeleteReceiptRuleSet
$creadListPrec :: ReadPrec [DeleteReceiptRuleSet]
readListPrec :: ReadPrec [DeleteReceiptRuleSet]
Prelude.Read, Int -> DeleteReceiptRuleSet -> ShowS
[DeleteReceiptRuleSet] -> ShowS
DeleteReceiptRuleSet -> String
(Int -> DeleteReceiptRuleSet -> ShowS)
-> (DeleteReceiptRuleSet -> String)
-> ([DeleteReceiptRuleSet] -> ShowS)
-> Show DeleteReceiptRuleSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DeleteReceiptRuleSet -> ShowS
showsPrec :: Int -> DeleteReceiptRuleSet -> ShowS
$cshow :: DeleteReceiptRuleSet -> String
show :: DeleteReceiptRuleSet -> String
$cshowList :: [DeleteReceiptRuleSet] -> ShowS
showList :: [DeleteReceiptRuleSet] -> ShowS
Prelude.Show, (forall x. DeleteReceiptRuleSet -> Rep DeleteReceiptRuleSet x)
-> (forall x. Rep DeleteReceiptRuleSet x -> DeleteReceiptRuleSet)
-> Generic DeleteReceiptRuleSet
forall x. Rep DeleteReceiptRuleSet x -> DeleteReceiptRuleSet
forall x. DeleteReceiptRuleSet -> Rep DeleteReceiptRuleSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DeleteReceiptRuleSet -> Rep DeleteReceiptRuleSet x
from :: forall x. DeleteReceiptRuleSet -> Rep DeleteReceiptRuleSet x
$cto :: forall x. Rep DeleteReceiptRuleSet x -> DeleteReceiptRuleSet
to :: forall x. Rep DeleteReceiptRuleSet x -> DeleteReceiptRuleSet
Prelude.Generic)

-- |
-- Create a value of 'DeleteReceiptRuleSet' 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:
--
-- 'ruleSetName', 'deleteReceiptRuleSet_ruleSetName' - The name of the receipt rule set to delete.
newDeleteReceiptRuleSet ::
  -- | 'ruleSetName'
  Prelude.Text ->
  DeleteReceiptRuleSet
newDeleteReceiptRuleSet :: Text -> DeleteReceiptRuleSet
newDeleteReceiptRuleSet Text
pRuleSetName_ =
  DeleteReceiptRuleSet' {$sel:ruleSetName:DeleteReceiptRuleSet' :: Text
ruleSetName = Text
pRuleSetName_}

-- | The name of the receipt rule set to delete.
deleteReceiptRuleSet_ruleSetName :: Lens.Lens' DeleteReceiptRuleSet Prelude.Text
deleteReceiptRuleSet_ruleSetName :: Lens' DeleteReceiptRuleSet Text
deleteReceiptRuleSet_ruleSetName = (DeleteReceiptRuleSet -> Text)
-> (DeleteReceiptRuleSet -> Text -> DeleteReceiptRuleSet)
-> Lens' DeleteReceiptRuleSet Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteReceiptRuleSet' {Text
$sel:ruleSetName:DeleteReceiptRuleSet' :: DeleteReceiptRuleSet -> Text
ruleSetName :: Text
ruleSetName} -> Text
ruleSetName) (\s :: DeleteReceiptRuleSet
s@DeleteReceiptRuleSet' {} Text
a -> DeleteReceiptRuleSet
s {ruleSetName = a} :: DeleteReceiptRuleSet)

instance Core.AWSRequest DeleteReceiptRuleSet where
  type
    AWSResponse DeleteReceiptRuleSet =
      DeleteReceiptRuleSetResponse
  request :: (Service -> Service)
-> DeleteReceiptRuleSet -> Request DeleteReceiptRuleSet
request Service -> Service
overrides =
    Service -> DeleteReceiptRuleSet -> Request DeleteReceiptRuleSet
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteReceiptRuleSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteReceiptRuleSet)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DeleteReceiptRuleSet))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteReceiptRuleSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteReceiptRuleSet)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DeleteReceiptRuleSetResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> DeleteReceiptRuleSetResponse
DeleteReceiptRuleSetResponse'
            (Int -> DeleteReceiptRuleSetResponse)
-> Either String Int -> Either String DeleteReceiptRuleSetResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall a. a -> Either String a
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 DeleteReceiptRuleSet where
  hashWithSalt :: Int -> DeleteReceiptRuleSet -> Int
hashWithSalt Int
_salt DeleteReceiptRuleSet' {Text
$sel:ruleSetName:DeleteReceiptRuleSet' :: DeleteReceiptRuleSet -> Text
ruleSetName :: Text
..} =
    Int
_salt Int -> Text -> Int
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ruleSetName

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

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

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

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

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

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

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

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