{-# 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
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteReceiptRuleSet -> DeleteReceiptRuleSet -> Bool
$c/= :: DeleteReceiptRuleSet -> DeleteReceiptRuleSet -> Bool
== :: DeleteReceiptRuleSet -> DeleteReceiptRuleSet -> Bool
$c== :: DeleteReceiptRuleSet -> DeleteReceiptRuleSet -> Bool
Prelude.Eq, ReadPrec [DeleteReceiptRuleSet]
ReadPrec DeleteReceiptRuleSet
Int -> ReadS DeleteReceiptRuleSet
ReadS [DeleteReceiptRuleSet]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteReceiptRuleSet]
$creadListPrec :: ReadPrec [DeleteReceiptRuleSet]
readPrec :: ReadPrec DeleteReceiptRuleSet
$creadPrec :: ReadPrec DeleteReceiptRuleSet
readList :: ReadS [DeleteReceiptRuleSet]
$creadList :: ReadS [DeleteReceiptRuleSet]
readsPrec :: Int -> ReadS DeleteReceiptRuleSet
$creadsPrec :: Int -> ReadS DeleteReceiptRuleSet
Prelude.Read, Int -> DeleteReceiptRuleSet -> ShowS
[DeleteReceiptRuleSet] -> ShowS
DeleteReceiptRuleSet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteReceiptRuleSet] -> ShowS
$cshowList :: [DeleteReceiptRuleSet] -> ShowS
show :: DeleteReceiptRuleSet -> String
$cshow :: DeleteReceiptRuleSet -> String
showsPrec :: Int -> DeleteReceiptRuleSet -> ShowS
$cshowsPrec :: Int -> DeleteReceiptRuleSet -> ShowS
Prelude.Show, 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
$cto :: forall x. Rep DeleteReceiptRuleSet x -> DeleteReceiptRuleSet
$cfrom :: forall x. DeleteReceiptRuleSet -> Rep DeleteReceiptRuleSet x
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 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteReceiptRuleSet' {Text
ruleSetName :: Text
$sel:ruleSetName:DeleteReceiptRuleSet' :: DeleteReceiptRuleSet -> Text
ruleSetName} -> Text
ruleSetName) (\s :: DeleteReceiptRuleSet
s@DeleteReceiptRuleSet' {} Text
a -> DeleteReceiptRuleSet
s {$sel:ruleSetName:DeleteReceiptRuleSet' :: Text
ruleSetName = Text
a} :: DeleteReceiptRuleSet)

instance Core.AWSRequest DeleteReceiptRuleSet where
  type
    AWSResponse DeleteReceiptRuleSet =
      DeleteReceiptRuleSetResponse
  request :: (Service -> Service)
-> DeleteReceiptRuleSet -> Request DeleteReceiptRuleSet
request Service -> Service
overrides =
    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 =
    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'
            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 DeleteReceiptRuleSet where
  hashWithSalt :: Int -> DeleteReceiptRuleSet -> Int
hashWithSalt Int
_salt DeleteReceiptRuleSet' {Text
ruleSetName :: Text
$sel:ruleSetName:DeleteReceiptRuleSet' :: DeleteReceiptRuleSet -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ruleSetName

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

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

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

instance Data.ToQuery DeleteReceiptRuleSet where
  toQuery :: DeleteReceiptRuleSet -> QueryString
toQuery DeleteReceiptRuleSet' {Text
ruleSetName :: Text
$sel:ruleSetName:DeleteReceiptRuleSet' :: DeleteReceiptRuleSet -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DeleteReceiptRuleSet" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"RuleSetName" 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
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteReceiptRuleSetResponse
-> DeleteReceiptRuleSetResponse -> Bool
$c/= :: DeleteReceiptRuleSetResponse
-> DeleteReceiptRuleSetResponse -> Bool
== :: DeleteReceiptRuleSetResponse
-> DeleteReceiptRuleSetResponse -> Bool
$c== :: DeleteReceiptRuleSetResponse
-> DeleteReceiptRuleSetResponse -> Bool
Prelude.Eq, ReadPrec [DeleteReceiptRuleSetResponse]
ReadPrec DeleteReceiptRuleSetResponse
Int -> ReadS DeleteReceiptRuleSetResponse
ReadS [DeleteReceiptRuleSetResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteReceiptRuleSetResponse]
$creadListPrec :: ReadPrec [DeleteReceiptRuleSetResponse]
readPrec :: ReadPrec DeleteReceiptRuleSetResponse
$creadPrec :: ReadPrec DeleteReceiptRuleSetResponse
readList :: ReadS [DeleteReceiptRuleSetResponse]
$creadList :: ReadS [DeleteReceiptRuleSetResponse]
readsPrec :: Int -> ReadS DeleteReceiptRuleSetResponse
$creadsPrec :: Int -> ReadS DeleteReceiptRuleSetResponse
Prelude.Read, Int -> DeleteReceiptRuleSetResponse -> ShowS
[DeleteReceiptRuleSetResponse] -> ShowS
DeleteReceiptRuleSetResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteReceiptRuleSetResponse] -> ShowS
$cshowList :: [DeleteReceiptRuleSetResponse] -> ShowS
show :: DeleteReceiptRuleSetResponse -> String
$cshow :: DeleteReceiptRuleSetResponse -> String
showsPrec :: Int -> DeleteReceiptRuleSetResponse -> ShowS
$cshowsPrec :: Int -> DeleteReceiptRuleSetResponse -> ShowS
Prelude.Show, 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
$cto :: forall x.
Rep DeleteReceiptRuleSetResponse x -> DeleteReceiptRuleSetResponse
$cfrom :: forall x.
DeleteReceiptRuleSetResponse -> Rep DeleteReceiptRuleSetResponse x
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 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteReceiptRuleSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteReceiptRuleSetResponse' :: DeleteReceiptRuleSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteReceiptRuleSetResponse
s@DeleteReceiptRuleSetResponse' {} Int
a -> DeleteReceiptRuleSetResponse
s {$sel:httpStatus:DeleteReceiptRuleSetResponse' :: Int
httpStatus = Int
a} :: DeleteReceiptRuleSetResponse)

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