{-# 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.CreateReceiptRuleSet
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates an empty receipt rule set.
--
-- For information about setting up receipt rule sets, see the
-- <https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-receipt-rule-set.html Amazon SES Developer Guide>.
--
-- You can execute this operation no more than once per second.
module Amazonka.SES.CreateReceiptRuleSet
  ( -- * Creating a Request
    CreateReceiptRuleSet (..),
    newCreateReceiptRuleSet,

    -- * Request Lenses
    createReceiptRuleSet_ruleSetName,

    -- * Destructuring the Response
    CreateReceiptRuleSetResponse (..),
    newCreateReceiptRuleSetResponse,

    -- * Response Lenses
    createReceiptRuleSetResponse_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 create an empty receipt rule set. 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:/ 'newCreateReceiptRuleSet' smart constructor.
data CreateReceiptRuleSet = CreateReceiptRuleSet'
  { -- | The name of the rule set to create. The name must:
    --
    -- -   This value can only contain ASCII letters (a-z, A-Z), numbers (0-9),
    --     underscores (_), or dashes (-).
    --
    -- -   Start and end with a letter or number.
    --
    -- -   Contain less than 64 characters.
    CreateReceiptRuleSet -> Text
ruleSetName :: Prelude.Text
  }
  deriving (CreateReceiptRuleSet -> CreateReceiptRuleSet -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateReceiptRuleSet -> CreateReceiptRuleSet -> Bool
$c/= :: CreateReceiptRuleSet -> CreateReceiptRuleSet -> Bool
== :: CreateReceiptRuleSet -> CreateReceiptRuleSet -> Bool
$c== :: CreateReceiptRuleSet -> CreateReceiptRuleSet -> Bool
Prelude.Eq, ReadPrec [CreateReceiptRuleSet]
ReadPrec CreateReceiptRuleSet
Int -> ReadS CreateReceiptRuleSet
ReadS [CreateReceiptRuleSet]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateReceiptRuleSet]
$creadListPrec :: ReadPrec [CreateReceiptRuleSet]
readPrec :: ReadPrec CreateReceiptRuleSet
$creadPrec :: ReadPrec CreateReceiptRuleSet
readList :: ReadS [CreateReceiptRuleSet]
$creadList :: ReadS [CreateReceiptRuleSet]
readsPrec :: Int -> ReadS CreateReceiptRuleSet
$creadsPrec :: Int -> ReadS CreateReceiptRuleSet
Prelude.Read, Int -> CreateReceiptRuleSet -> ShowS
[CreateReceiptRuleSet] -> ShowS
CreateReceiptRuleSet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateReceiptRuleSet] -> ShowS
$cshowList :: [CreateReceiptRuleSet] -> ShowS
show :: CreateReceiptRuleSet -> String
$cshow :: CreateReceiptRuleSet -> String
showsPrec :: Int -> CreateReceiptRuleSet -> ShowS
$cshowsPrec :: Int -> CreateReceiptRuleSet -> ShowS
Prelude.Show, forall x. Rep CreateReceiptRuleSet x -> CreateReceiptRuleSet
forall x. CreateReceiptRuleSet -> Rep CreateReceiptRuleSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateReceiptRuleSet x -> CreateReceiptRuleSet
$cfrom :: forall x. CreateReceiptRuleSet -> Rep CreateReceiptRuleSet x
Prelude.Generic)

-- |
-- Create a value of 'CreateReceiptRuleSet' 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', 'createReceiptRuleSet_ruleSetName' - The name of the rule set to create. The name must:
--
-- -   This value can only contain ASCII letters (a-z, A-Z), numbers (0-9),
--     underscores (_), or dashes (-).
--
-- -   Start and end with a letter or number.
--
-- -   Contain less than 64 characters.
newCreateReceiptRuleSet ::
  -- | 'ruleSetName'
  Prelude.Text ->
  CreateReceiptRuleSet
newCreateReceiptRuleSet :: Text -> CreateReceiptRuleSet
newCreateReceiptRuleSet Text
pRuleSetName_ =
  CreateReceiptRuleSet' {$sel:ruleSetName:CreateReceiptRuleSet' :: Text
ruleSetName = Text
pRuleSetName_}

-- | The name of the rule set to create. The name must:
--
-- -   This value can only contain ASCII letters (a-z, A-Z), numbers (0-9),
--     underscores (_), or dashes (-).
--
-- -   Start and end with a letter or number.
--
-- -   Contain less than 64 characters.
createReceiptRuleSet_ruleSetName :: Lens.Lens' CreateReceiptRuleSet Prelude.Text
createReceiptRuleSet_ruleSetName :: Lens' CreateReceiptRuleSet Text
createReceiptRuleSet_ruleSetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReceiptRuleSet' {Text
ruleSetName :: Text
$sel:ruleSetName:CreateReceiptRuleSet' :: CreateReceiptRuleSet -> Text
ruleSetName} -> Text
ruleSetName) (\s :: CreateReceiptRuleSet
s@CreateReceiptRuleSet' {} Text
a -> CreateReceiptRuleSet
s {$sel:ruleSetName:CreateReceiptRuleSet' :: Text
ruleSetName = Text
a} :: CreateReceiptRuleSet)

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

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

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

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

instance Data.ToQuery CreateReceiptRuleSet where
  toQuery :: CreateReceiptRuleSet -> QueryString
toQuery CreateReceiptRuleSet' {Text
ruleSetName :: Text
$sel:ruleSetName:CreateReceiptRuleSet' :: CreateReceiptRuleSet -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"CreateReceiptRuleSet" :: 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:/ 'newCreateReceiptRuleSetResponse' smart constructor.
data CreateReceiptRuleSetResponse = CreateReceiptRuleSetResponse'
  { -- | The response's http status code.
    CreateReceiptRuleSetResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateReceiptRuleSetResponse
-> CreateReceiptRuleSetResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateReceiptRuleSetResponse
-> CreateReceiptRuleSetResponse -> Bool
$c/= :: CreateReceiptRuleSetResponse
-> CreateReceiptRuleSetResponse -> Bool
== :: CreateReceiptRuleSetResponse
-> CreateReceiptRuleSetResponse -> Bool
$c== :: CreateReceiptRuleSetResponse
-> CreateReceiptRuleSetResponse -> Bool
Prelude.Eq, ReadPrec [CreateReceiptRuleSetResponse]
ReadPrec CreateReceiptRuleSetResponse
Int -> ReadS CreateReceiptRuleSetResponse
ReadS [CreateReceiptRuleSetResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateReceiptRuleSetResponse]
$creadListPrec :: ReadPrec [CreateReceiptRuleSetResponse]
readPrec :: ReadPrec CreateReceiptRuleSetResponse
$creadPrec :: ReadPrec CreateReceiptRuleSetResponse
readList :: ReadS [CreateReceiptRuleSetResponse]
$creadList :: ReadS [CreateReceiptRuleSetResponse]
readsPrec :: Int -> ReadS CreateReceiptRuleSetResponse
$creadsPrec :: Int -> ReadS CreateReceiptRuleSetResponse
Prelude.Read, Int -> CreateReceiptRuleSetResponse -> ShowS
[CreateReceiptRuleSetResponse] -> ShowS
CreateReceiptRuleSetResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateReceiptRuleSetResponse] -> ShowS
$cshowList :: [CreateReceiptRuleSetResponse] -> ShowS
show :: CreateReceiptRuleSetResponse -> String
$cshow :: CreateReceiptRuleSetResponse -> String
showsPrec :: Int -> CreateReceiptRuleSetResponse -> ShowS
$cshowsPrec :: Int -> CreateReceiptRuleSetResponse -> ShowS
Prelude.Show, forall x.
Rep CreateReceiptRuleSetResponse x -> CreateReceiptRuleSetResponse
forall x.
CreateReceiptRuleSetResponse -> Rep CreateReceiptRuleSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateReceiptRuleSetResponse x -> CreateReceiptRuleSetResponse
$cfrom :: forall x.
CreateReceiptRuleSetResponse -> Rep CreateReceiptRuleSetResponse x
Prelude.Generic)

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

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

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