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