{-# 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.FunctionConfig where
import Amazonka.CloudFront.Types.FunctionRuntime
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data FunctionConfig = FunctionConfig'
{
:: Prelude.Text,
FunctionConfig -> FunctionRuntime
runtime :: FunctionRuntime
}
deriving (FunctionConfig -> FunctionConfig -> Bool
(FunctionConfig -> FunctionConfig -> Bool)
-> (FunctionConfig -> FunctionConfig -> Bool) -> Eq FunctionConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FunctionConfig -> FunctionConfig -> Bool
$c/= :: FunctionConfig -> FunctionConfig -> Bool
== :: FunctionConfig -> FunctionConfig -> Bool
$c== :: FunctionConfig -> FunctionConfig -> Bool
Prelude.Eq, ReadPrec [FunctionConfig]
ReadPrec FunctionConfig
Int -> ReadS FunctionConfig
ReadS [FunctionConfig]
(Int -> ReadS FunctionConfig)
-> ReadS [FunctionConfig]
-> ReadPrec FunctionConfig
-> ReadPrec [FunctionConfig]
-> Read FunctionConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FunctionConfig]
$creadListPrec :: ReadPrec [FunctionConfig]
readPrec :: ReadPrec FunctionConfig
$creadPrec :: ReadPrec FunctionConfig
readList :: ReadS [FunctionConfig]
$creadList :: ReadS [FunctionConfig]
readsPrec :: Int -> ReadS FunctionConfig
$creadsPrec :: Int -> ReadS FunctionConfig
Prelude.Read, Int -> FunctionConfig -> ShowS
[FunctionConfig] -> ShowS
FunctionConfig -> String
(Int -> FunctionConfig -> ShowS)
-> (FunctionConfig -> String)
-> ([FunctionConfig] -> ShowS)
-> Show FunctionConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FunctionConfig] -> ShowS
$cshowList :: [FunctionConfig] -> ShowS
show :: FunctionConfig -> String
$cshow :: FunctionConfig -> String
showsPrec :: Int -> FunctionConfig -> ShowS
$cshowsPrec :: Int -> FunctionConfig -> ShowS
Prelude.Show, (forall x. FunctionConfig -> Rep FunctionConfig x)
-> (forall x. Rep FunctionConfig x -> FunctionConfig)
-> Generic FunctionConfig
forall x. Rep FunctionConfig x -> FunctionConfig
forall x. FunctionConfig -> Rep FunctionConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FunctionConfig x -> FunctionConfig
$cfrom :: forall x. FunctionConfig -> Rep FunctionConfig x
Prelude.Generic)
newFunctionConfig ::
Prelude.Text ->
FunctionRuntime ->
FunctionConfig
newFunctionConfig :: Text -> FunctionRuntime -> FunctionConfig
newFunctionConfig Text
pComment_ FunctionRuntime
pRuntime_ =
FunctionConfig' :: Text -> FunctionRuntime -> FunctionConfig
FunctionConfig'
{ $sel:comment:FunctionConfig' :: Text
comment = Text
pComment_,
$sel:runtime:FunctionConfig' :: FunctionRuntime
runtime = FunctionRuntime
pRuntime_
}
functionConfig_comment :: Lens.Lens' FunctionConfig Prelude.Text
= (FunctionConfig -> Text)
-> (FunctionConfig -> Text -> FunctionConfig)
-> Lens FunctionConfig FunctionConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FunctionConfig' {Text
comment :: Text
$sel:comment:FunctionConfig' :: FunctionConfig -> Text
comment} -> Text
comment) (\s :: FunctionConfig
s@FunctionConfig' {} Text
a -> FunctionConfig
s {$sel:comment:FunctionConfig' :: Text
comment = Text
a} :: FunctionConfig)
functionConfig_runtime :: Lens.Lens' FunctionConfig FunctionRuntime
functionConfig_runtime :: (FunctionRuntime -> f FunctionRuntime)
-> FunctionConfig -> f FunctionConfig
functionConfig_runtime = (FunctionConfig -> FunctionRuntime)
-> (FunctionConfig -> FunctionRuntime -> FunctionConfig)
-> Lens
FunctionConfig FunctionConfig FunctionRuntime FunctionRuntime
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FunctionConfig' {FunctionRuntime
runtime :: FunctionRuntime
$sel:runtime:FunctionConfig' :: FunctionConfig -> FunctionRuntime
runtime} -> FunctionRuntime
runtime) (\s :: FunctionConfig
s@FunctionConfig' {} FunctionRuntime
a -> FunctionConfig
s {$sel:runtime:FunctionConfig' :: FunctionRuntime
runtime = FunctionRuntime
a} :: FunctionConfig)
instance Core.FromXML FunctionConfig where
parseXML :: [Node] -> Either String FunctionConfig
parseXML [Node]
x =
Text -> FunctionRuntime -> FunctionConfig
FunctionConfig'
(Text -> FunctionRuntime -> FunctionConfig)
-> Either String Text
-> Either String (FunctionRuntime -> FunctionConfig)
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
"Comment")
Either String (FunctionRuntime -> FunctionConfig)
-> Either String FunctionRuntime -> Either String FunctionConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String FunctionRuntime
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Runtime")
instance Prelude.Hashable FunctionConfig
instance Prelude.NFData FunctionConfig
instance Core.ToXML FunctionConfig where
toXML :: FunctionConfig -> XML
toXML FunctionConfig' {Text
FunctionRuntime
runtime :: FunctionRuntime
comment :: Text
$sel:runtime:FunctionConfig' :: FunctionConfig -> FunctionRuntime
$sel:comment:FunctionConfig' :: FunctionConfig -> Text
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"Comment" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
comment,
Name
"Runtime" Name -> FunctionRuntime -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= FunctionRuntime
runtime
]