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