{-# 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.DescribeReceiptRule
(
DescribeReceiptRule (..),
newDescribeReceiptRule,
describeReceiptRule_ruleSetName,
describeReceiptRule_ruleName,
DescribeReceiptRuleResponse (..),
newDescribeReceiptRuleResponse,
describeReceiptRuleResponse_rule,
describeReceiptRuleResponse_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 DescribeReceiptRule = DescribeReceiptRule'
{
DescribeReceiptRule -> Text
ruleSetName :: Prelude.Text,
DescribeReceiptRule -> Text
ruleName :: Prelude.Text
}
deriving (DescribeReceiptRule -> DescribeReceiptRule -> Bool
(DescribeReceiptRule -> DescribeReceiptRule -> Bool)
-> (DescribeReceiptRule -> DescribeReceiptRule -> Bool)
-> Eq DescribeReceiptRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeReceiptRule -> DescribeReceiptRule -> Bool
$c/= :: DescribeReceiptRule -> DescribeReceiptRule -> Bool
== :: DescribeReceiptRule -> DescribeReceiptRule -> Bool
$c== :: DescribeReceiptRule -> DescribeReceiptRule -> Bool
Prelude.Eq, ReadPrec [DescribeReceiptRule]
ReadPrec DescribeReceiptRule
Int -> ReadS DescribeReceiptRule
ReadS [DescribeReceiptRule]
(Int -> ReadS DescribeReceiptRule)
-> ReadS [DescribeReceiptRule]
-> ReadPrec DescribeReceiptRule
-> ReadPrec [DescribeReceiptRule]
-> Read DescribeReceiptRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeReceiptRule]
$creadListPrec :: ReadPrec [DescribeReceiptRule]
readPrec :: ReadPrec DescribeReceiptRule
$creadPrec :: ReadPrec DescribeReceiptRule
readList :: ReadS [DescribeReceiptRule]
$creadList :: ReadS [DescribeReceiptRule]
readsPrec :: Int -> ReadS DescribeReceiptRule
$creadsPrec :: Int -> ReadS DescribeReceiptRule
Prelude.Read, Int -> DescribeReceiptRule -> ShowS
[DescribeReceiptRule] -> ShowS
DescribeReceiptRule -> String
(Int -> DescribeReceiptRule -> ShowS)
-> (DescribeReceiptRule -> String)
-> ([DescribeReceiptRule] -> ShowS)
-> Show DescribeReceiptRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeReceiptRule] -> ShowS
$cshowList :: [DescribeReceiptRule] -> ShowS
show :: DescribeReceiptRule -> String
$cshow :: DescribeReceiptRule -> String
showsPrec :: Int -> DescribeReceiptRule -> ShowS
$cshowsPrec :: Int -> DescribeReceiptRule -> ShowS
Prelude.Show, (forall x. DescribeReceiptRule -> Rep DescribeReceiptRule x)
-> (forall x. Rep DescribeReceiptRule x -> DescribeReceiptRule)
-> Generic DescribeReceiptRule
forall x. Rep DescribeReceiptRule x -> DescribeReceiptRule
forall x. DescribeReceiptRule -> Rep DescribeReceiptRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeReceiptRule x -> DescribeReceiptRule
$cfrom :: forall x. DescribeReceiptRule -> Rep DescribeReceiptRule x
Prelude.Generic)
newDescribeReceiptRule ::
Prelude.Text ->
Prelude.Text ->
DescribeReceiptRule
newDescribeReceiptRule :: Text -> Text -> DescribeReceiptRule
newDescribeReceiptRule Text
pRuleSetName_ Text
pRuleName_ =
DescribeReceiptRule' :: Text -> Text -> DescribeReceiptRule
DescribeReceiptRule'
{ $sel:ruleSetName:DescribeReceiptRule' :: Text
ruleSetName = Text
pRuleSetName_,
$sel:ruleName:DescribeReceiptRule' :: Text
ruleName = Text
pRuleName_
}
describeReceiptRule_ruleSetName :: Lens.Lens' DescribeReceiptRule Prelude.Text
describeReceiptRule_ruleSetName :: (Text -> f Text) -> DescribeReceiptRule -> f DescribeReceiptRule
describeReceiptRule_ruleSetName = (DescribeReceiptRule -> Text)
-> (DescribeReceiptRule -> Text -> DescribeReceiptRule)
-> Lens DescribeReceiptRule DescribeReceiptRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReceiptRule' {Text
ruleSetName :: Text
$sel:ruleSetName:DescribeReceiptRule' :: DescribeReceiptRule -> Text
ruleSetName} -> Text
ruleSetName) (\s :: DescribeReceiptRule
s@DescribeReceiptRule' {} Text
a -> DescribeReceiptRule
s {$sel:ruleSetName:DescribeReceiptRule' :: Text
ruleSetName = Text
a} :: DescribeReceiptRule)
describeReceiptRule_ruleName :: Lens.Lens' DescribeReceiptRule Prelude.Text
describeReceiptRule_ruleName :: (Text -> f Text) -> DescribeReceiptRule -> f DescribeReceiptRule
describeReceiptRule_ruleName = (DescribeReceiptRule -> Text)
-> (DescribeReceiptRule -> Text -> DescribeReceiptRule)
-> Lens DescribeReceiptRule DescribeReceiptRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReceiptRule' {Text
ruleName :: Text
$sel:ruleName:DescribeReceiptRule' :: DescribeReceiptRule -> Text
ruleName} -> Text
ruleName) (\s :: DescribeReceiptRule
s@DescribeReceiptRule' {} Text
a -> DescribeReceiptRule
s {$sel:ruleName:DescribeReceiptRule' :: Text
ruleName = Text
a} :: DescribeReceiptRule)
instance Core.AWSRequest DescribeReceiptRule where
type
AWSResponse DescribeReceiptRule =
DescribeReceiptRuleResponse
request :: DescribeReceiptRule -> Request DescribeReceiptRule
request = Service -> DescribeReceiptRule -> Request DescribeReceiptRule
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeReceiptRule
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeReceiptRule)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse DescribeReceiptRule))
-> Logger
-> Service
-> Proxy DescribeReceiptRule
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeReceiptRule)))
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
"DescribeReceiptRuleResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe ReceiptRule -> Int -> DescribeReceiptRuleResponse
DescribeReceiptRuleResponse'
(Maybe ReceiptRule -> Int -> DescribeReceiptRuleResponse)
-> Either String (Maybe ReceiptRule)
-> Either String (Int -> DescribeReceiptRuleResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ReceiptRule)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Rule")
Either String (Int -> DescribeReceiptRuleResponse)
-> Either String Int -> Either String DescribeReceiptRuleResponse
forall (f :: * -> *) a b. Applicative f => 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 DescribeReceiptRule
instance Prelude.NFData DescribeReceiptRule
instance Core.ToHeaders DescribeReceiptRule where
toHeaders :: DescribeReceiptRule -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeReceiptRule -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath DescribeReceiptRule where
toPath :: DescribeReceiptRule -> ByteString
toPath = ByteString -> DescribeReceiptRule -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeReceiptRule where
toQuery :: DescribeReceiptRule -> QueryString
toQuery DescribeReceiptRule' {Text
ruleName :: Text
ruleSetName :: Text
$sel:ruleName:DescribeReceiptRule' :: DescribeReceiptRule -> Text
$sel:ruleSetName:DescribeReceiptRule' :: DescribeReceiptRule -> 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
"DescribeReceiptRule" :: 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
]
data DescribeReceiptRuleResponse = DescribeReceiptRuleResponse'
{
DescribeReceiptRuleResponse -> Maybe ReceiptRule
rule :: Prelude.Maybe ReceiptRule,
DescribeReceiptRuleResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeReceiptRuleResponse -> DescribeReceiptRuleResponse -> Bool
(DescribeReceiptRuleResponse
-> DescribeReceiptRuleResponse -> Bool)
-> (DescribeReceiptRuleResponse
-> DescribeReceiptRuleResponse -> Bool)
-> Eq DescribeReceiptRuleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeReceiptRuleResponse -> DescribeReceiptRuleResponse -> Bool
$c/= :: DescribeReceiptRuleResponse -> DescribeReceiptRuleResponse -> Bool
== :: DescribeReceiptRuleResponse -> DescribeReceiptRuleResponse -> Bool
$c== :: DescribeReceiptRuleResponse -> DescribeReceiptRuleResponse -> Bool
Prelude.Eq, ReadPrec [DescribeReceiptRuleResponse]
ReadPrec DescribeReceiptRuleResponse
Int -> ReadS DescribeReceiptRuleResponse
ReadS [DescribeReceiptRuleResponse]
(Int -> ReadS DescribeReceiptRuleResponse)
-> ReadS [DescribeReceiptRuleResponse]
-> ReadPrec DescribeReceiptRuleResponse
-> ReadPrec [DescribeReceiptRuleResponse]
-> Read DescribeReceiptRuleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeReceiptRuleResponse]
$creadListPrec :: ReadPrec [DescribeReceiptRuleResponse]
readPrec :: ReadPrec DescribeReceiptRuleResponse
$creadPrec :: ReadPrec DescribeReceiptRuleResponse
readList :: ReadS [DescribeReceiptRuleResponse]
$creadList :: ReadS [DescribeReceiptRuleResponse]
readsPrec :: Int -> ReadS DescribeReceiptRuleResponse
$creadsPrec :: Int -> ReadS DescribeReceiptRuleResponse
Prelude.Read, Int -> DescribeReceiptRuleResponse -> ShowS
[DescribeReceiptRuleResponse] -> ShowS
DescribeReceiptRuleResponse -> String
(Int -> DescribeReceiptRuleResponse -> ShowS)
-> (DescribeReceiptRuleResponse -> String)
-> ([DescribeReceiptRuleResponse] -> ShowS)
-> Show DescribeReceiptRuleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeReceiptRuleResponse] -> ShowS
$cshowList :: [DescribeReceiptRuleResponse] -> ShowS
show :: DescribeReceiptRuleResponse -> String
$cshow :: DescribeReceiptRuleResponse -> String
showsPrec :: Int -> DescribeReceiptRuleResponse -> ShowS
$cshowsPrec :: Int -> DescribeReceiptRuleResponse -> ShowS
Prelude.Show, (forall x.
DescribeReceiptRuleResponse -> Rep DescribeReceiptRuleResponse x)
-> (forall x.
Rep DescribeReceiptRuleResponse x -> DescribeReceiptRuleResponse)
-> Generic DescribeReceiptRuleResponse
forall x.
Rep DescribeReceiptRuleResponse x -> DescribeReceiptRuleResponse
forall x.
DescribeReceiptRuleResponse -> Rep DescribeReceiptRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeReceiptRuleResponse x -> DescribeReceiptRuleResponse
$cfrom :: forall x.
DescribeReceiptRuleResponse -> Rep DescribeReceiptRuleResponse x
Prelude.Generic)
newDescribeReceiptRuleResponse ::
Prelude.Int ->
DescribeReceiptRuleResponse
newDescribeReceiptRuleResponse :: Int -> DescribeReceiptRuleResponse
newDescribeReceiptRuleResponse Int
pHttpStatus_ =
DescribeReceiptRuleResponse' :: Maybe ReceiptRule -> Int -> DescribeReceiptRuleResponse
DescribeReceiptRuleResponse'
{ $sel:rule:DescribeReceiptRuleResponse' :: Maybe ReceiptRule
rule =
Maybe ReceiptRule
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeReceiptRuleResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeReceiptRuleResponse_rule :: Lens.Lens' DescribeReceiptRuleResponse (Prelude.Maybe ReceiptRule)
describeReceiptRuleResponse_rule :: (Maybe ReceiptRule -> f (Maybe ReceiptRule))
-> DescribeReceiptRuleResponse -> f DescribeReceiptRuleResponse
describeReceiptRuleResponse_rule = (DescribeReceiptRuleResponse -> Maybe ReceiptRule)
-> (DescribeReceiptRuleResponse
-> Maybe ReceiptRule -> DescribeReceiptRuleResponse)
-> Lens
DescribeReceiptRuleResponse
DescribeReceiptRuleResponse
(Maybe ReceiptRule)
(Maybe ReceiptRule)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReceiptRuleResponse' {Maybe ReceiptRule
rule :: Maybe ReceiptRule
$sel:rule:DescribeReceiptRuleResponse' :: DescribeReceiptRuleResponse -> Maybe ReceiptRule
rule} -> Maybe ReceiptRule
rule) (\s :: DescribeReceiptRuleResponse
s@DescribeReceiptRuleResponse' {} Maybe ReceiptRule
a -> DescribeReceiptRuleResponse
s {$sel:rule:DescribeReceiptRuleResponse' :: Maybe ReceiptRule
rule = Maybe ReceiptRule
a} :: DescribeReceiptRuleResponse)
describeReceiptRuleResponse_httpStatus :: Lens.Lens' DescribeReceiptRuleResponse Prelude.Int
describeReceiptRuleResponse_httpStatus :: (Int -> f Int)
-> DescribeReceiptRuleResponse -> f DescribeReceiptRuleResponse
describeReceiptRuleResponse_httpStatus = (DescribeReceiptRuleResponse -> Int)
-> (DescribeReceiptRuleResponse
-> Int -> DescribeReceiptRuleResponse)
-> Lens
DescribeReceiptRuleResponse DescribeReceiptRuleResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReceiptRuleResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeReceiptRuleResponse' :: DescribeReceiptRuleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeReceiptRuleResponse
s@DescribeReceiptRuleResponse' {} Int
a -> DescribeReceiptRuleResponse
s {$sel:httpStatus:DescribeReceiptRuleResponse' :: Int
httpStatus = Int
a} :: DescribeReceiptRuleResponse)
instance Prelude.NFData DescribeReceiptRuleResponse