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