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