{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:lambdaFunctionName:CampaignHook' :: Maybe Text
lambdaFunctionName = forall a. Maybe a
Prelude.Nothing,
$sel:mode:CampaignHook' :: Maybe Mode
mode = forall a. Maybe a
Prelude.Nothing,
$sel:webUrl:CampaignHook' :: Maybe Text
webUrl = forall a. Maybe a
Prelude.Nothing
}
campaignHook_lambdaFunctionName :: Lens.Lens' CampaignHook (Prelude.Maybe Prelude.Text)
campaignHook_lambdaFunctionName :: Lens' CampaignHook (Maybe Text)
campaignHook_lambdaFunctionName = 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 :: Lens' CampaignHook (Maybe Mode)
campaignHook_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 :: Lens' CampaignHook (Maybe Text)
campaignHook_webUrl = 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 Data.FromJSON CampaignHook where
parseJSON :: Value -> Parser CampaignHook
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CampaignHook"
( \Object
x ->
Maybe Text -> Maybe Mode -> Maybe Text -> CampaignHook
CampaignHook'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LambdaFunctionName")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Mode")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"WebUrl")
)
instance Prelude.Hashable CampaignHook where
hashWithSalt :: Int -> CampaignHook -> Int
hashWithSalt Int
_salt 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
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lambdaFunctionName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Mode
mode
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
webUrl
instance Prelude.NFData CampaignHook where
rnf :: CampaignHook -> ()
rnf 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
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lambdaFunctionName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Mode
mode
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
webUrl
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"LambdaFunctionName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
lambdaFunctionName,
(Key
"Mode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Mode
mode,
(Key
"WebUrl" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
webUrl
]
)