{-# 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.LookoutMetrics.Types.CsvFormatDescriptor where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LookoutMetrics.Types.CSVFileCompression
import qualified Amazonka.Prelude as Prelude
data CsvFormatDescriptor = CsvFormatDescriptor'
{
CsvFormatDescriptor -> Maybe Text
quoteSymbol :: Prelude.Maybe Prelude.Text,
:: Prelude.Maybe Prelude.Bool,
CsvFormatDescriptor -> Maybe Text
charset :: Prelude.Maybe Prelude.Text,
:: Prelude.Maybe [Prelude.Text],
CsvFormatDescriptor -> Maybe CSVFileCompression
fileCompression :: Prelude.Maybe CSVFileCompression,
CsvFormatDescriptor -> Maybe Text
delimiter :: Prelude.Maybe Prelude.Text
}
deriving (CsvFormatDescriptor -> CsvFormatDescriptor -> Bool
(CsvFormatDescriptor -> CsvFormatDescriptor -> Bool)
-> (CsvFormatDescriptor -> CsvFormatDescriptor -> Bool)
-> Eq CsvFormatDescriptor
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CsvFormatDescriptor -> CsvFormatDescriptor -> Bool
$c/= :: CsvFormatDescriptor -> CsvFormatDescriptor -> Bool
== :: CsvFormatDescriptor -> CsvFormatDescriptor -> Bool
$c== :: CsvFormatDescriptor -> CsvFormatDescriptor -> Bool
Prelude.Eq, ReadPrec [CsvFormatDescriptor]
ReadPrec CsvFormatDescriptor
Int -> ReadS CsvFormatDescriptor
ReadS [CsvFormatDescriptor]
(Int -> ReadS CsvFormatDescriptor)
-> ReadS [CsvFormatDescriptor]
-> ReadPrec CsvFormatDescriptor
-> ReadPrec [CsvFormatDescriptor]
-> Read CsvFormatDescriptor
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CsvFormatDescriptor]
$creadListPrec :: ReadPrec [CsvFormatDescriptor]
readPrec :: ReadPrec CsvFormatDescriptor
$creadPrec :: ReadPrec CsvFormatDescriptor
readList :: ReadS [CsvFormatDescriptor]
$creadList :: ReadS [CsvFormatDescriptor]
readsPrec :: Int -> ReadS CsvFormatDescriptor
$creadsPrec :: Int -> ReadS CsvFormatDescriptor
Prelude.Read, Int -> CsvFormatDescriptor -> ShowS
[CsvFormatDescriptor] -> ShowS
CsvFormatDescriptor -> String
(Int -> CsvFormatDescriptor -> ShowS)
-> (CsvFormatDescriptor -> String)
-> ([CsvFormatDescriptor] -> ShowS)
-> Show CsvFormatDescriptor
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CsvFormatDescriptor] -> ShowS
$cshowList :: [CsvFormatDescriptor] -> ShowS
show :: CsvFormatDescriptor -> String
$cshow :: CsvFormatDescriptor -> String
showsPrec :: Int -> CsvFormatDescriptor -> ShowS
$cshowsPrec :: Int -> CsvFormatDescriptor -> ShowS
Prelude.Show, (forall x. CsvFormatDescriptor -> Rep CsvFormatDescriptor x)
-> (forall x. Rep CsvFormatDescriptor x -> CsvFormatDescriptor)
-> Generic CsvFormatDescriptor
forall x. Rep CsvFormatDescriptor x -> CsvFormatDescriptor
forall x. CsvFormatDescriptor -> Rep CsvFormatDescriptor x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CsvFormatDescriptor x -> CsvFormatDescriptor
$cfrom :: forall x. CsvFormatDescriptor -> Rep CsvFormatDescriptor x
Prelude.Generic)
newCsvFormatDescriptor ::
CsvFormatDescriptor
newCsvFormatDescriptor :: CsvFormatDescriptor
newCsvFormatDescriptor =
CsvFormatDescriptor' :: Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe [Text]
-> Maybe CSVFileCompression
-> Maybe Text
-> CsvFormatDescriptor
CsvFormatDescriptor'
{ $sel:quoteSymbol:CsvFormatDescriptor' :: Maybe Text
quoteSymbol = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:containsHeader:CsvFormatDescriptor' :: Maybe Bool
containsHeader = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:charset:CsvFormatDescriptor' :: Maybe Text
charset = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:headerList:CsvFormatDescriptor' :: Maybe [Text]
headerList = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:fileCompression:CsvFormatDescriptor' :: Maybe CSVFileCompression
fileCompression = Maybe CSVFileCompression
forall a. Maybe a
Prelude.Nothing,
$sel:delimiter:CsvFormatDescriptor' :: Maybe Text
delimiter = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
csvFormatDescriptor_quoteSymbol :: Lens.Lens' CsvFormatDescriptor (Prelude.Maybe Prelude.Text)
csvFormatDescriptor_quoteSymbol :: (Maybe Text -> f (Maybe Text))
-> CsvFormatDescriptor -> f CsvFormatDescriptor
csvFormatDescriptor_quoteSymbol = (CsvFormatDescriptor -> Maybe Text)
-> (CsvFormatDescriptor -> Maybe Text -> CsvFormatDescriptor)
-> Lens
CsvFormatDescriptor CsvFormatDescriptor (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CsvFormatDescriptor' {Maybe Text
quoteSymbol :: Maybe Text
$sel:quoteSymbol:CsvFormatDescriptor' :: CsvFormatDescriptor -> Maybe Text
quoteSymbol} -> Maybe Text
quoteSymbol) (\s :: CsvFormatDescriptor
s@CsvFormatDescriptor' {} Maybe Text
a -> CsvFormatDescriptor
s {$sel:quoteSymbol:CsvFormatDescriptor' :: Maybe Text
quoteSymbol = Maybe Text
a} :: CsvFormatDescriptor)
csvFormatDescriptor_containsHeader :: Lens.Lens' CsvFormatDescriptor (Prelude.Maybe Prelude.Bool)
= (CsvFormatDescriptor -> Maybe Bool)
-> (CsvFormatDescriptor -> Maybe Bool -> CsvFormatDescriptor)
-> Lens
CsvFormatDescriptor CsvFormatDescriptor (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CsvFormatDescriptor' {Maybe Bool
containsHeader :: Maybe Bool
$sel:containsHeader:CsvFormatDescriptor' :: CsvFormatDescriptor -> Maybe Bool
containsHeader} -> Maybe Bool
containsHeader) (\s :: CsvFormatDescriptor
s@CsvFormatDescriptor' {} Maybe Bool
a -> CsvFormatDescriptor
s {$sel:containsHeader:CsvFormatDescriptor' :: Maybe Bool
containsHeader = Maybe Bool
a} :: CsvFormatDescriptor)
csvFormatDescriptor_charset :: Lens.Lens' CsvFormatDescriptor (Prelude.Maybe Prelude.Text)
csvFormatDescriptor_charset :: (Maybe Text -> f (Maybe Text))
-> CsvFormatDescriptor -> f CsvFormatDescriptor
csvFormatDescriptor_charset = (CsvFormatDescriptor -> Maybe Text)
-> (CsvFormatDescriptor -> Maybe Text -> CsvFormatDescriptor)
-> Lens
CsvFormatDescriptor CsvFormatDescriptor (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CsvFormatDescriptor' {Maybe Text
charset :: Maybe Text
$sel:charset:CsvFormatDescriptor' :: CsvFormatDescriptor -> Maybe Text
charset} -> Maybe Text
charset) (\s :: CsvFormatDescriptor
s@CsvFormatDescriptor' {} Maybe Text
a -> CsvFormatDescriptor
s {$sel:charset:CsvFormatDescriptor' :: Maybe Text
charset = Maybe Text
a} :: CsvFormatDescriptor)
csvFormatDescriptor_headerList :: Lens.Lens' CsvFormatDescriptor (Prelude.Maybe [Prelude.Text])
= (CsvFormatDescriptor -> Maybe [Text])
-> (CsvFormatDescriptor -> Maybe [Text] -> CsvFormatDescriptor)
-> Lens
CsvFormatDescriptor
CsvFormatDescriptor
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CsvFormatDescriptor' {Maybe [Text]
headerList :: Maybe [Text]
$sel:headerList:CsvFormatDescriptor' :: CsvFormatDescriptor -> Maybe [Text]
headerList} -> Maybe [Text]
headerList) (\s :: CsvFormatDescriptor
s@CsvFormatDescriptor' {} Maybe [Text]
a -> CsvFormatDescriptor
s {$sel:headerList:CsvFormatDescriptor' :: Maybe [Text]
headerList = Maybe [Text]
a} :: CsvFormatDescriptor) ((Maybe [Text] -> f (Maybe [Text]))
-> CsvFormatDescriptor -> f CsvFormatDescriptor)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CsvFormatDescriptor
-> f CsvFormatDescriptor
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
csvFormatDescriptor_fileCompression :: Lens.Lens' CsvFormatDescriptor (Prelude.Maybe CSVFileCompression)
csvFormatDescriptor_fileCompression :: (Maybe CSVFileCompression -> f (Maybe CSVFileCompression))
-> CsvFormatDescriptor -> f CsvFormatDescriptor
csvFormatDescriptor_fileCompression = (CsvFormatDescriptor -> Maybe CSVFileCompression)
-> (CsvFormatDescriptor
-> Maybe CSVFileCompression -> CsvFormatDescriptor)
-> Lens
CsvFormatDescriptor
CsvFormatDescriptor
(Maybe CSVFileCompression)
(Maybe CSVFileCompression)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CsvFormatDescriptor' {Maybe CSVFileCompression
fileCompression :: Maybe CSVFileCompression
$sel:fileCompression:CsvFormatDescriptor' :: CsvFormatDescriptor -> Maybe CSVFileCompression
fileCompression} -> Maybe CSVFileCompression
fileCompression) (\s :: CsvFormatDescriptor
s@CsvFormatDescriptor' {} Maybe CSVFileCompression
a -> CsvFormatDescriptor
s {$sel:fileCompression:CsvFormatDescriptor' :: Maybe CSVFileCompression
fileCompression = Maybe CSVFileCompression
a} :: CsvFormatDescriptor)
csvFormatDescriptor_delimiter :: Lens.Lens' CsvFormatDescriptor (Prelude.Maybe Prelude.Text)
csvFormatDescriptor_delimiter :: (Maybe Text -> f (Maybe Text))
-> CsvFormatDescriptor -> f CsvFormatDescriptor
csvFormatDescriptor_delimiter = (CsvFormatDescriptor -> Maybe Text)
-> (CsvFormatDescriptor -> Maybe Text -> CsvFormatDescriptor)
-> Lens
CsvFormatDescriptor CsvFormatDescriptor (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CsvFormatDescriptor' {Maybe Text
delimiter :: Maybe Text
$sel:delimiter:CsvFormatDescriptor' :: CsvFormatDescriptor -> Maybe Text
delimiter} -> Maybe Text
delimiter) (\s :: CsvFormatDescriptor
s@CsvFormatDescriptor' {} Maybe Text
a -> CsvFormatDescriptor
s {$sel:delimiter:CsvFormatDescriptor' :: Maybe Text
delimiter = Maybe Text
a} :: CsvFormatDescriptor)
instance Core.FromJSON CsvFormatDescriptor where
parseJSON :: Value -> Parser CsvFormatDescriptor
parseJSON =
String
-> (Object -> Parser CsvFormatDescriptor)
-> Value
-> Parser CsvFormatDescriptor
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CsvFormatDescriptor"
( \Object
x ->
Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe [Text]
-> Maybe CSVFileCompression
-> Maybe Text
-> CsvFormatDescriptor
CsvFormatDescriptor'
(Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe [Text]
-> Maybe CSVFileCompression
-> Maybe Text
-> CsvFormatDescriptor)
-> Parser (Maybe Text)
-> Parser
(Maybe Bool
-> Maybe Text
-> Maybe [Text]
-> Maybe CSVFileCompression
-> Maybe Text
-> CsvFormatDescriptor)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"QuoteSymbol")
Parser
(Maybe Bool
-> Maybe Text
-> Maybe [Text]
-> Maybe CSVFileCompression
-> Maybe Text
-> CsvFormatDescriptor)
-> Parser (Maybe Bool)
-> Parser
(Maybe Text
-> Maybe [Text]
-> Maybe CSVFileCompression
-> Maybe Text
-> CsvFormatDescriptor)
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
"ContainsHeader")
Parser
(Maybe Text
-> Maybe [Text]
-> Maybe CSVFileCompression
-> Maybe Text
-> CsvFormatDescriptor)
-> Parser (Maybe Text)
-> Parser
(Maybe [Text]
-> Maybe CSVFileCompression -> Maybe Text -> CsvFormatDescriptor)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Charset")
Parser
(Maybe [Text]
-> Maybe CSVFileCompression -> Maybe Text -> CsvFormatDescriptor)
-> Parser (Maybe [Text])
-> Parser
(Maybe CSVFileCompression -> Maybe Text -> CsvFormatDescriptor)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"HeaderList" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe CSVFileCompression -> Maybe Text -> CsvFormatDescriptor)
-> Parser (Maybe CSVFileCompression)
-> Parser (Maybe Text -> CsvFormatDescriptor)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CSVFileCompression)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FileCompression")
Parser (Maybe Text -> CsvFormatDescriptor)
-> Parser (Maybe Text) -> Parser CsvFormatDescriptor
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Delimiter")
)
instance Prelude.Hashable CsvFormatDescriptor
instance Prelude.NFData CsvFormatDescriptor
instance Core.ToJSON CsvFormatDescriptor where
toJSON :: CsvFormatDescriptor -> Value
toJSON CsvFormatDescriptor' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe CSVFileCompression
delimiter :: Maybe Text
fileCompression :: Maybe CSVFileCompression
headerList :: Maybe [Text]
charset :: Maybe Text
containsHeader :: Maybe Bool
quoteSymbol :: Maybe Text
$sel:delimiter:CsvFormatDescriptor' :: CsvFormatDescriptor -> Maybe Text
$sel:fileCompression:CsvFormatDescriptor' :: CsvFormatDescriptor -> Maybe CSVFileCompression
$sel:headerList:CsvFormatDescriptor' :: CsvFormatDescriptor -> Maybe [Text]
$sel:charset:CsvFormatDescriptor' :: CsvFormatDescriptor -> Maybe Text
$sel:containsHeader:CsvFormatDescriptor' :: CsvFormatDescriptor -> Maybe Bool
$sel:quoteSymbol:CsvFormatDescriptor' :: CsvFormatDescriptor -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"QuoteSymbol" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
quoteSymbol,
(Text
"ContainsHeader" 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
containsHeader,
(Text
"Charset" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
charset,
(Text
"HeaderList" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
headerList,
(Text
"FileCompression" Text -> CSVFileCompression -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(CSVFileCompression -> Pair)
-> Maybe CSVFileCompression -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CSVFileCompression
fileCompression,
(Text
"Delimiter" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
delimiter
]
)