{-# 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.DeleteReceiptRule
-- 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.
--
-- For information about managing receipt rules, see the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-managing-receipt-rules.html Amazon SES Developer Guide>.
--
-- You can execute this operation no more than once per second.
module Amazonka.SES.DeleteReceiptRule
  ( -- * Creating a Request
    DeleteReceiptRule (..),
    newDeleteReceiptRule,

    -- * Request Lenses
    deleteReceiptRule_ruleSetName,
    deleteReceiptRule_ruleName,

    -- * Destructuring the Response
    DeleteReceiptRuleResponse (..),
    newDeleteReceiptRuleResponse,

    -- * Response Lenses
    deleteReceiptRuleResponse_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. You use receipt rules 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:/ 'newDeleteReceiptRule' smart constructor.
data DeleteReceiptRule = DeleteReceiptRule'
  { -- | The name of the receipt rule set that contains the receipt rule to
    -- delete.
    DeleteReceiptRule -> Text
ruleSetName :: Prelude.Text,
    -- | The name of the receipt rule to delete.
    DeleteReceiptRule -> Text
ruleName :: Prelude.Text
  }
  deriving (DeleteReceiptRule -> DeleteReceiptRule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteReceiptRule -> DeleteReceiptRule -> Bool
$c/= :: DeleteReceiptRule -> DeleteReceiptRule -> Bool
== :: DeleteReceiptRule -> DeleteReceiptRule -> Bool
$c== :: DeleteReceiptRule -> DeleteReceiptRule -> Bool
Prelude.Eq, ReadPrec [DeleteReceiptRule]
ReadPrec DeleteReceiptRule
Int -> ReadS DeleteReceiptRule
ReadS [DeleteReceiptRule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteReceiptRule]
$creadListPrec :: ReadPrec [DeleteReceiptRule]
readPrec :: ReadPrec DeleteReceiptRule
$creadPrec :: ReadPrec DeleteReceiptRule
readList :: ReadS [DeleteReceiptRule]
$creadList :: ReadS [DeleteReceiptRule]
readsPrec :: Int -> ReadS DeleteReceiptRule
$creadsPrec :: Int -> ReadS DeleteReceiptRule
Prelude.Read, Int -> DeleteReceiptRule -> ShowS
[DeleteReceiptRule] -> ShowS
DeleteReceiptRule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteReceiptRule] -> ShowS
$cshowList :: [DeleteReceiptRule] -> ShowS
show :: DeleteReceiptRule -> String
$cshow :: DeleteReceiptRule -> String
showsPrec :: Int -> DeleteReceiptRule -> ShowS
$cshowsPrec :: Int -> DeleteReceiptRule -> ShowS
Prelude.Show, forall x. Rep DeleteReceiptRule x -> DeleteReceiptRule
forall x. DeleteReceiptRule -> Rep DeleteReceiptRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteReceiptRule x -> DeleteReceiptRule
$cfrom :: forall x. DeleteReceiptRule -> Rep DeleteReceiptRule x
Prelude.Generic)

-- |
-- Create a value of 'DeleteReceiptRule' 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', 'deleteReceiptRule_ruleSetName' - The name of the receipt rule set that contains the receipt rule to
-- delete.
--
-- 'ruleName', 'deleteReceiptRule_ruleName' - The name of the receipt rule to delete.
newDeleteReceiptRule ::
  -- | 'ruleSetName'
  Prelude.Text ->
  -- | 'ruleName'
  Prelude.Text ->
  DeleteReceiptRule
newDeleteReceiptRule :: Text -> Text -> DeleteReceiptRule
newDeleteReceiptRule Text
pRuleSetName_ Text
pRuleName_ =
  DeleteReceiptRule'
    { $sel:ruleSetName:DeleteReceiptRule' :: Text
ruleSetName = Text
pRuleSetName_,
      $sel:ruleName:DeleteReceiptRule' :: Text
ruleName = Text
pRuleName_
    }

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

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

instance Core.AWSRequest DeleteReceiptRule where
  type
    AWSResponse DeleteReceiptRule =
      DeleteReceiptRuleResponse
  request :: (Service -> Service)
-> DeleteReceiptRule -> Request DeleteReceiptRule
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 DeleteReceiptRule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteReceiptRule)))
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
"DeleteReceiptRuleResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> DeleteReceiptRuleResponse
DeleteReceiptRuleResponse'
            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 DeleteReceiptRule where
  hashWithSalt :: Int -> DeleteReceiptRule -> Int
hashWithSalt Int
_salt DeleteReceiptRule' {Text
ruleName :: Text
ruleSetName :: Text
$sel:ruleName:DeleteReceiptRule' :: DeleteReceiptRule -> Text
$sel:ruleSetName:DeleteReceiptRule' :: DeleteReceiptRule -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ruleSetName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ruleName

instance Prelude.NFData DeleteReceiptRule where
  rnf :: DeleteReceiptRule -> ()
rnf DeleteReceiptRule' {Text
ruleName :: Text
ruleSetName :: Text
$sel:ruleName:DeleteReceiptRule' :: DeleteReceiptRule -> Text
$sel:ruleSetName:DeleteReceiptRule' :: DeleteReceiptRule -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
ruleSetName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
ruleName

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

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

instance Data.ToQuery DeleteReceiptRule where
  toQuery :: DeleteReceiptRule -> QueryString
toQuery DeleteReceiptRule' {Text
ruleName :: Text
ruleSetName :: Text
$sel:ruleName:DeleteReceiptRule' :: DeleteReceiptRule -> Text
$sel:ruleSetName:DeleteReceiptRule' :: DeleteReceiptRule -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DeleteReceiptRule" :: 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,
        ByteString
"RuleName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
ruleName
      ]

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

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

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

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