{-# 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.Pinpoint.Types.CampaignHook where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.Mode
import qualified Amazonka.Prelude as Prelude
data CampaignHook = CampaignHook'
{
CampaignHook -> Maybe Text
lambdaFunctionName :: Prelude.Maybe Prelude.Text,
CampaignHook -> Maybe Mode
mode :: Prelude.Maybe Mode,
CampaignHook -> Maybe Text
webUrl :: Prelude.Maybe Prelude.Text
}
deriving (CampaignHook -> CampaignHook -> Bool
(CampaignHook -> CampaignHook -> Bool)
-> (CampaignHook -> CampaignHook -> Bool) -> Eq CampaignHook
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CampaignHook -> CampaignHook -> Bool
$c/= :: CampaignHook -> CampaignHook -> Bool
== :: CampaignHook -> CampaignHook -> Bool
$c== :: CampaignHook -> CampaignHook -> Bool
Prelude.Eq, ReadPrec [CampaignHook]
ReadPrec CampaignHook
Int -> ReadS CampaignHook
ReadS [CampaignHook]
(Int -> ReadS CampaignHook)
-> ReadS [CampaignHook]
-> ReadPrec CampaignHook
-> ReadPrec [CampaignHook]
-> Read CampaignHook
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CampaignHook]
$creadListPrec :: ReadPrec [CampaignHook]
readPrec :: ReadPrec CampaignHook
$creadPrec :: ReadPrec CampaignHook
readList :: ReadS [CampaignHook]
$creadList :: ReadS [CampaignHook]
readsPrec :: Int -> ReadS CampaignHook
$creadsPrec :: Int -> ReadS CampaignHook
Prelude.Read, Int -> CampaignHook -> ShowS
[CampaignHook] -> ShowS
CampaignHook -> String
(Int -> CampaignHook -> ShowS)
-> (CampaignHook -> String)
-> ([CampaignHook] -> ShowS)
-> Show CampaignHook
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CampaignHook] -> ShowS
$cshowList :: [CampaignHook] -> ShowS
show :: CampaignHook -> String
$cshow :: CampaignHook -> String
showsPrec :: Int -> CampaignHook -> ShowS
$cshowsPrec :: Int -> CampaignHook -> ShowS
Prelude.Show, (forall x. CampaignHook -> Rep CampaignHook x)
-> (forall x. Rep CampaignHook x -> CampaignHook)
-> Generic CampaignHook
forall x. Rep CampaignHook x -> CampaignHook
forall x. CampaignHook -> Rep CampaignHook x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CampaignHook x -> CampaignHook
$cfrom :: forall x. CampaignHook -> Rep CampaignHook x
Prelude.Generic)
newCampaignHook ::
CampaignHook
newCampaignHook :: CampaignHook
newCampaignHook =
CampaignHook' :: Maybe Text -> Maybe Mode -> Maybe Text -> CampaignHook
CampaignHook'
{ $sel:lambdaFunctionName:CampaignHook' :: Maybe Text
lambdaFunctionName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:mode:CampaignHook' :: Maybe Mode
mode = Maybe Mode
forall a. Maybe a
Prelude.Nothing,
$sel:webUrl:CampaignHook' :: Maybe Text
webUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
campaignHook_lambdaFunctionName :: Lens.Lens' CampaignHook (Prelude.Maybe Prelude.Text)
campaignHook_lambdaFunctionName :: (Maybe Text -> f (Maybe Text)) -> CampaignHook -> f CampaignHook
campaignHook_lambdaFunctionName = (CampaignHook -> Maybe Text)
-> (CampaignHook -> Maybe Text -> CampaignHook)
-> Lens CampaignHook CampaignHook (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignHook' {Maybe Text
lambdaFunctionName :: Maybe Text
$sel:lambdaFunctionName:CampaignHook' :: CampaignHook -> Maybe Text
lambdaFunctionName} -> Maybe Text
lambdaFunctionName) (\s :: CampaignHook
s@CampaignHook' {} Maybe Text
a -> CampaignHook
s {$sel:lambdaFunctionName:CampaignHook' :: Maybe Text
lambdaFunctionName = Maybe Text
a} :: CampaignHook)
campaignHook_mode :: Lens.Lens' CampaignHook (Prelude.Maybe Mode)
campaignHook_mode :: (Maybe Mode -> f (Maybe Mode)) -> CampaignHook -> f CampaignHook
campaignHook_mode = (CampaignHook -> Maybe Mode)
-> (CampaignHook -> Maybe Mode -> CampaignHook)
-> Lens CampaignHook CampaignHook (Maybe Mode) (Maybe Mode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignHook' {Maybe Mode
mode :: Maybe Mode
$sel:mode:CampaignHook' :: CampaignHook -> Maybe Mode
mode} -> Maybe Mode
mode) (\s :: CampaignHook
s@CampaignHook' {} Maybe Mode
a -> CampaignHook
s {$sel:mode:CampaignHook' :: Maybe Mode
mode = Maybe Mode
a} :: CampaignHook)
campaignHook_webUrl :: Lens.Lens' CampaignHook (Prelude.Maybe Prelude.Text)
campaignHook_webUrl :: (Maybe Text -> f (Maybe Text)) -> CampaignHook -> f CampaignHook
campaignHook_webUrl = (CampaignHook -> Maybe Text)
-> (CampaignHook -> Maybe Text -> CampaignHook)
-> Lens CampaignHook CampaignHook (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignHook' {Maybe Text
webUrl :: Maybe Text
$sel:webUrl:CampaignHook' :: CampaignHook -> Maybe Text
webUrl} -> Maybe Text
webUrl) (\s :: CampaignHook
s@CampaignHook' {} Maybe Text
a -> CampaignHook
s {$sel:webUrl:CampaignHook' :: Maybe Text
webUrl = Maybe Text
a} :: CampaignHook)
instance Core.FromJSON CampaignHook where
parseJSON :: Value -> Parser CampaignHook
parseJSON =
String
-> (Object -> Parser CampaignHook) -> Value -> Parser CampaignHook
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CampaignHook"
( \Object
x ->
Maybe Text -> Maybe Mode -> Maybe Text -> CampaignHook
CampaignHook'
(Maybe Text -> Maybe Mode -> Maybe Text -> CampaignHook)
-> Parser (Maybe Text)
-> Parser (Maybe Mode -> Maybe Text -> CampaignHook)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LambdaFunctionName")
Parser (Maybe Mode -> Maybe Text -> CampaignHook)
-> Parser (Maybe Mode) -> Parser (Maybe Text -> CampaignHook)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Mode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Mode")
Parser (Maybe Text -> CampaignHook)
-> Parser (Maybe Text) -> Parser CampaignHook
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"WebUrl")
)
instance Prelude.Hashable CampaignHook
instance Prelude.NFData CampaignHook
instance Core.ToJSON CampaignHook where
toJSON :: CampaignHook -> Value
toJSON CampaignHook' {Maybe Text
Maybe Mode
webUrl :: Maybe Text
mode :: Maybe Mode
lambdaFunctionName :: Maybe Text
$sel:webUrl:CampaignHook' :: CampaignHook -> Maybe Text
$sel:mode:CampaignHook' :: CampaignHook -> Maybe Mode
$sel:lambdaFunctionName:CampaignHook' :: CampaignHook -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"LambdaFunctionName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
lambdaFunctionName,
(Text
"Mode" Text -> Mode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Mode -> Pair) -> Maybe Mode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Mode
mode,
(Text
"WebUrl" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
webUrl
]
)