{-# 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.TopicPreference where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.SESV2.Types.SubscriptionStatus
data TopicPreference = TopicPreference'
{
TopicPreference -> Text
topicName :: Prelude.Text,
TopicPreference -> SubscriptionStatus
subscriptionStatus :: SubscriptionStatus
}
deriving (TopicPreference -> TopicPreference -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TopicPreference -> TopicPreference -> Bool
$c/= :: TopicPreference -> TopicPreference -> Bool
== :: TopicPreference -> TopicPreference -> Bool
$c== :: TopicPreference -> TopicPreference -> Bool
Prelude.Eq, ReadPrec [TopicPreference]
ReadPrec TopicPreference
Int -> ReadS TopicPreference
ReadS [TopicPreference]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TopicPreference]
$creadListPrec :: ReadPrec [TopicPreference]
readPrec :: ReadPrec TopicPreference
$creadPrec :: ReadPrec TopicPreference
readList :: ReadS [TopicPreference]
$creadList :: ReadS [TopicPreference]
readsPrec :: Int -> ReadS TopicPreference
$creadsPrec :: Int -> ReadS TopicPreference
Prelude.Read, Int -> TopicPreference -> ShowS
[TopicPreference] -> ShowS
TopicPreference -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TopicPreference] -> ShowS
$cshowList :: [TopicPreference] -> ShowS
show :: TopicPreference -> String
$cshow :: TopicPreference -> String
showsPrec :: Int -> TopicPreference -> ShowS
$cshowsPrec :: Int -> TopicPreference -> ShowS
Prelude.Show, forall x. Rep TopicPreference x -> TopicPreference
forall x. TopicPreference -> Rep TopicPreference x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TopicPreference x -> TopicPreference
$cfrom :: forall x. TopicPreference -> Rep TopicPreference x
Prelude.Generic)
newTopicPreference ::
Prelude.Text ->
SubscriptionStatus ->
TopicPreference
newTopicPreference :: Text -> SubscriptionStatus -> TopicPreference
newTopicPreference Text
pTopicName_ SubscriptionStatus
pSubscriptionStatus_ =
TopicPreference'
{ $sel:topicName:TopicPreference' :: Text
topicName = Text
pTopicName_,
$sel:subscriptionStatus:TopicPreference' :: SubscriptionStatus
subscriptionStatus = SubscriptionStatus
pSubscriptionStatus_
}
topicPreference_topicName :: Lens.Lens' TopicPreference Prelude.Text
topicPreference_topicName :: Lens' TopicPreference Text
topicPreference_topicName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TopicPreference' {Text
topicName :: Text
$sel:topicName:TopicPreference' :: TopicPreference -> Text
topicName} -> Text
topicName) (\s :: TopicPreference
s@TopicPreference' {} Text
a -> TopicPreference
s {$sel:topicName:TopicPreference' :: Text
topicName = Text
a} :: TopicPreference)
topicPreference_subscriptionStatus :: Lens.Lens' TopicPreference SubscriptionStatus
topicPreference_subscriptionStatus :: Lens' TopicPreference SubscriptionStatus
topicPreference_subscriptionStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TopicPreference' {SubscriptionStatus
subscriptionStatus :: SubscriptionStatus
$sel:subscriptionStatus:TopicPreference' :: TopicPreference -> SubscriptionStatus
subscriptionStatus} -> SubscriptionStatus
subscriptionStatus) (\s :: TopicPreference
s@TopicPreference' {} SubscriptionStatus
a -> TopicPreference
s {$sel:subscriptionStatus:TopicPreference' :: SubscriptionStatus
subscriptionStatus = SubscriptionStatus
a} :: TopicPreference)
instance Data.FromJSON TopicPreference where
parseJSON :: Value -> Parser TopicPreference
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"TopicPreference"
( \Object
x ->
Text -> SubscriptionStatus -> TopicPreference
TopicPreference'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"TopicName")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"SubscriptionStatus")
)
instance Prelude.Hashable TopicPreference where
hashWithSalt :: Int -> TopicPreference -> Int
hashWithSalt Int
_salt TopicPreference' {Text
SubscriptionStatus
subscriptionStatus :: SubscriptionStatus
topicName :: Text
$sel:subscriptionStatus:TopicPreference' :: TopicPreference -> SubscriptionStatus
$sel:topicName:TopicPreference' :: TopicPreference -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
topicName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SubscriptionStatus
subscriptionStatus
instance Prelude.NFData TopicPreference where
rnf :: TopicPreference -> ()
rnf TopicPreference' {Text
SubscriptionStatus
subscriptionStatus :: SubscriptionStatus
topicName :: Text
$sel:subscriptionStatus:TopicPreference' :: TopicPreference -> SubscriptionStatus
$sel:topicName:TopicPreference' :: TopicPreference -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
topicName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf SubscriptionStatus
subscriptionStatus
instance Data.ToJSON TopicPreference where
toJSON :: TopicPreference -> Value
toJSON TopicPreference' {Text
SubscriptionStatus
subscriptionStatus :: SubscriptionStatus
topicName :: Text
$sel:subscriptionStatus:TopicPreference' :: TopicPreference -> SubscriptionStatus
$sel:topicName:TopicPreference' :: TopicPreference -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"TopicName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
topicName),
forall a. a -> Maybe a
Prelude.Just
(Key
"SubscriptionStatus" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= SubscriptionStatus
subscriptionStatus)
]
)