{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.HoneyCode.Types.ImportDataCharacterEncoding
import qualified Amazonka.Prelude as Prelude
data DelimitedTextImportOptions = DelimitedTextImportOptions'
{
DelimitedTextImportOptions -> Maybe ImportDataCharacterEncoding
dataCharacterEncoding :: Prelude.Maybe ImportDataCharacterEncoding,
:: Prelude.Maybe Prelude.Bool,
DelimitedTextImportOptions -> Maybe Bool
ignoreEmptyRows :: Prelude.Maybe Prelude.Bool,
DelimitedTextImportOptions -> Text
delimiter :: Prelude.Text
}
deriving (DelimitedTextImportOptions -> DelimitedTextImportOptions -> Bool
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]
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
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.
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'
{ $sel:dataCharacterEncoding:DelimitedTextImportOptions' :: Maybe ImportDataCharacterEncoding
dataCharacterEncoding =
forall a. Maybe a
Prelude.Nothing,
$sel:hasHeaderRow:DelimitedTextImportOptions' :: Maybe Bool
hasHeaderRow = forall a. Maybe a
Prelude.Nothing,
$sel:ignoreEmptyRows:DelimitedTextImportOptions' :: Maybe Bool
ignoreEmptyRows = forall a. Maybe a
Prelude.Nothing,
$sel:delimiter:DelimitedTextImportOptions' :: Text
delimiter = Text
pDelimiter_
}
delimitedTextImportOptions_dataCharacterEncoding :: Lens.Lens' DelimitedTextImportOptions (Prelude.Maybe ImportDataCharacterEncoding)
delimitedTextImportOptions_dataCharacterEncoding :: Lens'
DelimitedTextImportOptions (Maybe ImportDataCharacterEncoding)
delimitedTextImportOptions_dataCharacterEncoding = 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_hasHeaderRow :: Lens.Lens' DelimitedTextImportOptions (Prelude.Maybe Prelude.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_ignoreEmptyRows :: Lens.Lens' DelimitedTextImportOptions (Prelude.Maybe Prelude.Bool)
delimitedTextImportOptions_ignoreEmptyRows :: Lens' DelimitedTextImportOptions (Maybe Bool)
delimitedTextImportOptions_ignoreEmptyRows = 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_delimiter :: Lens.Lens' DelimitedTextImportOptions Prelude.Text
delimitedTextImportOptions_delimiter :: Lens' DelimitedTextImportOptions Text
delimitedTextImportOptions_delimiter = 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 Data.FromJSON DelimitedTextImportOptions where
parseJSON :: Value -> Parser DelimitedTextImportOptions
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"DelimitedTextImportOptions"
( \Object
x ->
Maybe ImportDataCharacterEncoding
-> Maybe Bool -> Maybe Bool -> Text -> DelimitedTextImportOptions
DelimitedTextImportOptions'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"dataCharacterEncoding")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"hasHeaderRow")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ignoreEmptyRows")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"delimiter")
)
instance Prelude.Hashable DelimitedTextImportOptions where
hashWithSalt :: Int -> DelimitedTextImportOptions -> Int
hashWithSalt Int
_salt DelimitedTextImportOptions' {Maybe Bool
Maybe ImportDataCharacterEncoding
Text
delimiter :: Text
ignoreEmptyRows :: Maybe Bool
hasHeaderRow :: Maybe Bool
dataCharacterEncoding :: Maybe ImportDataCharacterEncoding
$sel:delimiter:DelimitedTextImportOptions' :: DelimitedTextImportOptions -> Text
$sel:ignoreEmptyRows:DelimitedTextImportOptions' :: DelimitedTextImportOptions -> Maybe Bool
$sel:hasHeaderRow:DelimitedTextImportOptions' :: DelimitedTextImportOptions -> Maybe Bool
$sel:dataCharacterEncoding:DelimitedTextImportOptions' :: DelimitedTextImportOptions -> Maybe ImportDataCharacterEncoding
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ImportDataCharacterEncoding
dataCharacterEncoding
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
hasHeaderRow
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
ignoreEmptyRows
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
delimiter
instance Prelude.NFData DelimitedTextImportOptions where
rnf :: DelimitedTextImportOptions -> ()
rnf DelimitedTextImportOptions' {Maybe Bool
Maybe ImportDataCharacterEncoding
Text
delimiter :: Text
ignoreEmptyRows :: Maybe Bool
hasHeaderRow :: Maybe Bool
dataCharacterEncoding :: Maybe ImportDataCharacterEncoding
$sel:delimiter:DelimitedTextImportOptions' :: DelimitedTextImportOptions -> Text
$sel:ignoreEmptyRows:DelimitedTextImportOptions' :: DelimitedTextImportOptions -> Maybe Bool
$sel:hasHeaderRow:DelimitedTextImportOptions' :: DelimitedTextImportOptions -> Maybe Bool
$sel:dataCharacterEncoding:DelimitedTextImportOptions' :: DelimitedTextImportOptions -> Maybe ImportDataCharacterEncoding
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe ImportDataCharacterEncoding
dataCharacterEncoding
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
hasHeaderRow
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
ignoreEmptyRows
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
delimiter
instance Data.ToJSON DelimitedTextImportOptions where
toJSON :: DelimitedTextImportOptions -> Value
toJSON DelimitedTextImportOptions' {Maybe Bool
Maybe ImportDataCharacterEncoding
Text
delimiter :: Text
ignoreEmptyRows :: Maybe Bool
hasHeaderRow :: Maybe Bool
dataCharacterEncoding :: Maybe ImportDataCharacterEncoding
$sel:delimiter:DelimitedTextImportOptions' :: DelimitedTextImportOptions -> Text
$sel:ignoreEmptyRows:DelimitedTextImportOptions' :: DelimitedTextImportOptions -> Maybe Bool
$sel:hasHeaderRow:DelimitedTextImportOptions' :: DelimitedTextImportOptions -> Maybe Bool
$sel:dataCharacterEncoding:DelimitedTextImportOptions' :: DelimitedTextImportOptions -> Maybe ImportDataCharacterEncoding
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"dataCharacterEncoding" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ImportDataCharacterEncoding
dataCharacterEncoding,
(Key
"hasHeaderRow" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
hasHeaderRow,
(Key
"ignoreEmptyRows" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
ignoreEmptyRows,
forall a. a -> Maybe a
Prelude.Just (Key
"delimiter" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
delimiter)
]
)