{-# 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.Output where
import qualified Amazonka.Core as Core
import Amazonka.DataBrew.Types.CompressionFormat
import Amazonka.DataBrew.Types.OutputFormat
import Amazonka.DataBrew.Types.OutputFormatOptions
import Amazonka.DataBrew.Types.S3Location
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Output = Output'
{
Output -> Maybe [Text]
partitionColumns :: Prelude.Maybe [Prelude.Text],
Output -> Maybe OutputFormatOptions
formatOptions :: Prelude.Maybe OutputFormatOptions,
Output -> Maybe OutputFormat
format :: Prelude.Maybe OutputFormat,
Output -> Maybe CompressionFormat
compressionFormat :: Prelude.Maybe CompressionFormat,
Output -> Maybe Bool
overwrite :: Prelude.Maybe Prelude.Bool,
Output -> S3Location
location :: S3Location
}
deriving (Output -> Output -> Bool
(Output -> Output -> Bool)
-> (Output -> Output -> Bool) -> Eq Output
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Output -> Output -> Bool
$c/= :: Output -> Output -> Bool
== :: Output -> Output -> Bool
$c== :: Output -> Output -> Bool
Prelude.Eq, ReadPrec [Output]
ReadPrec Output
Int -> ReadS Output
ReadS [Output]
(Int -> ReadS Output)
-> ReadS [Output]
-> ReadPrec Output
-> ReadPrec [Output]
-> Read Output
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Output]
$creadListPrec :: ReadPrec [Output]
readPrec :: ReadPrec Output
$creadPrec :: ReadPrec Output
readList :: ReadS [Output]
$creadList :: ReadS [Output]
readsPrec :: Int -> ReadS Output
$creadsPrec :: Int -> ReadS Output
Prelude.Read, Int -> Output -> ShowS
[Output] -> ShowS
Output -> String
(Int -> Output -> ShowS)
-> (Output -> String) -> ([Output] -> ShowS) -> Show Output
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Output] -> ShowS
$cshowList :: [Output] -> ShowS
show :: Output -> String
$cshow :: Output -> String
showsPrec :: Int -> Output -> ShowS
$cshowsPrec :: Int -> Output -> ShowS
Prelude.Show, (forall x. Output -> Rep Output x)
-> (forall x. Rep Output x -> Output) -> Generic Output
forall x. Rep Output x -> Output
forall x. Output -> Rep Output x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Output x -> Output
$cfrom :: forall x. Output -> Rep Output x
Prelude.Generic)
newOutput ::
S3Location ->
Output
newOutput :: S3Location -> Output
newOutput S3Location
pLocation_ =
Output' :: Maybe [Text]
-> Maybe OutputFormatOptions
-> Maybe OutputFormat
-> Maybe CompressionFormat
-> Maybe Bool
-> S3Location
-> Output
Output'
{ $sel:partitionColumns:Output' :: Maybe [Text]
partitionColumns = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:formatOptions:Output' :: Maybe OutputFormatOptions
formatOptions = Maybe OutputFormatOptions
forall a. Maybe a
Prelude.Nothing,
$sel:format:Output' :: Maybe OutputFormat
format = Maybe OutputFormat
forall a. Maybe a
Prelude.Nothing,
$sel:compressionFormat:Output' :: Maybe CompressionFormat
compressionFormat = Maybe CompressionFormat
forall a. Maybe a
Prelude.Nothing,
$sel:overwrite:Output' :: Maybe Bool
overwrite = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:location:Output' :: S3Location
location = S3Location
pLocation_
}
output_partitionColumns :: Lens.Lens' Output (Prelude.Maybe [Prelude.Text])
output_partitionColumns :: (Maybe [Text] -> f (Maybe [Text])) -> Output -> f Output
output_partitionColumns = (Output -> Maybe [Text])
-> (Output -> Maybe [Text] -> Output)
-> Lens Output Output (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Output' {Maybe [Text]
partitionColumns :: Maybe [Text]
$sel:partitionColumns:Output' :: Output -> Maybe [Text]
partitionColumns} -> Maybe [Text]
partitionColumns) (\s :: Output
s@Output' {} Maybe [Text]
a -> Output
s {$sel:partitionColumns:Output' :: Maybe [Text]
partitionColumns = Maybe [Text]
a} :: Output) ((Maybe [Text] -> f (Maybe [Text])) -> Output -> f Output)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Output
-> f Output
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
output_formatOptions :: Lens.Lens' Output (Prelude.Maybe OutputFormatOptions)
output_formatOptions :: (Maybe OutputFormatOptions -> f (Maybe OutputFormatOptions))
-> Output -> f Output
output_formatOptions = (Output -> Maybe OutputFormatOptions)
-> (Output -> Maybe OutputFormatOptions -> Output)
-> Lens
Output
Output
(Maybe OutputFormatOptions)
(Maybe OutputFormatOptions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Output' {Maybe OutputFormatOptions
formatOptions :: Maybe OutputFormatOptions
$sel:formatOptions:Output' :: Output -> Maybe OutputFormatOptions
formatOptions} -> Maybe OutputFormatOptions
formatOptions) (\s :: Output
s@Output' {} Maybe OutputFormatOptions
a -> Output
s {$sel:formatOptions:Output' :: Maybe OutputFormatOptions
formatOptions = Maybe OutputFormatOptions
a} :: Output)
output_format :: Lens.Lens' Output (Prelude.Maybe OutputFormat)
output_format :: (Maybe OutputFormat -> f (Maybe OutputFormat))
-> Output -> f Output
output_format = (Output -> Maybe OutputFormat)
-> (Output -> Maybe OutputFormat -> Output)
-> Lens Output Output (Maybe OutputFormat) (Maybe OutputFormat)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Output' {Maybe OutputFormat
format :: Maybe OutputFormat
$sel:format:Output' :: Output -> Maybe OutputFormat
format} -> Maybe OutputFormat
format) (\s :: Output
s@Output' {} Maybe OutputFormat
a -> Output
s {$sel:format:Output' :: Maybe OutputFormat
format = Maybe OutputFormat
a} :: Output)
output_compressionFormat :: Lens.Lens' Output (Prelude.Maybe CompressionFormat)
output_compressionFormat :: (Maybe CompressionFormat -> f (Maybe CompressionFormat))
-> Output -> f Output
output_compressionFormat = (Output -> Maybe CompressionFormat)
-> (Output -> Maybe CompressionFormat -> Output)
-> Lens
Output Output (Maybe CompressionFormat) (Maybe CompressionFormat)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Output' {Maybe CompressionFormat
compressionFormat :: Maybe CompressionFormat
$sel:compressionFormat:Output' :: Output -> Maybe CompressionFormat
compressionFormat} -> Maybe CompressionFormat
compressionFormat) (\s :: Output
s@Output' {} Maybe CompressionFormat
a -> Output
s {$sel:compressionFormat:Output' :: Maybe CompressionFormat
compressionFormat = Maybe CompressionFormat
a} :: Output)
output_overwrite :: Lens.Lens' Output (Prelude.Maybe Prelude.Bool)
output_overwrite :: (Maybe Bool -> f (Maybe Bool)) -> Output -> f Output
output_overwrite = (Output -> Maybe Bool)
-> (Output -> Maybe Bool -> Output)
-> Lens Output Output (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Output' {Maybe Bool
overwrite :: Maybe Bool
$sel:overwrite:Output' :: Output -> Maybe Bool
overwrite} -> Maybe Bool
overwrite) (\s :: Output
s@Output' {} Maybe Bool
a -> Output
s {$sel:overwrite:Output' :: Maybe Bool
overwrite = Maybe Bool
a} :: Output)
output_location :: Lens.Lens' Output S3Location
output_location :: (S3Location -> f S3Location) -> Output -> f Output
output_location = (Output -> S3Location)
-> (Output -> S3Location -> Output)
-> Lens Output Output S3Location S3Location
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Output' {S3Location
location :: S3Location
$sel:location:Output' :: Output -> S3Location
location} -> S3Location
location) (\s :: Output
s@Output' {} S3Location
a -> Output
s {$sel:location:Output' :: S3Location
location = S3Location
a} :: Output)
instance Core.FromJSON Output where
parseJSON :: Value -> Parser Output
parseJSON =
String -> (Object -> Parser Output) -> Value -> Parser Output
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Output"
( \Object
x ->
Maybe [Text]
-> Maybe OutputFormatOptions
-> Maybe OutputFormat
-> Maybe CompressionFormat
-> Maybe Bool
-> S3Location
-> Output
Output'
(Maybe [Text]
-> Maybe OutputFormatOptions
-> Maybe OutputFormat
-> Maybe CompressionFormat
-> Maybe Bool
-> S3Location
-> Output)
-> Parser (Maybe [Text])
-> Parser
(Maybe OutputFormatOptions
-> Maybe OutputFormat
-> Maybe CompressionFormat
-> Maybe Bool
-> S3Location
-> Output)
forall (f :: * -> *) a b. Functor 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
"PartitionColumns"
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 OutputFormatOptions
-> Maybe OutputFormat
-> Maybe CompressionFormat
-> Maybe Bool
-> S3Location
-> Output)
-> Parser (Maybe OutputFormatOptions)
-> Parser
(Maybe OutputFormat
-> Maybe CompressionFormat -> Maybe Bool -> S3Location -> Output)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe OutputFormatOptions)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FormatOptions")
Parser
(Maybe OutputFormat
-> Maybe CompressionFormat -> Maybe Bool -> S3Location -> Output)
-> Parser (Maybe OutputFormat)
-> Parser
(Maybe CompressionFormat -> Maybe Bool -> S3Location -> Output)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe OutputFormat)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Format")
Parser
(Maybe CompressionFormat -> Maybe Bool -> S3Location -> Output)
-> Parser (Maybe CompressionFormat)
-> Parser (Maybe Bool -> S3Location -> Output)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CompressionFormat)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CompressionFormat")
Parser (Maybe Bool -> S3Location -> Output)
-> Parser (Maybe Bool) -> Parser (S3Location -> Output)
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
"Overwrite")
Parser (S3Location -> Output) -> Parser S3Location -> Parser Output
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser S3Location
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Location")
)
instance Prelude.Hashable Output
instance Prelude.NFData Output
instance Core.ToJSON Output where
toJSON :: Output -> Value
toJSON Output' {Maybe Bool
Maybe [Text]
Maybe CompressionFormat
Maybe OutputFormat
Maybe OutputFormatOptions
S3Location
location :: S3Location
overwrite :: Maybe Bool
compressionFormat :: Maybe CompressionFormat
format :: Maybe OutputFormat
formatOptions :: Maybe OutputFormatOptions
partitionColumns :: Maybe [Text]
$sel:location:Output' :: Output -> S3Location
$sel:overwrite:Output' :: Output -> Maybe Bool
$sel:compressionFormat:Output' :: Output -> Maybe CompressionFormat
$sel:format:Output' :: Output -> Maybe OutputFormat
$sel:formatOptions:Output' :: Output -> Maybe OutputFormatOptions
$sel:partitionColumns:Output' :: Output -> Maybe [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"PartitionColumns" 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]
partitionColumns,
(Text
"FormatOptions" Text -> OutputFormatOptions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (OutputFormatOptions -> Pair)
-> Maybe OutputFormatOptions -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OutputFormatOptions
formatOptions,
(Text
"Format" Text -> OutputFormat -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (OutputFormat -> Pair) -> Maybe OutputFormat -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OutputFormat
format,
(Text
"CompressionFormat" Text -> CompressionFormat -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(CompressionFormat -> Pair)
-> Maybe CompressionFormat -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CompressionFormat
compressionFormat,
(Text
"Overwrite" 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
overwrite,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Location" Text -> S3Location -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= S3Location
location)
]
)