{-# 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.ChimeSDKMessaging.Types.LambdaConfiguration where
import Amazonka.ChimeSDKMessaging.Types.InvocationType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data LambdaConfiguration = LambdaConfiguration'
{
LambdaConfiguration -> Text
resourceArn :: Prelude.Text,
LambdaConfiguration -> InvocationType
invocationType :: InvocationType
}
deriving (LambdaConfiguration -> LambdaConfiguration -> Bool
(LambdaConfiguration -> LambdaConfiguration -> Bool)
-> (LambdaConfiguration -> LambdaConfiguration -> Bool)
-> Eq LambdaConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LambdaConfiguration -> LambdaConfiguration -> Bool
$c/= :: LambdaConfiguration -> LambdaConfiguration -> Bool
== :: LambdaConfiguration -> LambdaConfiguration -> Bool
$c== :: LambdaConfiguration -> LambdaConfiguration -> Bool
Prelude.Eq, ReadPrec [LambdaConfiguration]
ReadPrec LambdaConfiguration
Int -> ReadS LambdaConfiguration
ReadS [LambdaConfiguration]
(Int -> ReadS LambdaConfiguration)
-> ReadS [LambdaConfiguration]
-> ReadPrec LambdaConfiguration
-> ReadPrec [LambdaConfiguration]
-> Read LambdaConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LambdaConfiguration]
$creadListPrec :: ReadPrec [LambdaConfiguration]
readPrec :: ReadPrec LambdaConfiguration
$creadPrec :: ReadPrec LambdaConfiguration
readList :: ReadS [LambdaConfiguration]
$creadList :: ReadS [LambdaConfiguration]
readsPrec :: Int -> ReadS LambdaConfiguration
$creadsPrec :: Int -> ReadS LambdaConfiguration
Prelude.Read, Int -> LambdaConfiguration -> ShowS
[LambdaConfiguration] -> ShowS
LambdaConfiguration -> String
(Int -> LambdaConfiguration -> ShowS)
-> (LambdaConfiguration -> String)
-> ([LambdaConfiguration] -> ShowS)
-> Show LambdaConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LambdaConfiguration] -> ShowS
$cshowList :: [LambdaConfiguration] -> ShowS
show :: LambdaConfiguration -> String
$cshow :: LambdaConfiguration -> String
showsPrec :: Int -> LambdaConfiguration -> ShowS
$cshowsPrec :: Int -> LambdaConfiguration -> ShowS
Prelude.Show, (forall x. LambdaConfiguration -> Rep LambdaConfiguration x)
-> (forall x. Rep LambdaConfiguration x -> LambdaConfiguration)
-> Generic LambdaConfiguration
forall x. Rep LambdaConfiguration x -> LambdaConfiguration
forall x. LambdaConfiguration -> Rep LambdaConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LambdaConfiguration x -> LambdaConfiguration
$cfrom :: forall x. LambdaConfiguration -> Rep LambdaConfiguration x
Prelude.Generic)
newLambdaConfiguration ::
Prelude.Text ->
InvocationType ->
LambdaConfiguration
newLambdaConfiguration :: Text -> InvocationType -> LambdaConfiguration
newLambdaConfiguration Text
pResourceArn_ InvocationType
pInvocationType_ =
LambdaConfiguration' :: Text -> InvocationType -> LambdaConfiguration
LambdaConfiguration'
{ $sel:resourceArn:LambdaConfiguration' :: Text
resourceArn = Text
pResourceArn_,
$sel:invocationType:LambdaConfiguration' :: InvocationType
invocationType = InvocationType
pInvocationType_
}
lambdaConfiguration_resourceArn :: Lens.Lens' LambdaConfiguration Prelude.Text
lambdaConfiguration_resourceArn :: (Text -> f Text) -> LambdaConfiguration -> f LambdaConfiguration
lambdaConfiguration_resourceArn = (LambdaConfiguration -> Text)
-> (LambdaConfiguration -> Text -> LambdaConfiguration)
-> Lens LambdaConfiguration LambdaConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaConfiguration' {Text
resourceArn :: Text
$sel:resourceArn:LambdaConfiguration' :: LambdaConfiguration -> Text
resourceArn} -> Text
resourceArn) (\s :: LambdaConfiguration
s@LambdaConfiguration' {} Text
a -> LambdaConfiguration
s {$sel:resourceArn:LambdaConfiguration' :: Text
resourceArn = Text
a} :: LambdaConfiguration)
lambdaConfiguration_invocationType :: Lens.Lens' LambdaConfiguration InvocationType
lambdaConfiguration_invocationType :: (InvocationType -> f InvocationType)
-> LambdaConfiguration -> f LambdaConfiguration
lambdaConfiguration_invocationType = (LambdaConfiguration -> InvocationType)
-> (LambdaConfiguration -> InvocationType -> LambdaConfiguration)
-> Lens
LambdaConfiguration
LambdaConfiguration
InvocationType
InvocationType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaConfiguration' {InvocationType
invocationType :: InvocationType
$sel:invocationType:LambdaConfiguration' :: LambdaConfiguration -> InvocationType
invocationType} -> InvocationType
invocationType) (\s :: LambdaConfiguration
s@LambdaConfiguration' {} InvocationType
a -> LambdaConfiguration
s {$sel:invocationType:LambdaConfiguration' :: InvocationType
invocationType = InvocationType
a} :: LambdaConfiguration)
instance Core.FromJSON LambdaConfiguration where
parseJSON :: Value -> Parser LambdaConfiguration
parseJSON =
String
-> (Object -> Parser LambdaConfiguration)
-> Value
-> Parser LambdaConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"LambdaConfiguration"
( \Object
x ->
Text -> InvocationType -> LambdaConfiguration
LambdaConfiguration'
(Text -> InvocationType -> LambdaConfiguration)
-> Parser Text -> Parser (InvocationType -> LambdaConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ResourceArn")
Parser (InvocationType -> LambdaConfiguration)
-> Parser InvocationType -> Parser LambdaConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser InvocationType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"InvocationType")
)
instance Prelude.Hashable LambdaConfiguration
instance Prelude.NFData LambdaConfiguration
instance Core.ToJSON LambdaConfiguration where
toJSON :: LambdaConfiguration -> Value
toJSON LambdaConfiguration' {Text
InvocationType
invocationType :: InvocationType
resourceArn :: Text
$sel:invocationType:LambdaConfiguration' :: LambdaConfiguration -> InvocationType
$sel:resourceArn:LambdaConfiguration' :: LambdaConfiguration -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"InvocationType" Text -> InvocationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= InvocationType
invocationType)
]
)