{-# 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.DataBrew.Types.CsvOptions where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data CsvOptions = CsvOptions'
{
CsvOptions -> Maybe Text
delimiter :: Prelude.Maybe Prelude.Text,
:: Prelude.Maybe Prelude.Bool
}
deriving (CsvOptions -> CsvOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CsvOptions -> CsvOptions -> Bool
$c/= :: CsvOptions -> CsvOptions -> Bool
== :: CsvOptions -> CsvOptions -> Bool
$c== :: CsvOptions -> CsvOptions -> Bool
Prelude.Eq, ReadPrec [CsvOptions]
ReadPrec CsvOptions
Int -> ReadS CsvOptions
ReadS [CsvOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CsvOptions]
$creadListPrec :: ReadPrec [CsvOptions]
readPrec :: ReadPrec CsvOptions
$creadPrec :: ReadPrec CsvOptions
readList :: ReadS [CsvOptions]
$creadList :: ReadS [CsvOptions]
readsPrec :: Int -> ReadS CsvOptions
$creadsPrec :: Int -> ReadS CsvOptions
Prelude.Read, Int -> CsvOptions -> ShowS
[CsvOptions] -> ShowS
CsvOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CsvOptions] -> ShowS
$cshowList :: [CsvOptions] -> ShowS
show :: CsvOptions -> String
$cshow :: CsvOptions -> String
showsPrec :: Int -> CsvOptions -> ShowS
$cshowsPrec :: Int -> CsvOptions -> ShowS
Prelude.Show, forall x. Rep CsvOptions x -> CsvOptions
forall x. CsvOptions -> Rep CsvOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CsvOptions x -> CsvOptions
$cfrom :: forall x. CsvOptions -> Rep CsvOptions x
Prelude.Generic)
newCsvOptions ::
CsvOptions
newCsvOptions :: CsvOptions
newCsvOptions =
CsvOptions'
{ $sel:delimiter:CsvOptions' :: Maybe Text
delimiter = forall a. Maybe a
Prelude.Nothing,
$sel:headerRow:CsvOptions' :: Maybe Bool
headerRow = forall a. Maybe a
Prelude.Nothing
}
csvOptions_delimiter :: Lens.Lens' CsvOptions (Prelude.Maybe Prelude.Text)
csvOptions_delimiter :: Lens' CsvOptions (Maybe Text)
csvOptions_delimiter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CsvOptions' {Maybe Text
delimiter :: Maybe Text
$sel:delimiter:CsvOptions' :: CsvOptions -> Maybe Text
delimiter} -> Maybe Text
delimiter) (\s :: CsvOptions
s@CsvOptions' {} Maybe Text
a -> CsvOptions
s {$sel:delimiter:CsvOptions' :: Maybe Text
delimiter = Maybe Text
a} :: CsvOptions)
csvOptions_headerRow :: Lens.Lens' CsvOptions (Prelude.Maybe Prelude.Bool)
= forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CsvOptions' {Maybe Bool
headerRow :: Maybe Bool
$sel:headerRow:CsvOptions' :: CsvOptions -> Maybe Bool
headerRow} -> Maybe Bool
headerRow) (\s :: CsvOptions
s@CsvOptions' {} Maybe Bool
a -> CsvOptions
s {$sel:headerRow:CsvOptions' :: Maybe Bool
headerRow = Maybe Bool
a} :: CsvOptions)
instance Data.FromJSON CsvOptions where
parseJSON :: Value -> Parser CsvOptions
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CsvOptions"
( \Object
x ->
Maybe Text -> Maybe Bool -> CsvOptions
CsvOptions'
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
"Delimiter")
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
"HeaderRow")
)
instance Prelude.Hashable CsvOptions where
hashWithSalt :: Int -> CsvOptions -> Int
hashWithSalt Int
_salt CsvOptions' {Maybe Bool
Maybe Text
headerRow :: Maybe Bool
delimiter :: Maybe Text
$sel:headerRow:CsvOptions' :: CsvOptions -> Maybe Bool
$sel:delimiter:CsvOptions' :: CsvOptions -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
delimiter
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
headerRow
instance Prelude.NFData CsvOptions where
rnf :: CsvOptions -> ()
rnf CsvOptions' {Maybe Bool
Maybe Text
headerRow :: Maybe Bool
delimiter :: Maybe Text
$sel:headerRow:CsvOptions' :: CsvOptions -> Maybe Bool
$sel:delimiter:CsvOptions' :: CsvOptions -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
delimiter
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
headerRow
instance Data.ToJSON CsvOptions where
toJSON :: CsvOptions -> Value
toJSON CsvOptions' {Maybe Bool
Maybe Text
headerRow :: Maybe Bool
delimiter :: Maybe Text
$sel:headerRow:CsvOptions' :: CsvOptions -> Maybe Bool
$sel:delimiter:CsvOptions' :: CsvOptions -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Delimiter" 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 Text
delimiter,
(Key
"HeaderRow" 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
headerRow
]
)