{-# 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.Glacier.Types.CSVInput where
import qualified Amazonka.Core as Core
import Amazonka.Glacier.Types.FileHeaderInfo
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CSVInput = CSVInput'
{
CSVInput -> Maybe Text
quoteCharacter :: Prelude.Maybe Prelude.Text,
CSVInput -> Maybe Text
recordDelimiter :: Prelude.Maybe Prelude.Text,
:: Prelude.Maybe FileHeaderInfo,
CSVInput -> Maybe Text
quoteEscapeCharacter :: Prelude.Maybe Prelude.Text,
:: Prelude.Maybe Prelude.Text,
CSVInput -> Maybe Text
fieldDelimiter :: Prelude.Maybe Prelude.Text
}
deriving (CSVInput -> CSVInput -> Bool
(CSVInput -> CSVInput -> Bool)
-> (CSVInput -> CSVInput -> Bool) -> Eq CSVInput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CSVInput -> CSVInput -> Bool
$c/= :: CSVInput -> CSVInput -> Bool
== :: CSVInput -> CSVInput -> Bool
$c== :: CSVInput -> CSVInput -> Bool
Prelude.Eq, ReadPrec [CSVInput]
ReadPrec CSVInput
Int -> ReadS CSVInput
ReadS [CSVInput]
(Int -> ReadS CSVInput)
-> ReadS [CSVInput]
-> ReadPrec CSVInput
-> ReadPrec [CSVInput]
-> Read CSVInput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CSVInput]
$creadListPrec :: ReadPrec [CSVInput]
readPrec :: ReadPrec CSVInput
$creadPrec :: ReadPrec CSVInput
readList :: ReadS [CSVInput]
$creadList :: ReadS [CSVInput]
readsPrec :: Int -> ReadS CSVInput
$creadsPrec :: Int -> ReadS CSVInput
Prelude.Read, Int -> CSVInput -> ShowS
[CSVInput] -> ShowS
CSVInput -> String
(Int -> CSVInput -> ShowS)
-> (CSVInput -> String) -> ([CSVInput] -> ShowS) -> Show CSVInput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CSVInput] -> ShowS
$cshowList :: [CSVInput] -> ShowS
show :: CSVInput -> String
$cshow :: CSVInput -> String
showsPrec :: Int -> CSVInput -> ShowS
$cshowsPrec :: Int -> CSVInput -> ShowS
Prelude.Show, (forall x. CSVInput -> Rep CSVInput x)
-> (forall x. Rep CSVInput x -> CSVInput) -> Generic CSVInput
forall x. Rep CSVInput x -> CSVInput
forall x. CSVInput -> Rep CSVInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CSVInput x -> CSVInput
$cfrom :: forall x. CSVInput -> Rep CSVInput x
Prelude.Generic)
newCSVInput ::
CSVInput
newCSVInput :: CSVInput
newCSVInput =
CSVInput' :: Maybe Text
-> Maybe Text
-> Maybe FileHeaderInfo
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> CSVInput
CSVInput'
{ $sel:quoteCharacter:CSVInput' :: Maybe Text
quoteCharacter = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:recordDelimiter:CSVInput' :: Maybe Text
recordDelimiter = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:fileHeaderInfo:CSVInput' :: Maybe FileHeaderInfo
fileHeaderInfo = Maybe FileHeaderInfo
forall a. Maybe a
Prelude.Nothing,
$sel:quoteEscapeCharacter:CSVInput' :: Maybe Text
quoteEscapeCharacter = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:comments:CSVInput' :: Maybe Text
comments = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:fieldDelimiter:CSVInput' :: Maybe Text
fieldDelimiter = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
cSVInput_quoteCharacter :: Lens.Lens' CSVInput (Prelude.Maybe Prelude.Text)
cSVInput_quoteCharacter :: (Maybe Text -> f (Maybe Text)) -> CSVInput -> f CSVInput
cSVInput_quoteCharacter = (CSVInput -> Maybe Text)
-> (CSVInput -> Maybe Text -> CSVInput)
-> Lens CSVInput CSVInput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CSVInput' {Maybe Text
quoteCharacter :: Maybe Text
$sel:quoteCharacter:CSVInput' :: CSVInput -> Maybe Text
quoteCharacter} -> Maybe Text
quoteCharacter) (\s :: CSVInput
s@CSVInput' {} Maybe Text
a -> CSVInput
s {$sel:quoteCharacter:CSVInput' :: Maybe Text
quoteCharacter = Maybe Text
a} :: CSVInput)
cSVInput_recordDelimiter :: Lens.Lens' CSVInput (Prelude.Maybe Prelude.Text)
cSVInput_recordDelimiter :: (Maybe Text -> f (Maybe Text)) -> CSVInput -> f CSVInput
cSVInput_recordDelimiter = (CSVInput -> Maybe Text)
-> (CSVInput -> Maybe Text -> CSVInput)
-> Lens CSVInput CSVInput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CSVInput' {Maybe Text
recordDelimiter :: Maybe Text
$sel:recordDelimiter:CSVInput' :: CSVInput -> Maybe Text
recordDelimiter} -> Maybe Text
recordDelimiter) (\s :: CSVInput
s@CSVInput' {} Maybe Text
a -> CSVInput
s {$sel:recordDelimiter:CSVInput' :: Maybe Text
recordDelimiter = Maybe Text
a} :: CSVInput)
cSVInput_fileHeaderInfo :: Lens.Lens' CSVInput (Prelude.Maybe FileHeaderInfo)
= (CSVInput -> Maybe FileHeaderInfo)
-> (CSVInput -> Maybe FileHeaderInfo -> CSVInput)
-> Lens
CSVInput CSVInput (Maybe FileHeaderInfo) (Maybe FileHeaderInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CSVInput' {Maybe FileHeaderInfo
fileHeaderInfo :: Maybe FileHeaderInfo
$sel:fileHeaderInfo:CSVInput' :: CSVInput -> Maybe FileHeaderInfo
fileHeaderInfo} -> Maybe FileHeaderInfo
fileHeaderInfo) (\s :: CSVInput
s@CSVInput' {} Maybe FileHeaderInfo
a -> CSVInput
s {$sel:fileHeaderInfo:CSVInput' :: Maybe FileHeaderInfo
fileHeaderInfo = Maybe FileHeaderInfo
a} :: CSVInput)
cSVInput_quoteEscapeCharacter :: Lens.Lens' CSVInput (Prelude.Maybe Prelude.Text)
cSVInput_quoteEscapeCharacter :: (Maybe Text -> f (Maybe Text)) -> CSVInput -> f CSVInput
cSVInput_quoteEscapeCharacter = (CSVInput -> Maybe Text)
-> (CSVInput -> Maybe Text -> CSVInput)
-> Lens CSVInput CSVInput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CSVInput' {Maybe Text
quoteEscapeCharacter :: Maybe Text
$sel:quoteEscapeCharacter:CSVInput' :: CSVInput -> Maybe Text
quoteEscapeCharacter} -> Maybe Text
quoteEscapeCharacter) (\s :: CSVInput
s@CSVInput' {} Maybe Text
a -> CSVInput
s {$sel:quoteEscapeCharacter:CSVInput' :: Maybe Text
quoteEscapeCharacter = Maybe Text
a} :: CSVInput)
cSVInput_comments :: Lens.Lens' CSVInput (Prelude.Maybe Prelude.Text)
= (CSVInput -> Maybe Text)
-> (CSVInput -> Maybe Text -> CSVInput)
-> Lens CSVInput CSVInput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CSVInput' {Maybe Text
comments :: Maybe Text
$sel:comments:CSVInput' :: CSVInput -> Maybe Text
comments} -> Maybe Text
comments) (\s :: CSVInput
s@CSVInput' {} Maybe Text
a -> CSVInput
s {$sel:comments:CSVInput' :: Maybe Text
comments = Maybe Text
a} :: CSVInput)
cSVInput_fieldDelimiter :: Lens.Lens' CSVInput (Prelude.Maybe Prelude.Text)
cSVInput_fieldDelimiter :: (Maybe Text -> f (Maybe Text)) -> CSVInput -> f CSVInput
cSVInput_fieldDelimiter = (CSVInput -> Maybe Text)
-> (CSVInput -> Maybe Text -> CSVInput)
-> Lens CSVInput CSVInput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CSVInput' {Maybe Text
fieldDelimiter :: Maybe Text
$sel:fieldDelimiter:CSVInput' :: CSVInput -> Maybe Text
fieldDelimiter} -> Maybe Text
fieldDelimiter) (\s :: CSVInput
s@CSVInput' {} Maybe Text
a -> CSVInput
s {$sel:fieldDelimiter:CSVInput' :: Maybe Text
fieldDelimiter = Maybe Text
a} :: CSVInput)
instance Core.FromJSON CSVInput where
parseJSON :: Value -> Parser CSVInput
parseJSON =
String -> (Object -> Parser CSVInput) -> Value -> Parser CSVInput
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CSVInput"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe FileHeaderInfo
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> CSVInput
CSVInput'
(Maybe Text
-> Maybe Text
-> Maybe FileHeaderInfo
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> CSVInput)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe FileHeaderInfo
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> CSVInput)
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
"QuoteCharacter")
Parser
(Maybe Text
-> Maybe FileHeaderInfo
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> CSVInput)
-> Parser (Maybe Text)
-> Parser
(Maybe FileHeaderInfo
-> Maybe Text -> Maybe Text -> Maybe Text -> CSVInput)
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
"RecordDelimiter")
Parser
(Maybe FileHeaderInfo
-> Maybe Text -> Maybe Text -> Maybe Text -> CSVInput)
-> Parser (Maybe FileHeaderInfo)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> CSVInput)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe FileHeaderInfo)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FileHeaderInfo")
Parser (Maybe Text -> Maybe Text -> Maybe Text -> CSVInput)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> CSVInput)
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
"QuoteEscapeCharacter")
Parser (Maybe Text -> Maybe Text -> CSVInput)
-> Parser (Maybe Text) -> Parser (Maybe Text -> CSVInput)
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
"Comments")
Parser (Maybe Text -> CSVInput)
-> Parser (Maybe Text) -> Parser CSVInput
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
"FieldDelimiter")
)
instance Prelude.Hashable CSVInput
instance Prelude.NFData CSVInput
instance Core.ToJSON CSVInput where
toJSON :: CSVInput -> Value
toJSON CSVInput' {Maybe Text
Maybe FileHeaderInfo
fieldDelimiter :: Maybe Text
comments :: Maybe Text
quoteEscapeCharacter :: Maybe Text
fileHeaderInfo :: Maybe FileHeaderInfo
recordDelimiter :: Maybe Text
quoteCharacter :: Maybe Text
$sel:fieldDelimiter:CSVInput' :: CSVInput -> Maybe Text
$sel:comments:CSVInput' :: CSVInput -> Maybe Text
$sel:quoteEscapeCharacter:CSVInput' :: CSVInput -> Maybe Text
$sel:fileHeaderInfo:CSVInput' :: CSVInput -> Maybe FileHeaderInfo
$sel:recordDelimiter:CSVInput' :: CSVInput -> Maybe Text
$sel:quoteCharacter:CSVInput' :: CSVInput -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"QuoteCharacter" 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
quoteCharacter,
(Text
"RecordDelimiter" 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
recordDelimiter,
(Text
"FileHeaderInfo" Text -> FileHeaderInfo -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(FileHeaderInfo -> Pair) -> Maybe FileHeaderInfo -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FileHeaderInfo
fileHeaderInfo,
(Text
"QuoteEscapeCharacter" 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
quoteEscapeCharacter,
(Text
"Comments" 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
comments,
(Text
"FieldDelimiter" 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
fieldDelimiter
]
)