{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.SES.Types.ReceiptRule where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SES.Types.ReceiptAction
import Amazonka.SES.Types.TlsPolicy
data ReceiptRule = ReceiptRule'
{
ReceiptRule -> Maybe Bool
scanEnabled :: Prelude.Maybe Prelude.Bool,
ReceiptRule -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
ReceiptRule -> Maybe [ReceiptAction]
actions :: Prelude.Maybe [ReceiptAction],
ReceiptRule -> Maybe [Text]
recipients :: Prelude.Maybe [Prelude.Text],
ReceiptRule -> Maybe TlsPolicy
tlsPolicy :: Prelude.Maybe TlsPolicy,
ReceiptRule -> Text
name :: Prelude.Text
}
deriving (ReceiptRule -> ReceiptRule -> Bool
(ReceiptRule -> ReceiptRule -> Bool)
-> (ReceiptRule -> ReceiptRule -> Bool) -> Eq ReceiptRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReceiptRule -> ReceiptRule -> Bool
$c/= :: ReceiptRule -> ReceiptRule -> Bool
== :: ReceiptRule -> ReceiptRule -> Bool
$c== :: ReceiptRule -> ReceiptRule -> Bool
Prelude.Eq, ReadPrec [ReceiptRule]
ReadPrec ReceiptRule
Int -> ReadS ReceiptRule
ReadS [ReceiptRule]
(Int -> ReadS ReceiptRule)
-> ReadS [ReceiptRule]
-> ReadPrec ReceiptRule
-> ReadPrec [ReceiptRule]
-> Read ReceiptRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReceiptRule]
$creadListPrec :: ReadPrec [ReceiptRule]
readPrec :: ReadPrec ReceiptRule
$creadPrec :: ReadPrec ReceiptRule
readList :: ReadS [ReceiptRule]
$creadList :: ReadS [ReceiptRule]
readsPrec :: Int -> ReadS ReceiptRule
$creadsPrec :: Int -> ReadS ReceiptRule
Prelude.Read, Int -> ReceiptRule -> ShowS
[ReceiptRule] -> ShowS
ReceiptRule -> String
(Int -> ReceiptRule -> ShowS)
-> (ReceiptRule -> String)
-> ([ReceiptRule] -> ShowS)
-> Show ReceiptRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReceiptRule] -> ShowS
$cshowList :: [ReceiptRule] -> ShowS
show :: ReceiptRule -> String
$cshow :: ReceiptRule -> String
showsPrec :: Int -> ReceiptRule -> ShowS
$cshowsPrec :: Int -> ReceiptRule -> ShowS
Prelude.Show, (forall x. ReceiptRule -> Rep ReceiptRule x)
-> (forall x. Rep ReceiptRule x -> ReceiptRule)
-> Generic ReceiptRule
forall x. Rep ReceiptRule x -> ReceiptRule
forall x. ReceiptRule -> Rep ReceiptRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReceiptRule x -> ReceiptRule
$cfrom :: forall x. ReceiptRule -> Rep ReceiptRule x
Prelude.Generic)
newReceiptRule ::
Prelude.Text ->
ReceiptRule
newReceiptRule :: Text -> ReceiptRule
newReceiptRule Text
pName_ =
ReceiptRule' :: Maybe Bool
-> Maybe Bool
-> Maybe [ReceiptAction]
-> Maybe [Text]
-> Maybe TlsPolicy
-> Text
-> ReceiptRule
ReceiptRule'
{ $sel:scanEnabled:ReceiptRule' :: Maybe Bool
scanEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:enabled:ReceiptRule' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:actions:ReceiptRule' :: Maybe [ReceiptAction]
actions = Maybe [ReceiptAction]
forall a. Maybe a
Prelude.Nothing,
$sel:recipients:ReceiptRule' :: Maybe [Text]
recipients = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:tlsPolicy:ReceiptRule' :: Maybe TlsPolicy
tlsPolicy = Maybe TlsPolicy
forall a. Maybe a
Prelude.Nothing,
$sel:name:ReceiptRule' :: Text
name = Text
pName_
}
receiptRule_scanEnabled :: Lens.Lens' ReceiptRule (Prelude.Maybe Prelude.Bool)
receiptRule_scanEnabled :: (Maybe Bool -> f (Maybe Bool)) -> ReceiptRule -> f ReceiptRule
receiptRule_scanEnabled = (ReceiptRule -> Maybe Bool)
-> (ReceiptRule -> Maybe Bool -> ReceiptRule)
-> Lens ReceiptRule ReceiptRule (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReceiptRule' {Maybe Bool
scanEnabled :: Maybe Bool
$sel:scanEnabled:ReceiptRule' :: ReceiptRule -> Maybe Bool
scanEnabled} -> Maybe Bool
scanEnabled) (\s :: ReceiptRule
s@ReceiptRule' {} Maybe Bool
a -> ReceiptRule
s {$sel:scanEnabled:ReceiptRule' :: Maybe Bool
scanEnabled = Maybe Bool
a} :: ReceiptRule)
receiptRule_enabled :: Lens.Lens' ReceiptRule (Prelude.Maybe Prelude.Bool)
receiptRule_enabled :: (Maybe Bool -> f (Maybe Bool)) -> ReceiptRule -> f ReceiptRule
receiptRule_enabled = (ReceiptRule -> Maybe Bool)
-> (ReceiptRule -> Maybe Bool -> ReceiptRule)
-> Lens ReceiptRule ReceiptRule (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReceiptRule' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:ReceiptRule' :: ReceiptRule -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: ReceiptRule
s@ReceiptRule' {} Maybe Bool
a -> ReceiptRule
s {$sel:enabled:ReceiptRule' :: Maybe Bool
enabled = Maybe Bool
a} :: ReceiptRule)
receiptRule_actions :: Lens.Lens' ReceiptRule (Prelude.Maybe [ReceiptAction])
receiptRule_actions :: (Maybe [ReceiptAction] -> f (Maybe [ReceiptAction]))
-> ReceiptRule -> f ReceiptRule
receiptRule_actions = (ReceiptRule -> Maybe [ReceiptAction])
-> (ReceiptRule -> Maybe [ReceiptAction] -> ReceiptRule)
-> Lens
ReceiptRule
ReceiptRule
(Maybe [ReceiptAction])
(Maybe [ReceiptAction])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReceiptRule' {Maybe [ReceiptAction]
actions :: Maybe [ReceiptAction]
$sel:actions:ReceiptRule' :: ReceiptRule -> Maybe [ReceiptAction]
actions} -> Maybe [ReceiptAction]
actions) (\s :: ReceiptRule
s@ReceiptRule' {} Maybe [ReceiptAction]
a -> ReceiptRule
s {$sel:actions:ReceiptRule' :: Maybe [ReceiptAction]
actions = Maybe [ReceiptAction]
a} :: ReceiptRule) ((Maybe [ReceiptAction] -> f (Maybe [ReceiptAction]))
-> ReceiptRule -> f ReceiptRule)
-> ((Maybe [ReceiptAction] -> f (Maybe [ReceiptAction]))
-> Maybe [ReceiptAction] -> f (Maybe [ReceiptAction]))
-> (Maybe [ReceiptAction] -> f (Maybe [ReceiptAction]))
-> ReceiptRule
-> f ReceiptRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[ReceiptAction] [ReceiptAction] [ReceiptAction] [ReceiptAction]
-> Iso
(Maybe [ReceiptAction])
(Maybe [ReceiptAction])
(Maybe [ReceiptAction])
(Maybe [ReceiptAction])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[ReceiptAction] [ReceiptAction] [ReceiptAction] [ReceiptAction]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
receiptRule_recipients :: Lens.Lens' ReceiptRule (Prelude.Maybe [Prelude.Text])
receiptRule_recipients :: (Maybe [Text] -> f (Maybe [Text])) -> ReceiptRule -> f ReceiptRule
receiptRule_recipients = (ReceiptRule -> Maybe [Text])
-> (ReceiptRule -> Maybe [Text] -> ReceiptRule)
-> Lens ReceiptRule ReceiptRule (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReceiptRule' {Maybe [Text]
recipients :: Maybe [Text]
$sel:recipients:ReceiptRule' :: ReceiptRule -> Maybe [Text]
recipients} -> Maybe [Text]
recipients) (\s :: ReceiptRule
s@ReceiptRule' {} Maybe [Text]
a -> ReceiptRule
s {$sel:recipients:ReceiptRule' :: Maybe [Text]
recipients = Maybe [Text]
a} :: ReceiptRule) ((Maybe [Text] -> f (Maybe [Text]))
-> ReceiptRule -> f ReceiptRule)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ReceiptRule
-> f ReceiptRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
receiptRule_tlsPolicy :: Lens.Lens' ReceiptRule (Prelude.Maybe TlsPolicy)
receiptRule_tlsPolicy :: (Maybe TlsPolicy -> f (Maybe TlsPolicy))
-> ReceiptRule -> f ReceiptRule
receiptRule_tlsPolicy = (ReceiptRule -> Maybe TlsPolicy)
-> (ReceiptRule -> Maybe TlsPolicy -> ReceiptRule)
-> Lens ReceiptRule ReceiptRule (Maybe TlsPolicy) (Maybe TlsPolicy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReceiptRule' {Maybe TlsPolicy
tlsPolicy :: Maybe TlsPolicy
$sel:tlsPolicy:ReceiptRule' :: ReceiptRule -> Maybe TlsPolicy
tlsPolicy} -> Maybe TlsPolicy
tlsPolicy) (\s :: ReceiptRule
s@ReceiptRule' {} Maybe TlsPolicy
a -> ReceiptRule
s {$sel:tlsPolicy:ReceiptRule' :: Maybe TlsPolicy
tlsPolicy = Maybe TlsPolicy
a} :: ReceiptRule)
receiptRule_name :: Lens.Lens' ReceiptRule Prelude.Text
receiptRule_name :: (Text -> f Text) -> ReceiptRule -> f ReceiptRule
receiptRule_name = (ReceiptRule -> Text)
-> (ReceiptRule -> Text -> ReceiptRule)
-> Lens ReceiptRule ReceiptRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReceiptRule' {Text
name :: Text
$sel:name:ReceiptRule' :: ReceiptRule -> Text
name} -> Text
name) (\s :: ReceiptRule
s@ReceiptRule' {} Text
a -> ReceiptRule
s {$sel:name:ReceiptRule' :: Text
name = Text
a} :: ReceiptRule)
instance Core.FromXML ReceiptRule where
parseXML :: [Node] -> Either String ReceiptRule
parseXML [Node]
x =
Maybe Bool
-> Maybe Bool
-> Maybe [ReceiptAction]
-> Maybe [Text]
-> Maybe TlsPolicy
-> Text
-> ReceiptRule
ReceiptRule'
(Maybe Bool
-> Maybe Bool
-> Maybe [ReceiptAction]
-> Maybe [Text]
-> Maybe TlsPolicy
-> Text
-> ReceiptRule)
-> Either String (Maybe Bool)
-> Either
String
(Maybe Bool
-> Maybe [ReceiptAction]
-> Maybe [Text]
-> Maybe TlsPolicy
-> Text
-> ReceiptRule)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ScanEnabled")
Either
String
(Maybe Bool
-> Maybe [ReceiptAction]
-> Maybe [Text]
-> Maybe TlsPolicy
-> Text
-> ReceiptRule)
-> Either String (Maybe Bool)
-> Either
String
(Maybe [ReceiptAction]
-> Maybe [Text] -> Maybe TlsPolicy -> Text -> ReceiptRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Enabled")
Either
String
(Maybe [ReceiptAction]
-> Maybe [Text] -> Maybe TlsPolicy -> Text -> ReceiptRule)
-> Either String (Maybe [ReceiptAction])
-> Either
String (Maybe [Text] -> Maybe TlsPolicy -> Text -> ReceiptRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Actions" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [ReceiptAction]))
-> Either String (Maybe [ReceiptAction])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [ReceiptAction])
-> [Node] -> Either String (Maybe [ReceiptAction])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [ReceiptAction]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either
String (Maybe [Text] -> Maybe TlsPolicy -> Text -> ReceiptRule)
-> Either String (Maybe [Text])
-> Either String (Maybe TlsPolicy -> Text -> ReceiptRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Recipients" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [Text]))
-> Either String (Maybe [Text])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Text])
-> [Node] -> Either String (Maybe [Text])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Maybe TlsPolicy -> Text -> ReceiptRule)
-> Either String (Maybe TlsPolicy)
-> Either String (Text -> ReceiptRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe TlsPolicy)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"TlsPolicy")
Either String (Text -> ReceiptRule)
-> Either String Text -> Either String ReceiptRule
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Name")
instance Prelude.Hashable ReceiptRule
instance Prelude.NFData ReceiptRule
instance Core.ToQuery ReceiptRule where
toQuery :: ReceiptRule -> QueryString
toQuery ReceiptRule' {Maybe Bool
Maybe [Text]
Maybe [ReceiptAction]
Maybe TlsPolicy
Text
name :: Text
tlsPolicy :: Maybe TlsPolicy
recipients :: Maybe [Text]
actions :: Maybe [ReceiptAction]
enabled :: Maybe Bool
scanEnabled :: Maybe Bool
$sel:name:ReceiptRule' :: ReceiptRule -> Text
$sel:tlsPolicy:ReceiptRule' :: ReceiptRule -> Maybe TlsPolicy
$sel:recipients:ReceiptRule' :: ReceiptRule -> Maybe [Text]
$sel:actions:ReceiptRule' :: ReceiptRule -> Maybe [ReceiptAction]
$sel:enabled:ReceiptRule' :: ReceiptRule -> Maybe Bool
$sel:scanEnabled:ReceiptRule' :: ReceiptRule -> Maybe Bool
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"ScanEnabled" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
scanEnabled,
ByteString
"Enabled" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
enabled,
ByteString
"Actions"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
(ByteString -> [ReceiptAction] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([ReceiptAction] -> QueryString)
-> Maybe [ReceiptAction] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ReceiptAction]
actions),
ByteString
"Recipients"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
(ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
recipients),
ByteString
"TlsPolicy" ByteString -> Maybe TlsPolicy -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe TlsPolicy
tlsPolicy,
ByteString
"Name" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
name
]