{-# 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.Budgets.Types.Subscriber where
import Amazonka.Budgets.Types.SubscriptionType
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
data Subscriber = Subscriber'
{
Subscriber -> SubscriptionType
subscriptionType :: SubscriptionType,
Subscriber -> Sensitive Text
address :: Data.Sensitive Prelude.Text
}
deriving (Subscriber -> Subscriber -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Subscriber -> Subscriber -> Bool
$c/= :: Subscriber -> Subscriber -> Bool
== :: Subscriber -> Subscriber -> Bool
$c== :: Subscriber -> Subscriber -> Bool
Prelude.Eq, Int -> Subscriber -> ShowS
[Subscriber] -> ShowS
Subscriber -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Subscriber] -> ShowS
$cshowList :: [Subscriber] -> ShowS
show :: Subscriber -> String
$cshow :: Subscriber -> String
showsPrec :: Int -> Subscriber -> ShowS
$cshowsPrec :: Int -> Subscriber -> ShowS
Prelude.Show, forall x. Rep Subscriber x -> Subscriber
forall x. Subscriber -> Rep Subscriber x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Subscriber x -> Subscriber
$cfrom :: forall x. Subscriber -> Rep Subscriber x
Prelude.Generic)
newSubscriber ::
SubscriptionType ->
Prelude.Text ->
Subscriber
newSubscriber :: SubscriptionType -> Text -> Subscriber
newSubscriber SubscriptionType
pSubscriptionType_ Text
pAddress_ =
Subscriber'
{ $sel:subscriptionType:Subscriber' :: SubscriptionType
subscriptionType = SubscriptionType
pSubscriptionType_,
$sel:address:Subscriber' :: Sensitive Text
address = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pAddress_
}
subscriber_subscriptionType :: Lens.Lens' Subscriber SubscriptionType
subscriber_subscriptionType :: Lens' Subscriber SubscriptionType
subscriber_subscriptionType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Subscriber' {SubscriptionType
subscriptionType :: SubscriptionType
$sel:subscriptionType:Subscriber' :: Subscriber -> SubscriptionType
subscriptionType} -> SubscriptionType
subscriptionType) (\s :: Subscriber
s@Subscriber' {} SubscriptionType
a -> Subscriber
s {$sel:subscriptionType:Subscriber' :: SubscriptionType
subscriptionType = SubscriptionType
a} :: Subscriber)
subscriber_address :: Lens.Lens' Subscriber Prelude.Text
subscriber_address :: Lens' Subscriber Text
subscriber_address = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Subscriber' {Sensitive Text
address :: Sensitive Text
$sel:address:Subscriber' :: Subscriber -> Sensitive Text
address} -> Sensitive Text
address) (\s :: Subscriber
s@Subscriber' {} Sensitive Text
a -> Subscriber
s {$sel:address:Subscriber' :: Sensitive Text
address = Sensitive Text
a} :: Subscriber) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive
instance Data.FromJSON Subscriber where
parseJSON :: Value -> Parser Subscriber
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Subscriber"
( \Object
x ->
SubscriptionType -> Sensitive Text -> Subscriber
Subscriber'
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
"SubscriptionType")
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
"Address")
)
instance Prelude.Hashable Subscriber where
hashWithSalt :: Int -> Subscriber -> Int
hashWithSalt Int
_salt Subscriber' {Sensitive Text
SubscriptionType
address :: Sensitive Text
subscriptionType :: SubscriptionType
$sel:address:Subscriber' :: Subscriber -> Sensitive Text
$sel:subscriptionType:Subscriber' :: Subscriber -> SubscriptionType
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` SubscriptionType
subscriptionType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
address
instance Prelude.NFData Subscriber where
rnf :: Subscriber -> ()
rnf Subscriber' {Sensitive Text
SubscriptionType
address :: Sensitive Text
subscriptionType :: SubscriptionType
$sel:address:Subscriber' :: Subscriber -> Sensitive Text
$sel:subscriptionType:Subscriber' :: Subscriber -> SubscriptionType
..} =
forall a. NFData a => a -> ()
Prelude.rnf SubscriptionType
subscriptionType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
address
instance Data.ToJSON Subscriber where
toJSON :: Subscriber -> Value
toJSON Subscriber' {Sensitive Text
SubscriptionType
address :: Sensitive Text
subscriptionType :: SubscriptionType
$sel:address:Subscriber' :: Subscriber -> Sensitive Text
$sel:subscriptionType:Subscriber' :: Subscriber -> SubscriptionType
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"SubscriptionType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= SubscriptionType
subscriptionType),
forall a. a -> Maybe a
Prelude.Just (Key
"Address" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
address)
]
)