{-# 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.SESV2.Types.SuppressionOptions where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SESV2.Types.SuppressionListReason
data SuppressionOptions = SuppressionOptions'
{
SuppressionOptions -> Maybe [SuppressionListReason]
suppressedReasons :: Prelude.Maybe [SuppressionListReason]
}
deriving (SuppressionOptions -> SuppressionOptions -> Bool
(SuppressionOptions -> SuppressionOptions -> Bool)
-> (SuppressionOptions -> SuppressionOptions -> Bool)
-> Eq SuppressionOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SuppressionOptions -> SuppressionOptions -> Bool
$c/= :: SuppressionOptions -> SuppressionOptions -> Bool
== :: SuppressionOptions -> SuppressionOptions -> Bool
$c== :: SuppressionOptions -> SuppressionOptions -> Bool
Prelude.Eq, ReadPrec [SuppressionOptions]
ReadPrec SuppressionOptions
Int -> ReadS SuppressionOptions
ReadS [SuppressionOptions]
(Int -> ReadS SuppressionOptions)
-> ReadS [SuppressionOptions]
-> ReadPrec SuppressionOptions
-> ReadPrec [SuppressionOptions]
-> Read SuppressionOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SuppressionOptions]
$creadListPrec :: ReadPrec [SuppressionOptions]
readPrec :: ReadPrec SuppressionOptions
$creadPrec :: ReadPrec SuppressionOptions
readList :: ReadS [SuppressionOptions]
$creadList :: ReadS [SuppressionOptions]
readsPrec :: Int -> ReadS SuppressionOptions
$creadsPrec :: Int -> ReadS SuppressionOptions
Prelude.Read, Int -> SuppressionOptions -> ShowS
[SuppressionOptions] -> ShowS
SuppressionOptions -> String
(Int -> SuppressionOptions -> ShowS)
-> (SuppressionOptions -> String)
-> ([SuppressionOptions] -> ShowS)
-> Show SuppressionOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SuppressionOptions] -> ShowS
$cshowList :: [SuppressionOptions] -> ShowS
show :: SuppressionOptions -> String
$cshow :: SuppressionOptions -> String
showsPrec :: Int -> SuppressionOptions -> ShowS
$cshowsPrec :: Int -> SuppressionOptions -> ShowS
Prelude.Show, (forall x. SuppressionOptions -> Rep SuppressionOptions x)
-> (forall x. Rep SuppressionOptions x -> SuppressionOptions)
-> Generic SuppressionOptions
forall x. Rep SuppressionOptions x -> SuppressionOptions
forall x. SuppressionOptions -> Rep SuppressionOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SuppressionOptions x -> SuppressionOptions
$cfrom :: forall x. SuppressionOptions -> Rep SuppressionOptions x
Prelude.Generic)
newSuppressionOptions ::
SuppressionOptions
newSuppressionOptions :: SuppressionOptions
newSuppressionOptions =
SuppressionOptions' :: Maybe [SuppressionListReason] -> SuppressionOptions
SuppressionOptions'
{ $sel:suppressedReasons:SuppressionOptions' :: Maybe [SuppressionListReason]
suppressedReasons =
Maybe [SuppressionListReason]
forall a. Maybe a
Prelude.Nothing
}
suppressionOptions_suppressedReasons :: Lens.Lens' SuppressionOptions (Prelude.Maybe [SuppressionListReason])
suppressionOptions_suppressedReasons :: (Maybe [SuppressionListReason]
-> f (Maybe [SuppressionListReason]))
-> SuppressionOptions -> f SuppressionOptions
suppressionOptions_suppressedReasons = (SuppressionOptions -> Maybe [SuppressionListReason])
-> (SuppressionOptions
-> Maybe [SuppressionListReason] -> SuppressionOptions)
-> Lens
SuppressionOptions
SuppressionOptions
(Maybe [SuppressionListReason])
(Maybe [SuppressionListReason])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SuppressionOptions' {Maybe [SuppressionListReason]
suppressedReasons :: Maybe [SuppressionListReason]
$sel:suppressedReasons:SuppressionOptions' :: SuppressionOptions -> Maybe [SuppressionListReason]
suppressedReasons} -> Maybe [SuppressionListReason]
suppressedReasons) (\s :: SuppressionOptions
s@SuppressionOptions' {} Maybe [SuppressionListReason]
a -> SuppressionOptions
s {$sel:suppressedReasons:SuppressionOptions' :: Maybe [SuppressionListReason]
suppressedReasons = Maybe [SuppressionListReason]
a} :: SuppressionOptions) ((Maybe [SuppressionListReason]
-> f (Maybe [SuppressionListReason]))
-> SuppressionOptions -> f SuppressionOptions)
-> ((Maybe [SuppressionListReason]
-> f (Maybe [SuppressionListReason]))
-> Maybe [SuppressionListReason]
-> f (Maybe [SuppressionListReason]))
-> (Maybe [SuppressionListReason]
-> f (Maybe [SuppressionListReason]))
-> SuppressionOptions
-> f SuppressionOptions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[SuppressionListReason]
[SuppressionListReason]
[SuppressionListReason]
[SuppressionListReason]
-> Iso
(Maybe [SuppressionListReason])
(Maybe [SuppressionListReason])
(Maybe [SuppressionListReason])
(Maybe [SuppressionListReason])
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
[SuppressionListReason]
[SuppressionListReason]
[SuppressionListReason]
[SuppressionListReason]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON SuppressionOptions where
parseJSON :: Value -> Parser SuppressionOptions
parseJSON =
String
-> (Object -> Parser SuppressionOptions)
-> Value
-> Parser SuppressionOptions
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SuppressionOptions"
( \Object
x ->
Maybe [SuppressionListReason] -> SuppressionOptions
SuppressionOptions'
(Maybe [SuppressionListReason] -> SuppressionOptions)
-> Parser (Maybe [SuppressionListReason])
-> Parser SuppressionOptions
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [SuppressionListReason]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SuppressedReasons"
Parser (Maybe (Maybe [SuppressionListReason]))
-> Maybe [SuppressionListReason]
-> Parser (Maybe [SuppressionListReason])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [SuppressionListReason]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable SuppressionOptions
instance Prelude.NFData SuppressionOptions
instance Core.ToJSON SuppressionOptions where
toJSON :: SuppressionOptions -> Value
toJSON SuppressionOptions' {Maybe [SuppressionListReason]
suppressedReasons :: Maybe [SuppressionListReason]
$sel:suppressedReasons:SuppressionOptions' :: SuppressionOptions -> Maybe [SuppressionListReason]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"SuppressedReasons" Text -> [SuppressionListReason] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([SuppressionListReason] -> Pair)
-> Maybe [SuppressionListReason] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [SuppressionListReason]
suppressedReasons
]
)