{-# 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.InputTransformer where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data InputTransformer = InputTransformer'
{
InputTransformer -> Maybe (HashMap Text Text)
inputPathsMap :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
InputTransformer -> Text
inputTemplate :: Prelude.Text
}
deriving (InputTransformer -> InputTransformer -> Bool
(InputTransformer -> InputTransformer -> Bool)
-> (InputTransformer -> InputTransformer -> Bool)
-> Eq InputTransformer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputTransformer -> InputTransformer -> Bool
$c/= :: InputTransformer -> InputTransformer -> Bool
== :: InputTransformer -> InputTransformer -> Bool
$c== :: InputTransformer -> InputTransformer -> Bool
Prelude.Eq, ReadPrec [InputTransformer]
ReadPrec InputTransformer
Int -> ReadS InputTransformer
ReadS [InputTransformer]
(Int -> ReadS InputTransformer)
-> ReadS [InputTransformer]
-> ReadPrec InputTransformer
-> ReadPrec [InputTransformer]
-> Read InputTransformer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputTransformer]
$creadListPrec :: ReadPrec [InputTransformer]
readPrec :: ReadPrec InputTransformer
$creadPrec :: ReadPrec InputTransformer
readList :: ReadS [InputTransformer]
$creadList :: ReadS [InputTransformer]
readsPrec :: Int -> ReadS InputTransformer
$creadsPrec :: Int -> ReadS InputTransformer
Prelude.Read, Int -> InputTransformer -> ShowS
[InputTransformer] -> ShowS
InputTransformer -> String
(Int -> InputTransformer -> ShowS)
-> (InputTransformer -> String)
-> ([InputTransformer] -> ShowS)
-> Show InputTransformer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputTransformer] -> ShowS
$cshowList :: [InputTransformer] -> ShowS
show :: InputTransformer -> String
$cshow :: InputTransformer -> String
showsPrec :: Int -> InputTransformer -> ShowS
$cshowsPrec :: Int -> InputTransformer -> ShowS
Prelude.Show, (forall x. InputTransformer -> Rep InputTransformer x)
-> (forall x. Rep InputTransformer x -> InputTransformer)
-> Generic InputTransformer
forall x. Rep InputTransformer x -> InputTransformer
forall x. InputTransformer -> Rep InputTransformer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InputTransformer x -> InputTransformer
$cfrom :: forall x. InputTransformer -> Rep InputTransformer x
Prelude.Generic)
newInputTransformer ::
Prelude.Text ->
InputTransformer
newInputTransformer :: Text -> InputTransformer
newInputTransformer Text
pInputTemplate_ =
InputTransformer' :: Maybe (HashMap Text Text) -> Text -> InputTransformer
InputTransformer'
{ $sel:inputPathsMap:InputTransformer' :: Maybe (HashMap Text Text)
inputPathsMap = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:inputTemplate:InputTransformer' :: Text
inputTemplate = Text
pInputTemplate_
}
inputTransformer_inputPathsMap :: Lens.Lens' InputTransformer (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
inputTransformer_inputPathsMap :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> InputTransformer -> f InputTransformer
inputTransformer_inputPathsMap = (InputTransformer -> Maybe (HashMap Text Text))
-> (InputTransformer
-> Maybe (HashMap Text Text) -> InputTransformer)
-> Lens
InputTransformer
InputTransformer
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputTransformer' {Maybe (HashMap Text Text)
inputPathsMap :: Maybe (HashMap Text Text)
$sel:inputPathsMap:InputTransformer' :: InputTransformer -> Maybe (HashMap Text Text)
inputPathsMap} -> Maybe (HashMap Text Text)
inputPathsMap) (\s :: InputTransformer
s@InputTransformer' {} Maybe (HashMap Text Text)
a -> InputTransformer
s {$sel:inputPathsMap:InputTransformer' :: Maybe (HashMap Text Text)
inputPathsMap = Maybe (HashMap Text Text)
a} :: InputTransformer) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> InputTransformer -> f InputTransformer)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> InputTransformer
-> f InputTransformer
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
inputTransformer_inputTemplate :: Lens.Lens' InputTransformer Prelude.Text
inputTransformer_inputTemplate :: (Text -> f Text) -> InputTransformer -> f InputTransformer
inputTransformer_inputTemplate = (InputTransformer -> Text)
-> (InputTransformer -> Text -> InputTransformer)
-> Lens InputTransformer InputTransformer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputTransformer' {Text
inputTemplate :: Text
$sel:inputTemplate:InputTransformer' :: InputTransformer -> Text
inputTemplate} -> Text
inputTemplate) (\s :: InputTransformer
s@InputTransformer' {} Text
a -> InputTransformer
s {$sel:inputTemplate:InputTransformer' :: Text
inputTemplate = Text
a} :: InputTransformer)
instance Core.FromJSON InputTransformer where
parseJSON :: Value -> Parser InputTransformer
parseJSON =
String
-> (Object -> Parser InputTransformer)
-> Value
-> Parser InputTransformer
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"InputTransformer"
( \Object
x ->
Maybe (HashMap Text Text) -> Text -> InputTransformer
InputTransformer'
(Maybe (HashMap Text Text) -> Text -> InputTransformer)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Text -> InputTransformer)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InputPathsMap" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
Parser (Text -> InputTransformer)
-> Parser Text -> Parser InputTransformer
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"InputTemplate")
)
instance Prelude.Hashable InputTransformer
instance Prelude.NFData InputTransformer
instance Core.ToJSON InputTransformer where
toJSON :: InputTransformer -> Value
toJSON InputTransformer' {Maybe (HashMap Text Text)
Text
inputTemplate :: Text
inputPathsMap :: Maybe (HashMap Text Text)
$sel:inputTemplate:InputTransformer' :: InputTransformer -> Text
$sel:inputPathsMap:InputTransformer' :: InputTransformer -> Maybe (HashMap Text Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"InputPathsMap" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
inputPathsMap,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"InputTemplate" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
inputTemplate)
]
)