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