{-# 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.CloudFront.Types.LambdaFunctionAssociation where
import Amazonka.CloudFront.Types.EventType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data LambdaFunctionAssociation = LambdaFunctionAssociation'
{
LambdaFunctionAssociation -> Maybe Bool
includeBody :: Prelude.Maybe Prelude.Bool,
LambdaFunctionAssociation -> Text
lambdaFunctionARN :: Prelude.Text,
LambdaFunctionAssociation -> EventType
eventType :: EventType
}
deriving (LambdaFunctionAssociation -> LambdaFunctionAssociation -> Bool
(LambdaFunctionAssociation -> LambdaFunctionAssociation -> Bool)
-> (LambdaFunctionAssociation -> LambdaFunctionAssociation -> Bool)
-> Eq LambdaFunctionAssociation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LambdaFunctionAssociation -> LambdaFunctionAssociation -> Bool
$c/= :: LambdaFunctionAssociation -> LambdaFunctionAssociation -> Bool
== :: LambdaFunctionAssociation -> LambdaFunctionAssociation -> Bool
$c== :: LambdaFunctionAssociation -> LambdaFunctionAssociation -> Bool
Prelude.Eq, ReadPrec [LambdaFunctionAssociation]
ReadPrec LambdaFunctionAssociation
Int -> ReadS LambdaFunctionAssociation
ReadS [LambdaFunctionAssociation]
(Int -> ReadS LambdaFunctionAssociation)
-> ReadS [LambdaFunctionAssociation]
-> ReadPrec LambdaFunctionAssociation
-> ReadPrec [LambdaFunctionAssociation]
-> Read LambdaFunctionAssociation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LambdaFunctionAssociation]
$creadListPrec :: ReadPrec [LambdaFunctionAssociation]
readPrec :: ReadPrec LambdaFunctionAssociation
$creadPrec :: ReadPrec LambdaFunctionAssociation
readList :: ReadS [LambdaFunctionAssociation]
$creadList :: ReadS [LambdaFunctionAssociation]
readsPrec :: Int -> ReadS LambdaFunctionAssociation
$creadsPrec :: Int -> ReadS LambdaFunctionAssociation
Prelude.Read, Int -> LambdaFunctionAssociation -> ShowS
[LambdaFunctionAssociation] -> ShowS
LambdaFunctionAssociation -> String
(Int -> LambdaFunctionAssociation -> ShowS)
-> (LambdaFunctionAssociation -> String)
-> ([LambdaFunctionAssociation] -> ShowS)
-> Show LambdaFunctionAssociation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LambdaFunctionAssociation] -> ShowS
$cshowList :: [LambdaFunctionAssociation] -> ShowS
show :: LambdaFunctionAssociation -> String
$cshow :: LambdaFunctionAssociation -> String
showsPrec :: Int -> LambdaFunctionAssociation -> ShowS
$cshowsPrec :: Int -> LambdaFunctionAssociation -> ShowS
Prelude.Show, (forall x.
LambdaFunctionAssociation -> Rep LambdaFunctionAssociation x)
-> (forall x.
Rep LambdaFunctionAssociation x -> LambdaFunctionAssociation)
-> Generic LambdaFunctionAssociation
forall x.
Rep LambdaFunctionAssociation x -> LambdaFunctionAssociation
forall x.
LambdaFunctionAssociation -> Rep LambdaFunctionAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LambdaFunctionAssociation x -> LambdaFunctionAssociation
$cfrom :: forall x.
LambdaFunctionAssociation -> Rep LambdaFunctionAssociation x
Prelude.Generic)
newLambdaFunctionAssociation ::
Prelude.Text ->
EventType ->
LambdaFunctionAssociation
newLambdaFunctionAssociation :: Text -> EventType -> LambdaFunctionAssociation
newLambdaFunctionAssociation
Text
pLambdaFunctionARN_
EventType
pEventType_ =
LambdaFunctionAssociation' :: Maybe Bool -> Text -> EventType -> LambdaFunctionAssociation
LambdaFunctionAssociation'
{ $sel:includeBody:LambdaFunctionAssociation' :: Maybe Bool
includeBody =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:lambdaFunctionARN:LambdaFunctionAssociation' :: Text
lambdaFunctionARN = Text
pLambdaFunctionARN_,
$sel:eventType:LambdaFunctionAssociation' :: EventType
eventType = EventType
pEventType_
}
lambdaFunctionAssociation_includeBody :: Lens.Lens' LambdaFunctionAssociation (Prelude.Maybe Prelude.Bool)
lambdaFunctionAssociation_includeBody :: (Maybe Bool -> f (Maybe Bool))
-> LambdaFunctionAssociation -> f LambdaFunctionAssociation
lambdaFunctionAssociation_includeBody = (LambdaFunctionAssociation -> Maybe Bool)
-> (LambdaFunctionAssociation
-> Maybe Bool -> LambdaFunctionAssociation)
-> Lens
LambdaFunctionAssociation
LambdaFunctionAssociation
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionAssociation' {Maybe Bool
includeBody :: Maybe Bool
$sel:includeBody:LambdaFunctionAssociation' :: LambdaFunctionAssociation -> Maybe Bool
includeBody} -> Maybe Bool
includeBody) (\s :: LambdaFunctionAssociation
s@LambdaFunctionAssociation' {} Maybe Bool
a -> LambdaFunctionAssociation
s {$sel:includeBody:LambdaFunctionAssociation' :: Maybe Bool
includeBody = Maybe Bool
a} :: LambdaFunctionAssociation)
lambdaFunctionAssociation_lambdaFunctionARN :: Lens.Lens' LambdaFunctionAssociation Prelude.Text
lambdaFunctionAssociation_lambdaFunctionARN :: (Text -> f Text)
-> LambdaFunctionAssociation -> f LambdaFunctionAssociation
lambdaFunctionAssociation_lambdaFunctionARN = (LambdaFunctionAssociation -> Text)
-> (LambdaFunctionAssociation -> Text -> LambdaFunctionAssociation)
-> Lens
LambdaFunctionAssociation LambdaFunctionAssociation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionAssociation' {Text
lambdaFunctionARN :: Text
$sel:lambdaFunctionARN:LambdaFunctionAssociation' :: LambdaFunctionAssociation -> Text
lambdaFunctionARN} -> Text
lambdaFunctionARN) (\s :: LambdaFunctionAssociation
s@LambdaFunctionAssociation' {} Text
a -> LambdaFunctionAssociation
s {$sel:lambdaFunctionARN:LambdaFunctionAssociation' :: Text
lambdaFunctionARN = Text
a} :: LambdaFunctionAssociation)
lambdaFunctionAssociation_eventType :: Lens.Lens' LambdaFunctionAssociation EventType
lambdaFunctionAssociation_eventType :: (EventType -> f EventType)
-> LambdaFunctionAssociation -> f LambdaFunctionAssociation
lambdaFunctionAssociation_eventType = (LambdaFunctionAssociation -> EventType)
-> (LambdaFunctionAssociation
-> EventType -> LambdaFunctionAssociation)
-> Lens
LambdaFunctionAssociation
LambdaFunctionAssociation
EventType
EventType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionAssociation' {EventType
eventType :: EventType
$sel:eventType:LambdaFunctionAssociation' :: LambdaFunctionAssociation -> EventType
eventType} -> EventType
eventType) (\s :: LambdaFunctionAssociation
s@LambdaFunctionAssociation' {} EventType
a -> LambdaFunctionAssociation
s {$sel:eventType:LambdaFunctionAssociation' :: EventType
eventType = EventType
a} :: LambdaFunctionAssociation)
instance Core.FromXML LambdaFunctionAssociation where
parseXML :: [Node] -> Either String LambdaFunctionAssociation
parseXML [Node]
x =
Maybe Bool -> Text -> EventType -> LambdaFunctionAssociation
LambdaFunctionAssociation'
(Maybe Bool -> Text -> EventType -> LambdaFunctionAssociation)
-> Either String (Maybe Bool)
-> Either String (Text -> EventType -> LambdaFunctionAssociation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"IncludeBody")
Either String (Text -> EventType -> LambdaFunctionAssociation)
-> Either String Text
-> Either String (EventType -> LambdaFunctionAssociation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"LambdaFunctionARN")
Either String (EventType -> LambdaFunctionAssociation)
-> Either String EventType
-> Either String LambdaFunctionAssociation
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String EventType
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"EventType")
instance Prelude.Hashable LambdaFunctionAssociation
instance Prelude.NFData LambdaFunctionAssociation
instance Core.ToXML LambdaFunctionAssociation where
toXML :: LambdaFunctionAssociation -> XML
toXML LambdaFunctionAssociation' {Maybe Bool
Text
EventType
eventType :: EventType
lambdaFunctionARN :: Text
includeBody :: Maybe Bool
$sel:eventType:LambdaFunctionAssociation' :: LambdaFunctionAssociation -> EventType
$sel:lambdaFunctionARN:LambdaFunctionAssociation' :: LambdaFunctionAssociation -> Text
$sel:includeBody:LambdaFunctionAssociation' :: LambdaFunctionAssociation -> Maybe Bool
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"IncludeBody" Name -> Maybe Bool -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Bool
includeBody,
Name
"LambdaFunctionARN" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
lambdaFunctionARN,
Name
"EventType" Name -> EventType -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= EventType
eventType
]