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