{-# 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 #-}
module Amazonka.SES.CreateReceiptRule
(
CreateReceiptRule (..),
newCreateReceiptRule,
createReceiptRule_after,
createReceiptRule_ruleSetName,
createReceiptRule_rule,
CreateReceiptRuleResponse (..),
newCreateReceiptRuleResponse,
createReceiptRuleResponse_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
data CreateReceiptRule = CreateReceiptRule'
{
CreateReceiptRule -> Maybe Text
after :: Prelude.Maybe Prelude.Text,
CreateReceiptRule -> Text
ruleSetName :: Prelude.Text,
CreateReceiptRule -> ReceiptRule
rule :: ReceiptRule
}
deriving (CreateReceiptRule -> CreateReceiptRule -> Bool
(CreateReceiptRule -> CreateReceiptRule -> Bool)
-> (CreateReceiptRule -> CreateReceiptRule -> Bool)
-> Eq CreateReceiptRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateReceiptRule -> CreateReceiptRule -> Bool
$c/= :: CreateReceiptRule -> CreateReceiptRule -> Bool
== :: CreateReceiptRule -> CreateReceiptRule -> Bool
$c== :: CreateReceiptRule -> CreateReceiptRule -> Bool
Prelude.Eq, ReadPrec [CreateReceiptRule]
ReadPrec CreateReceiptRule
Int -> ReadS CreateReceiptRule
ReadS [CreateReceiptRule]
(Int -> ReadS CreateReceiptRule)
-> ReadS [CreateReceiptRule]
-> ReadPrec CreateReceiptRule
-> ReadPrec [CreateReceiptRule]
-> Read CreateReceiptRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateReceiptRule]
$creadListPrec :: ReadPrec [CreateReceiptRule]
readPrec :: ReadPrec CreateReceiptRule
$creadPrec :: ReadPrec CreateReceiptRule
readList :: ReadS [CreateReceiptRule]
$creadList :: ReadS [CreateReceiptRule]
readsPrec :: Int -> ReadS CreateReceiptRule
$creadsPrec :: Int -> ReadS CreateReceiptRule
Prelude.Read, Int -> CreateReceiptRule -> ShowS
[CreateReceiptRule] -> ShowS
CreateReceiptRule -> String
(Int -> CreateReceiptRule -> ShowS)
-> (CreateReceiptRule -> String)
-> ([CreateReceiptRule] -> ShowS)
-> Show CreateReceiptRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateReceiptRule] -> ShowS
$cshowList :: [CreateReceiptRule] -> ShowS
show :: CreateReceiptRule -> String
$cshow :: CreateReceiptRule -> String
showsPrec :: Int -> CreateReceiptRule -> ShowS
$cshowsPrec :: Int -> CreateReceiptRule -> ShowS
Prelude.Show, (forall x. CreateReceiptRule -> Rep CreateReceiptRule x)
-> (forall x. Rep CreateReceiptRule x -> CreateReceiptRule)
-> Generic CreateReceiptRule
forall x. Rep CreateReceiptRule x -> CreateReceiptRule
forall x. CreateReceiptRule -> Rep CreateReceiptRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateReceiptRule x -> CreateReceiptRule
$cfrom :: forall x. CreateReceiptRule -> Rep CreateReceiptRule x
Prelude.Generic)
newCreateReceiptRule ::
Prelude.Text ->
ReceiptRule ->
CreateReceiptRule
newCreateReceiptRule :: Text -> ReceiptRule -> CreateReceiptRule
newCreateReceiptRule Text
pRuleSetName_ ReceiptRule
pRule_ =
CreateReceiptRule' :: Maybe Text -> Text -> ReceiptRule -> CreateReceiptRule
CreateReceiptRule'
{ $sel:after:CreateReceiptRule' :: Maybe Text
after = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:ruleSetName:CreateReceiptRule' :: Text
ruleSetName = Text
pRuleSetName_,
$sel:rule:CreateReceiptRule' :: ReceiptRule
rule = ReceiptRule
pRule_
}
createReceiptRule_after :: Lens.Lens' CreateReceiptRule (Prelude.Maybe Prelude.Text)
createReceiptRule_after :: (Maybe Text -> f (Maybe Text))
-> CreateReceiptRule -> f CreateReceiptRule
createReceiptRule_after = (CreateReceiptRule -> Maybe Text)
-> (CreateReceiptRule -> Maybe Text -> CreateReceiptRule)
-> Lens
CreateReceiptRule CreateReceiptRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReceiptRule' {Maybe Text
after :: Maybe Text
$sel:after:CreateReceiptRule' :: CreateReceiptRule -> Maybe Text
after} -> Maybe Text
after) (\s :: CreateReceiptRule
s@CreateReceiptRule' {} Maybe Text
a -> CreateReceiptRule
s {$sel:after:CreateReceiptRule' :: Maybe Text
after = Maybe Text
a} :: CreateReceiptRule)
createReceiptRule_ruleSetName :: Lens.Lens' CreateReceiptRule Prelude.Text
createReceiptRule_ruleSetName :: (Text -> f Text) -> CreateReceiptRule -> f CreateReceiptRule
createReceiptRule_ruleSetName = (CreateReceiptRule -> Text)
-> (CreateReceiptRule -> Text -> CreateReceiptRule)
-> Lens CreateReceiptRule CreateReceiptRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReceiptRule' {Text
ruleSetName :: Text
$sel:ruleSetName:CreateReceiptRule' :: CreateReceiptRule -> Text
ruleSetName} -> Text
ruleSetName) (\s :: CreateReceiptRule
s@CreateReceiptRule' {} Text
a -> CreateReceiptRule
s {$sel:ruleSetName:CreateReceiptRule' :: Text
ruleSetName = Text
a} :: CreateReceiptRule)
createReceiptRule_rule :: Lens.Lens' CreateReceiptRule ReceiptRule
createReceiptRule_rule :: (ReceiptRule -> f ReceiptRule)
-> CreateReceiptRule -> f CreateReceiptRule
createReceiptRule_rule = (CreateReceiptRule -> ReceiptRule)
-> (CreateReceiptRule -> ReceiptRule -> CreateReceiptRule)
-> Lens CreateReceiptRule CreateReceiptRule ReceiptRule ReceiptRule
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReceiptRule' {ReceiptRule
rule :: ReceiptRule
$sel:rule:CreateReceiptRule' :: CreateReceiptRule -> ReceiptRule
rule} -> ReceiptRule
rule) (\s :: CreateReceiptRule
s@CreateReceiptRule' {} ReceiptRule
a -> CreateReceiptRule
s {$sel:rule:CreateReceiptRule' :: ReceiptRule
rule = ReceiptRule
a} :: CreateReceiptRule)
instance Core.AWSRequest CreateReceiptRule where
type
AWSResponse CreateReceiptRule =
CreateReceiptRuleResponse
request :: CreateReceiptRule -> Request CreateReceiptRule
request = Service -> CreateReceiptRule -> Request CreateReceiptRule
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy CreateReceiptRule
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateReceiptRule)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CreateReceiptRule))
-> Logger
-> Service
-> Proxy CreateReceiptRule
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateReceiptRule)))
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
"CreateReceiptRuleResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Int -> CreateReceiptRuleResponse
CreateReceiptRuleResponse'
(Int -> CreateReceiptRuleResponse)
-> Either String Int -> Either String CreateReceiptRuleResponse
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 CreateReceiptRule
instance Prelude.NFData CreateReceiptRule
instance Core.ToHeaders CreateReceiptRule where
toHeaders :: CreateReceiptRule -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateReceiptRule -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath CreateReceiptRule where
toPath :: CreateReceiptRule -> ByteString
toPath = ByteString -> CreateReceiptRule -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateReceiptRule where
toQuery :: CreateReceiptRule -> QueryString
toQuery CreateReceiptRule' {Maybe Text
Text
ReceiptRule
rule :: ReceiptRule
ruleSetName :: Text
after :: Maybe Text
$sel:rule:CreateReceiptRule' :: CreateReceiptRule -> ReceiptRule
$sel:ruleSetName:CreateReceiptRule' :: CreateReceiptRule -> Text
$sel:after:CreateReceiptRule' :: CreateReceiptRule -> Maybe 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
"CreateReceiptRule" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
ByteString
"After" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
after,
ByteString
"RuleSetName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
ruleSetName,
ByteString
"Rule" ByteString -> ReceiptRule -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ReceiptRule
rule
]
data CreateReceiptRuleResponse = CreateReceiptRuleResponse'
{
CreateReceiptRuleResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateReceiptRuleResponse -> CreateReceiptRuleResponse -> Bool
(CreateReceiptRuleResponse -> CreateReceiptRuleResponse -> Bool)
-> (CreateReceiptRuleResponse -> CreateReceiptRuleResponse -> Bool)
-> Eq CreateReceiptRuleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateReceiptRuleResponse -> CreateReceiptRuleResponse -> Bool
$c/= :: CreateReceiptRuleResponse -> CreateReceiptRuleResponse -> Bool
== :: CreateReceiptRuleResponse -> CreateReceiptRuleResponse -> Bool
$c== :: CreateReceiptRuleResponse -> CreateReceiptRuleResponse -> Bool
Prelude.Eq, ReadPrec [CreateReceiptRuleResponse]
ReadPrec CreateReceiptRuleResponse
Int -> ReadS CreateReceiptRuleResponse
ReadS [CreateReceiptRuleResponse]
(Int -> ReadS CreateReceiptRuleResponse)
-> ReadS [CreateReceiptRuleResponse]
-> ReadPrec CreateReceiptRuleResponse
-> ReadPrec [CreateReceiptRuleResponse]
-> Read CreateReceiptRuleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateReceiptRuleResponse]
$creadListPrec :: ReadPrec [CreateReceiptRuleResponse]
readPrec :: ReadPrec CreateReceiptRuleResponse
$creadPrec :: ReadPrec CreateReceiptRuleResponse
readList :: ReadS [CreateReceiptRuleResponse]
$creadList :: ReadS [CreateReceiptRuleResponse]
readsPrec :: Int -> ReadS CreateReceiptRuleResponse
$creadsPrec :: Int -> ReadS CreateReceiptRuleResponse
Prelude.Read, Int -> CreateReceiptRuleResponse -> ShowS
[CreateReceiptRuleResponse] -> ShowS
CreateReceiptRuleResponse -> String
(Int -> CreateReceiptRuleResponse -> ShowS)
-> (CreateReceiptRuleResponse -> String)
-> ([CreateReceiptRuleResponse] -> ShowS)
-> Show CreateReceiptRuleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateReceiptRuleResponse] -> ShowS
$cshowList :: [CreateReceiptRuleResponse] -> ShowS
show :: CreateReceiptRuleResponse -> String
$cshow :: CreateReceiptRuleResponse -> String
showsPrec :: Int -> CreateReceiptRuleResponse -> ShowS
$cshowsPrec :: Int -> CreateReceiptRuleResponse -> ShowS
Prelude.Show, (forall x.
CreateReceiptRuleResponse -> Rep CreateReceiptRuleResponse x)
-> (forall x.
Rep CreateReceiptRuleResponse x -> CreateReceiptRuleResponse)
-> Generic CreateReceiptRuleResponse
forall x.
Rep CreateReceiptRuleResponse x -> CreateReceiptRuleResponse
forall x.
CreateReceiptRuleResponse -> Rep CreateReceiptRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateReceiptRuleResponse x -> CreateReceiptRuleResponse
$cfrom :: forall x.
CreateReceiptRuleResponse -> Rep CreateReceiptRuleResponse x
Prelude.Generic)
newCreateReceiptRuleResponse ::
Prelude.Int ->
CreateReceiptRuleResponse
newCreateReceiptRuleResponse :: Int -> CreateReceiptRuleResponse
newCreateReceiptRuleResponse Int
pHttpStatus_ =
CreateReceiptRuleResponse' :: Int -> CreateReceiptRuleResponse
CreateReceiptRuleResponse'
{ $sel:httpStatus:CreateReceiptRuleResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
createReceiptRuleResponse_httpStatus :: Lens.Lens' CreateReceiptRuleResponse Prelude.Int
createReceiptRuleResponse_httpStatus :: (Int -> f Int)
-> CreateReceiptRuleResponse -> f CreateReceiptRuleResponse
createReceiptRuleResponse_httpStatus = (CreateReceiptRuleResponse -> Int)
-> (CreateReceiptRuleResponse -> Int -> CreateReceiptRuleResponse)
-> Lens CreateReceiptRuleResponse CreateReceiptRuleResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReceiptRuleResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateReceiptRuleResponse' :: CreateReceiptRuleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateReceiptRuleResponse
s@CreateReceiptRuleResponse' {} Int
a -> CreateReceiptRuleResponse
s {$sel:httpStatus:CreateReceiptRuleResponse' :: Int
httpStatus = Int
a} :: CreateReceiptRuleResponse)
instance Prelude.NFData CreateReceiptRuleResponse