{-# 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.FunctionAssociation 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 FunctionAssociation = FunctionAssociation'
{
FunctionAssociation -> Text
functionARN :: Prelude.Text,
FunctionAssociation -> EventType
eventType :: EventType
}
deriving (FunctionAssociation -> FunctionAssociation -> Bool
(FunctionAssociation -> FunctionAssociation -> Bool)
-> (FunctionAssociation -> FunctionAssociation -> Bool)
-> Eq FunctionAssociation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FunctionAssociation -> FunctionAssociation -> Bool
$c/= :: FunctionAssociation -> FunctionAssociation -> Bool
== :: FunctionAssociation -> FunctionAssociation -> Bool
$c== :: FunctionAssociation -> FunctionAssociation -> Bool
Prelude.Eq, ReadPrec [FunctionAssociation]
ReadPrec FunctionAssociation
Int -> ReadS FunctionAssociation
ReadS [FunctionAssociation]
(Int -> ReadS FunctionAssociation)
-> ReadS [FunctionAssociation]
-> ReadPrec FunctionAssociation
-> ReadPrec [FunctionAssociation]
-> Read FunctionAssociation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FunctionAssociation]
$creadListPrec :: ReadPrec [FunctionAssociation]
readPrec :: ReadPrec FunctionAssociation
$creadPrec :: ReadPrec FunctionAssociation
readList :: ReadS [FunctionAssociation]
$creadList :: ReadS [FunctionAssociation]
readsPrec :: Int -> ReadS FunctionAssociation
$creadsPrec :: Int -> ReadS FunctionAssociation
Prelude.Read, Int -> FunctionAssociation -> ShowS
[FunctionAssociation] -> ShowS
FunctionAssociation -> String
(Int -> FunctionAssociation -> ShowS)
-> (FunctionAssociation -> String)
-> ([FunctionAssociation] -> ShowS)
-> Show FunctionAssociation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FunctionAssociation] -> ShowS
$cshowList :: [FunctionAssociation] -> ShowS
show :: FunctionAssociation -> String
$cshow :: FunctionAssociation -> String
showsPrec :: Int -> FunctionAssociation -> ShowS
$cshowsPrec :: Int -> FunctionAssociation -> ShowS
Prelude.Show, (forall x. FunctionAssociation -> Rep FunctionAssociation x)
-> (forall x. Rep FunctionAssociation x -> FunctionAssociation)
-> Generic FunctionAssociation
forall x. Rep FunctionAssociation x -> FunctionAssociation
forall x. FunctionAssociation -> Rep FunctionAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FunctionAssociation x -> FunctionAssociation
$cfrom :: forall x. FunctionAssociation -> Rep FunctionAssociation x
Prelude.Generic)
newFunctionAssociation ::
Prelude.Text ->
EventType ->
FunctionAssociation
newFunctionAssociation :: Text -> EventType -> FunctionAssociation
newFunctionAssociation Text
pFunctionARN_ EventType
pEventType_ =
FunctionAssociation' :: Text -> EventType -> FunctionAssociation
FunctionAssociation'
{ $sel:functionARN:FunctionAssociation' :: Text
functionARN = Text
pFunctionARN_,
$sel:eventType:FunctionAssociation' :: EventType
eventType = EventType
pEventType_
}
functionAssociation_functionARN :: Lens.Lens' FunctionAssociation Prelude.Text
functionAssociation_functionARN :: (Text -> f Text) -> FunctionAssociation -> f FunctionAssociation
functionAssociation_functionARN = (FunctionAssociation -> Text)
-> (FunctionAssociation -> Text -> FunctionAssociation)
-> Lens FunctionAssociation FunctionAssociation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FunctionAssociation' {Text
functionARN :: Text
$sel:functionARN:FunctionAssociation' :: FunctionAssociation -> Text
functionARN} -> Text
functionARN) (\s :: FunctionAssociation
s@FunctionAssociation' {} Text
a -> FunctionAssociation
s {$sel:functionARN:FunctionAssociation' :: Text
functionARN = Text
a} :: FunctionAssociation)
functionAssociation_eventType :: Lens.Lens' FunctionAssociation EventType
functionAssociation_eventType :: (EventType -> f EventType)
-> FunctionAssociation -> f FunctionAssociation
functionAssociation_eventType = (FunctionAssociation -> EventType)
-> (FunctionAssociation -> EventType -> FunctionAssociation)
-> Lens FunctionAssociation FunctionAssociation EventType EventType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FunctionAssociation' {EventType
eventType :: EventType
$sel:eventType:FunctionAssociation' :: FunctionAssociation -> EventType
eventType} -> EventType
eventType) (\s :: FunctionAssociation
s@FunctionAssociation' {} EventType
a -> FunctionAssociation
s {$sel:eventType:FunctionAssociation' :: EventType
eventType = EventType
a} :: FunctionAssociation)
instance Core.FromXML FunctionAssociation where
parseXML :: [Node] -> Either String FunctionAssociation
parseXML [Node]
x =
Text -> EventType -> FunctionAssociation
FunctionAssociation'
(Text -> EventType -> FunctionAssociation)
-> Either String Text
-> Either String (EventType -> FunctionAssociation)
forall (f :: * -> *) a b. Functor 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
"FunctionARN")
Either String (EventType -> FunctionAssociation)
-> Either String EventType -> Either String FunctionAssociation
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 FunctionAssociation
instance Prelude.NFData FunctionAssociation
instance Core.ToXML FunctionAssociation where
toXML :: FunctionAssociation -> XML
toXML FunctionAssociation' {Text
EventType
eventType :: EventType
functionARN :: Text
$sel:eventType:FunctionAssociation' :: FunctionAssociation -> EventType
$sel:functionARN:FunctionAssociation' :: FunctionAssociation -> Text
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"FunctionARN" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
functionARN,
Name
"EventType" Name -> EventType -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= EventType
eventType
]