{-# 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.PinpointEmail.Types.ReputationOptions where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ReputationOptions = ReputationOptions'
{
ReputationOptions -> Maybe POSIX
lastFreshStart :: Prelude.Maybe Core.POSIX,
ReputationOptions -> Maybe Bool
reputationMetricsEnabled :: Prelude.Maybe Prelude.Bool
}
deriving (ReputationOptions -> ReputationOptions -> Bool
(ReputationOptions -> ReputationOptions -> Bool)
-> (ReputationOptions -> ReputationOptions -> Bool)
-> Eq ReputationOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReputationOptions -> ReputationOptions -> Bool
$c/= :: ReputationOptions -> ReputationOptions -> Bool
== :: ReputationOptions -> ReputationOptions -> Bool
$c== :: ReputationOptions -> ReputationOptions -> Bool
Prelude.Eq, ReadPrec [ReputationOptions]
ReadPrec ReputationOptions
Int -> ReadS ReputationOptions
ReadS [ReputationOptions]
(Int -> ReadS ReputationOptions)
-> ReadS [ReputationOptions]
-> ReadPrec ReputationOptions
-> ReadPrec [ReputationOptions]
-> Read ReputationOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReputationOptions]
$creadListPrec :: ReadPrec [ReputationOptions]
readPrec :: ReadPrec ReputationOptions
$creadPrec :: ReadPrec ReputationOptions
readList :: ReadS [ReputationOptions]
$creadList :: ReadS [ReputationOptions]
readsPrec :: Int -> ReadS ReputationOptions
$creadsPrec :: Int -> ReadS ReputationOptions
Prelude.Read, Int -> ReputationOptions -> ShowS
[ReputationOptions] -> ShowS
ReputationOptions -> String
(Int -> ReputationOptions -> ShowS)
-> (ReputationOptions -> String)
-> ([ReputationOptions] -> ShowS)
-> Show ReputationOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReputationOptions] -> ShowS
$cshowList :: [ReputationOptions] -> ShowS
show :: ReputationOptions -> String
$cshow :: ReputationOptions -> String
showsPrec :: Int -> ReputationOptions -> ShowS
$cshowsPrec :: Int -> ReputationOptions -> ShowS
Prelude.Show, (forall x. ReputationOptions -> Rep ReputationOptions x)
-> (forall x. Rep ReputationOptions x -> ReputationOptions)
-> Generic ReputationOptions
forall x. Rep ReputationOptions x -> ReputationOptions
forall x. ReputationOptions -> Rep ReputationOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReputationOptions x -> ReputationOptions
$cfrom :: forall x. ReputationOptions -> Rep ReputationOptions x
Prelude.Generic)
newReputationOptions ::
ReputationOptions
newReputationOptions :: ReputationOptions
newReputationOptions =
ReputationOptions' :: Maybe POSIX -> Maybe Bool -> ReputationOptions
ReputationOptions'
{ $sel:lastFreshStart:ReputationOptions' :: Maybe POSIX
lastFreshStart =
Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:reputationMetricsEnabled:ReputationOptions' :: Maybe Bool
reputationMetricsEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing
}
reputationOptions_lastFreshStart :: Lens.Lens' ReputationOptions (Prelude.Maybe Prelude.UTCTime)
reputationOptions_lastFreshStart :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ReputationOptions -> f ReputationOptions
reputationOptions_lastFreshStart = (ReputationOptions -> Maybe POSIX)
-> (ReputationOptions -> Maybe POSIX -> ReputationOptions)
-> Lens
ReputationOptions ReputationOptions (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReputationOptions' {Maybe POSIX
lastFreshStart :: Maybe POSIX
$sel:lastFreshStart:ReputationOptions' :: ReputationOptions -> Maybe POSIX
lastFreshStart} -> Maybe POSIX
lastFreshStart) (\s :: ReputationOptions
s@ReputationOptions' {} Maybe POSIX
a -> ReputationOptions
s {$sel:lastFreshStart:ReputationOptions' :: Maybe POSIX
lastFreshStart = Maybe POSIX
a} :: ReputationOptions) ((Maybe POSIX -> f (Maybe POSIX))
-> ReputationOptions -> f ReputationOptions)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ReputationOptions
-> f ReputationOptions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
reputationOptions_reputationMetricsEnabled :: Lens.Lens' ReputationOptions (Prelude.Maybe Prelude.Bool)
reputationOptions_reputationMetricsEnabled :: (Maybe Bool -> f (Maybe Bool))
-> ReputationOptions -> f ReputationOptions
reputationOptions_reputationMetricsEnabled = (ReputationOptions -> Maybe Bool)
-> (ReputationOptions -> Maybe Bool -> ReputationOptions)
-> Lens
ReputationOptions ReputationOptions (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReputationOptions' {Maybe Bool
reputationMetricsEnabled :: Maybe Bool
$sel:reputationMetricsEnabled:ReputationOptions' :: ReputationOptions -> Maybe Bool
reputationMetricsEnabled} -> Maybe Bool
reputationMetricsEnabled) (\s :: ReputationOptions
s@ReputationOptions' {} Maybe Bool
a -> ReputationOptions
s {$sel:reputationMetricsEnabled:ReputationOptions' :: Maybe Bool
reputationMetricsEnabled = Maybe Bool
a} :: ReputationOptions)
instance Core.FromJSON ReputationOptions where
parseJSON :: Value -> Parser ReputationOptions
parseJSON =
String
-> (Object -> Parser ReputationOptions)
-> Value
-> Parser ReputationOptions
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ReputationOptions"
( \Object
x ->
Maybe POSIX -> Maybe Bool -> ReputationOptions
ReputationOptions'
(Maybe POSIX -> Maybe Bool -> ReputationOptions)
-> Parser (Maybe POSIX) -> Parser (Maybe Bool -> ReputationOptions)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastFreshStart")
Parser (Maybe Bool -> ReputationOptions)
-> Parser (Maybe Bool) -> Parser ReputationOptions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ReputationMetricsEnabled")
)
instance Prelude.Hashable ReputationOptions
instance Prelude.NFData ReputationOptions
instance Core.ToJSON ReputationOptions where
toJSON :: ReputationOptions -> Value
toJSON ReputationOptions' {Maybe Bool
Maybe POSIX
reputationMetricsEnabled :: Maybe Bool
lastFreshStart :: Maybe POSIX
$sel:reputationMetricsEnabled:ReputationOptions' :: ReputationOptions -> Maybe Bool
$sel:lastFreshStart:ReputationOptions' :: ReputationOptions -> Maybe POSIX
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"LastFreshStart" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
lastFreshStart,
(Text
"ReputationMetricsEnabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
reputationMetricsEnabled
]
)