{-# 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-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 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.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 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
(DeleteReceiptRule -> DeleteReceiptRule -> Bool)
-> (DeleteReceiptRule -> DeleteReceiptRule -> Bool)
-> Eq DeleteReceiptRule
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]
(Int -> ReadS DeleteReceiptRule)
-> ReadS [DeleteReceiptRule]
-> ReadPrec DeleteReceiptRule
-> ReadPrec [DeleteReceiptRule]
-> Read 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
(Int -> DeleteReceiptRule -> ShowS)
-> (DeleteReceiptRule -> String)
-> ([DeleteReceiptRule] -> ShowS)
-> Show DeleteReceiptRule
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. DeleteReceiptRule -> Rep DeleteReceiptRule x)
-> (forall x. Rep DeleteReceiptRule x -> DeleteReceiptRule)
-> Generic DeleteReceiptRule
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' :: Text -> Text -> DeleteReceiptRule
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 :: (Text -> f Text) -> DeleteReceiptRule -> f DeleteReceiptRule
deleteReceiptRule_ruleSetName = (DeleteReceiptRule -> Text)
-> (DeleteReceiptRule -> Text -> DeleteReceiptRule)
-> Lens DeleteReceiptRule DeleteReceiptRule Text Text
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 :: (Text -> f Text) -> DeleteReceiptRule -> f DeleteReceiptRule
deleteReceiptRule_ruleName = (DeleteReceiptRule -> Text)
-> (DeleteReceiptRule -> Text -> DeleteReceiptRule)
-> Lens DeleteReceiptRule DeleteReceiptRule Text Text
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 :: DeleteReceiptRule -> Request DeleteReceiptRule
request = Service -> DeleteReceiptRule -> Request DeleteReceiptRule
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteReceiptRule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteReceiptRule)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DeleteReceiptRule))
-> Logger
-> Service
-> Proxy DeleteReceiptRule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteReceiptRule)))
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
"DeleteReceiptRuleResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> DeleteReceiptRuleResponse
DeleteReceiptRuleResponse'
            (Int -> DeleteReceiptRuleResponse)
-> Either String Int -> Either String DeleteReceiptRuleResponse
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 DeleteReceiptRule

instance Prelude.NFData DeleteReceiptRule

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

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

instance Core.ToQuery DeleteReceiptRule where
  toQuery :: DeleteReceiptRule -> QueryString
toQuery DeleteReceiptRule' {Text
ruleName :: Text
ruleSetName :: Text
$sel:ruleName:DeleteReceiptRule' :: DeleteReceiptRule -> Text
$sel:ruleSetName:DeleteReceiptRule' :: DeleteReceiptRule -> 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
"DeleteReceiptRule" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"RuleSetName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
ruleSetName,
        ByteString
"RuleName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: 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
(DeleteReceiptRuleResponse -> DeleteReceiptRuleResponse -> Bool)
-> (DeleteReceiptRuleResponse -> DeleteReceiptRuleResponse -> Bool)
-> Eq DeleteReceiptRuleResponse
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]
(Int -> ReadS DeleteReceiptRuleResponse)
-> ReadS [DeleteReceiptRuleResponse]
-> ReadPrec DeleteReceiptRuleResponse
-> ReadPrec [DeleteReceiptRuleResponse]
-> Read 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
(Int -> DeleteReceiptRuleResponse -> ShowS)
-> (DeleteReceiptRuleResponse -> String)
-> ([DeleteReceiptRuleResponse] -> ShowS)
-> Show DeleteReceiptRuleResponse
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.
 DeleteReceiptRuleResponse -> Rep DeleteReceiptRuleResponse x)
-> (forall x.
    Rep DeleteReceiptRuleResponse x -> DeleteReceiptRuleResponse)
-> Generic DeleteReceiptRuleResponse
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' :: Int -> DeleteReceiptRuleResponse
DeleteReceiptRuleResponse'
    { $sel:httpStatus:DeleteReceiptRuleResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteReceiptRuleResponse_httpStatus :: Lens.Lens' DeleteReceiptRuleResponse Prelude.Int
deleteReceiptRuleResponse_httpStatus :: (Int -> f Int)
-> DeleteReceiptRuleResponse -> f DeleteReceiptRuleResponse
deleteReceiptRuleResponse_httpStatus = (DeleteReceiptRuleResponse -> Int)
-> (DeleteReceiptRuleResponse -> Int -> DeleteReceiptRuleResponse)
-> Lens DeleteReceiptRuleResponse DeleteReceiptRuleResponse Int Int
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