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