{-# 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.GreengrassV2.Types.LambdaEventSource where
import qualified Amazonka.Core as Core
import Amazonka.GreengrassV2.Types.LambdaEventSourceType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data LambdaEventSource = LambdaEventSource'
{
LambdaEventSource -> Text
topic :: Prelude.Text,
LambdaEventSource -> LambdaEventSourceType
type' :: LambdaEventSourceType
}
deriving (LambdaEventSource -> LambdaEventSource -> Bool
(LambdaEventSource -> LambdaEventSource -> Bool)
-> (LambdaEventSource -> LambdaEventSource -> Bool)
-> Eq LambdaEventSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LambdaEventSource -> LambdaEventSource -> Bool
$c/= :: LambdaEventSource -> LambdaEventSource -> Bool
== :: LambdaEventSource -> LambdaEventSource -> Bool
$c== :: LambdaEventSource -> LambdaEventSource -> Bool
Prelude.Eq, ReadPrec [LambdaEventSource]
ReadPrec LambdaEventSource
Int -> ReadS LambdaEventSource
ReadS [LambdaEventSource]
(Int -> ReadS LambdaEventSource)
-> ReadS [LambdaEventSource]
-> ReadPrec LambdaEventSource
-> ReadPrec [LambdaEventSource]
-> Read LambdaEventSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LambdaEventSource]
$creadListPrec :: ReadPrec [LambdaEventSource]
readPrec :: ReadPrec LambdaEventSource
$creadPrec :: ReadPrec LambdaEventSource
readList :: ReadS [LambdaEventSource]
$creadList :: ReadS [LambdaEventSource]
readsPrec :: Int -> ReadS LambdaEventSource
$creadsPrec :: Int -> ReadS LambdaEventSource
Prelude.Read, Int -> LambdaEventSource -> ShowS
[LambdaEventSource] -> ShowS
LambdaEventSource -> String
(Int -> LambdaEventSource -> ShowS)
-> (LambdaEventSource -> String)
-> ([LambdaEventSource] -> ShowS)
-> Show LambdaEventSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LambdaEventSource] -> ShowS
$cshowList :: [LambdaEventSource] -> ShowS
show :: LambdaEventSource -> String
$cshow :: LambdaEventSource -> String
showsPrec :: Int -> LambdaEventSource -> ShowS
$cshowsPrec :: Int -> LambdaEventSource -> ShowS
Prelude.Show, (forall x. LambdaEventSource -> Rep LambdaEventSource x)
-> (forall x. Rep LambdaEventSource x -> LambdaEventSource)
-> Generic LambdaEventSource
forall x. Rep LambdaEventSource x -> LambdaEventSource
forall x. LambdaEventSource -> Rep LambdaEventSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LambdaEventSource x -> LambdaEventSource
$cfrom :: forall x. LambdaEventSource -> Rep LambdaEventSource x
Prelude.Generic)
newLambdaEventSource ::
Prelude.Text ->
LambdaEventSourceType ->
LambdaEventSource
newLambdaEventSource :: Text -> LambdaEventSourceType -> LambdaEventSource
newLambdaEventSource Text
pTopic_ LambdaEventSourceType
pType_ =
LambdaEventSource' :: Text -> LambdaEventSourceType -> LambdaEventSource
LambdaEventSource' {$sel:topic:LambdaEventSource' :: Text
topic = Text
pTopic_, $sel:type':LambdaEventSource' :: LambdaEventSourceType
type' = LambdaEventSourceType
pType_}
lambdaEventSource_topic :: Lens.Lens' LambdaEventSource Prelude.Text
lambdaEventSource_topic :: (Text -> f Text) -> LambdaEventSource -> f LambdaEventSource
lambdaEventSource_topic = (LambdaEventSource -> Text)
-> (LambdaEventSource -> Text -> LambdaEventSource)
-> Lens LambdaEventSource LambdaEventSource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaEventSource' {Text
topic :: Text
$sel:topic:LambdaEventSource' :: LambdaEventSource -> Text
topic} -> Text
topic) (\s :: LambdaEventSource
s@LambdaEventSource' {} Text
a -> LambdaEventSource
s {$sel:topic:LambdaEventSource' :: Text
topic = Text
a} :: LambdaEventSource)
lambdaEventSource_type :: Lens.Lens' LambdaEventSource LambdaEventSourceType
lambdaEventSource_type :: (LambdaEventSourceType -> f LambdaEventSourceType)
-> LambdaEventSource -> f LambdaEventSource
lambdaEventSource_type = (LambdaEventSource -> LambdaEventSourceType)
-> (LambdaEventSource
-> LambdaEventSourceType -> LambdaEventSource)
-> Lens
LambdaEventSource
LambdaEventSource
LambdaEventSourceType
LambdaEventSourceType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaEventSource' {LambdaEventSourceType
type' :: LambdaEventSourceType
$sel:type':LambdaEventSource' :: LambdaEventSource -> LambdaEventSourceType
type'} -> LambdaEventSourceType
type') (\s :: LambdaEventSource
s@LambdaEventSource' {} LambdaEventSourceType
a -> LambdaEventSource
s {$sel:type':LambdaEventSource' :: LambdaEventSourceType
type' = LambdaEventSourceType
a} :: LambdaEventSource)
instance Prelude.Hashable LambdaEventSource
instance Prelude.NFData LambdaEventSource
instance Core.ToJSON LambdaEventSource where
toJSON :: LambdaEventSource -> Value
toJSON LambdaEventSource' {Text
LambdaEventSourceType
type' :: LambdaEventSourceType
topic :: Text
$sel:type':LambdaEventSource' :: LambdaEventSource -> LambdaEventSourceType
$sel:topic:LambdaEventSource' :: LambdaEventSource -> 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
"topic" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
topic),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"type" Text -> LambdaEventSourceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= LambdaEventSourceType
type')
]
)