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