{-# 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-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 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.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 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
/= :: 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]
(Int -> ReadS DeleteReceiptRuleSet)
-> ReadS [DeleteReceiptRuleSet]
-> ReadPrec DeleteReceiptRuleSet
-> ReadPrec [DeleteReceiptRuleSet]
-> Read 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
(Int -> DeleteReceiptRuleSet -> ShowS)
-> (DeleteReceiptRuleSet -> String)
-> ([DeleteReceiptRuleSet] -> ShowS)
-> Show DeleteReceiptRuleSet
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. 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
$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' :: Text -> DeleteReceiptRuleSet
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 :: (Text -> f Text) -> DeleteReceiptRuleSet -> f DeleteReceiptRuleSet
deleteReceiptRuleSet_ruleSetName = (DeleteReceiptRuleSet -> Text)
-> (DeleteReceiptRuleSet -> Text -> DeleteReceiptRuleSet)
-> Lens DeleteReceiptRuleSet DeleteReceiptRuleSet Text Text
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 :: DeleteReceiptRuleSet -> Request DeleteReceiptRuleSet
request = Service -> DeleteReceiptRuleSet -> Request DeleteReceiptRuleSet
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteReceiptRuleSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteReceiptRuleSet)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DeleteReceiptRuleSet))
-> Logger
-> Service
-> Proxy DeleteReceiptRuleSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteReceiptRuleSet)))
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
"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 (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

instance Prelude.NFData DeleteReceiptRuleSet

instance Core.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 Core.ToPath DeleteReceiptRuleSet where
  toPath :: DeleteReceiptRuleSet -> ByteString
toPath = ByteString -> DeleteReceiptRuleSet -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DeleteReceiptRuleSet where
  toQuery :: DeleteReceiptRuleSet -> QueryString
toQuery DeleteReceiptRuleSet' {Text
ruleSetName :: Text
$sel:ruleSetName:DeleteReceiptRuleSet' :: DeleteReceiptRuleSet -> 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
"DeleteReceiptRuleSet" :: 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
      ]

-- | 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
/= :: 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]
(Int -> ReadS DeleteReceiptRuleSetResponse)
-> ReadS [DeleteReceiptRuleSetResponse]
-> ReadPrec DeleteReceiptRuleSetResponse
-> ReadPrec [DeleteReceiptRuleSetResponse]
-> Read 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
(Int -> DeleteReceiptRuleSetResponse -> ShowS)
-> (DeleteReceiptRuleSetResponse -> String)
-> ([DeleteReceiptRuleSetResponse] -> ShowS)
-> Show DeleteReceiptRuleSetResponse
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.
 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
$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' :: Int -> DeleteReceiptRuleSetResponse
DeleteReceiptRuleSetResponse'
    { $sel:httpStatus:DeleteReceiptRuleSetResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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