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