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