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