{-# 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.NotificationWithSubscribers where
import Amazonka.Budgets.Types.Notification
import Amazonka.Budgets.Types.Subscriber
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data NotificationWithSubscribers = NotificationWithSubscribers'
{
NotificationWithSubscribers -> Notification
notification :: Notification,
NotificationWithSubscribers -> NonEmpty Subscriber
subscribers :: Prelude.NonEmpty Subscriber
}
deriving (NotificationWithSubscribers -> NotificationWithSubscribers -> Bool
(NotificationWithSubscribers
-> NotificationWithSubscribers -> Bool)
-> (NotificationWithSubscribers
-> NotificationWithSubscribers -> Bool)
-> Eq NotificationWithSubscribers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NotificationWithSubscribers -> NotificationWithSubscribers -> Bool
$c/= :: NotificationWithSubscribers -> NotificationWithSubscribers -> Bool
== :: NotificationWithSubscribers -> NotificationWithSubscribers -> Bool
$c== :: NotificationWithSubscribers -> NotificationWithSubscribers -> Bool
Prelude.Eq, Int -> NotificationWithSubscribers -> ShowS
[NotificationWithSubscribers] -> ShowS
NotificationWithSubscribers -> String
(Int -> NotificationWithSubscribers -> ShowS)
-> (NotificationWithSubscribers -> String)
-> ([NotificationWithSubscribers] -> ShowS)
-> Show NotificationWithSubscribers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NotificationWithSubscribers] -> ShowS
$cshowList :: [NotificationWithSubscribers] -> ShowS
show :: NotificationWithSubscribers -> String
$cshow :: NotificationWithSubscribers -> String
showsPrec :: Int -> NotificationWithSubscribers -> ShowS
$cshowsPrec :: Int -> NotificationWithSubscribers -> ShowS
Prelude.Show, (forall x.
NotificationWithSubscribers -> Rep NotificationWithSubscribers x)
-> (forall x.
Rep NotificationWithSubscribers x -> NotificationWithSubscribers)
-> Generic NotificationWithSubscribers
forall x.
Rep NotificationWithSubscribers x -> NotificationWithSubscribers
forall x.
NotificationWithSubscribers -> Rep NotificationWithSubscribers x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep NotificationWithSubscribers x -> NotificationWithSubscribers
$cfrom :: forall x.
NotificationWithSubscribers -> Rep NotificationWithSubscribers x
Prelude.Generic)
newNotificationWithSubscribers ::
Notification ->
Prelude.NonEmpty Subscriber ->
NotificationWithSubscribers
newNotificationWithSubscribers :: Notification -> NonEmpty Subscriber -> NotificationWithSubscribers
newNotificationWithSubscribers
Notification
pNotification_
NonEmpty Subscriber
pSubscribers_ =
NotificationWithSubscribers' :: Notification -> NonEmpty Subscriber -> NotificationWithSubscribers
NotificationWithSubscribers'
{ $sel:notification:NotificationWithSubscribers' :: Notification
notification =
Notification
pNotification_,
$sel:subscribers:NotificationWithSubscribers' :: NonEmpty Subscriber
subscribers =
Tagged (NonEmpty Subscriber) (Identity (NonEmpty Subscriber))
-> Tagged (NonEmpty Subscriber) (Identity (NonEmpty Subscriber))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Subscriber) (Identity (NonEmpty Subscriber))
-> Tagged (NonEmpty Subscriber) (Identity (NonEmpty Subscriber)))
-> NonEmpty Subscriber -> NonEmpty Subscriber
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Subscriber
pSubscribers_
}
notificationWithSubscribers_notification :: Lens.Lens' NotificationWithSubscribers Notification
notificationWithSubscribers_notification :: (Notification -> f Notification)
-> NotificationWithSubscribers -> f NotificationWithSubscribers
notificationWithSubscribers_notification = (NotificationWithSubscribers -> Notification)
-> (NotificationWithSubscribers
-> Notification -> NotificationWithSubscribers)
-> Lens
NotificationWithSubscribers
NotificationWithSubscribers
Notification
Notification
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotificationWithSubscribers' {Notification
notification :: Notification
$sel:notification:NotificationWithSubscribers' :: NotificationWithSubscribers -> Notification
notification} -> Notification
notification) (\s :: NotificationWithSubscribers
s@NotificationWithSubscribers' {} Notification
a -> NotificationWithSubscribers
s {$sel:notification:NotificationWithSubscribers' :: Notification
notification = Notification
a} :: NotificationWithSubscribers)
notificationWithSubscribers_subscribers :: Lens.Lens' NotificationWithSubscribers (Prelude.NonEmpty Subscriber)
notificationWithSubscribers_subscribers :: (NonEmpty Subscriber -> f (NonEmpty Subscriber))
-> NotificationWithSubscribers -> f NotificationWithSubscribers
notificationWithSubscribers_subscribers = (NotificationWithSubscribers -> NonEmpty Subscriber)
-> (NotificationWithSubscribers
-> NonEmpty Subscriber -> NotificationWithSubscribers)
-> Lens
NotificationWithSubscribers
NotificationWithSubscribers
(NonEmpty Subscriber)
(NonEmpty Subscriber)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotificationWithSubscribers' {NonEmpty Subscriber
subscribers :: NonEmpty Subscriber
$sel:subscribers:NotificationWithSubscribers' :: NotificationWithSubscribers -> NonEmpty Subscriber
subscribers} -> NonEmpty Subscriber
subscribers) (\s :: NotificationWithSubscribers
s@NotificationWithSubscribers' {} NonEmpty Subscriber
a -> NotificationWithSubscribers
s {$sel:subscribers:NotificationWithSubscribers' :: NonEmpty Subscriber
subscribers = NonEmpty Subscriber
a} :: NotificationWithSubscribers) ((NonEmpty Subscriber -> f (NonEmpty Subscriber))
-> NotificationWithSubscribers -> f NotificationWithSubscribers)
-> ((NonEmpty Subscriber -> f (NonEmpty Subscriber))
-> NonEmpty Subscriber -> f (NonEmpty Subscriber))
-> (NonEmpty Subscriber -> f (NonEmpty Subscriber))
-> NotificationWithSubscribers
-> f NotificationWithSubscribers
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Subscriber -> f (NonEmpty Subscriber))
-> NonEmpty Subscriber -> f (NonEmpty Subscriber)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.Hashable NotificationWithSubscribers
instance Prelude.NFData NotificationWithSubscribers
instance Core.ToJSON NotificationWithSubscribers where
toJSON :: NotificationWithSubscribers -> Value
toJSON NotificationWithSubscribers' {NonEmpty Subscriber
Notification
subscribers :: NonEmpty Subscriber
notification :: Notification
$sel:subscribers:NotificationWithSubscribers' :: NotificationWithSubscribers -> NonEmpty Subscriber
$sel:notification:NotificationWithSubscribers' :: NotificationWithSubscribers -> Notification
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Notification" Text -> Notification -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Notification
notification),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Subscribers" Text -> NonEmpty Subscriber -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Subscriber
subscribers)
]
)