{-# 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.DataCatalogOutput where
import qualified Amazonka.Core as Core
import Amazonka.DataBrew.Types.DatabaseTableOutputOptions
import Amazonka.DataBrew.Types.S3TableOutputOptions
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DataCatalogOutput = DataCatalogOutput'
{
DataCatalogOutput -> Maybe DatabaseTableOutputOptions
databaseOptions :: Prelude.Maybe DatabaseTableOutputOptions,
DataCatalogOutput -> Maybe S3TableOutputOptions
s3Options :: Prelude.Maybe S3TableOutputOptions,
DataCatalogOutput -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
DataCatalogOutput -> Maybe Bool
overwrite :: Prelude.Maybe Prelude.Bool,
DataCatalogOutput -> Text
databaseName :: Prelude.Text,
DataCatalogOutput -> Text
tableName :: Prelude.Text
}
deriving (DataCatalogOutput -> DataCatalogOutput -> Bool
(DataCatalogOutput -> DataCatalogOutput -> Bool)
-> (DataCatalogOutput -> DataCatalogOutput -> Bool)
-> Eq DataCatalogOutput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataCatalogOutput -> DataCatalogOutput -> Bool
$c/= :: DataCatalogOutput -> DataCatalogOutput -> Bool
== :: DataCatalogOutput -> DataCatalogOutput -> Bool
$c== :: DataCatalogOutput -> DataCatalogOutput -> Bool
Prelude.Eq, ReadPrec [DataCatalogOutput]
ReadPrec DataCatalogOutput
Int -> ReadS DataCatalogOutput
ReadS [DataCatalogOutput]
(Int -> ReadS DataCatalogOutput)
-> ReadS [DataCatalogOutput]
-> ReadPrec DataCatalogOutput
-> ReadPrec [DataCatalogOutput]
-> Read DataCatalogOutput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataCatalogOutput]
$creadListPrec :: ReadPrec [DataCatalogOutput]
readPrec :: ReadPrec DataCatalogOutput
$creadPrec :: ReadPrec DataCatalogOutput
readList :: ReadS [DataCatalogOutput]
$creadList :: ReadS [DataCatalogOutput]
readsPrec :: Int -> ReadS DataCatalogOutput
$creadsPrec :: Int -> ReadS DataCatalogOutput
Prelude.Read, Int -> DataCatalogOutput -> ShowS
[DataCatalogOutput] -> ShowS
DataCatalogOutput -> String
(Int -> DataCatalogOutput -> ShowS)
-> (DataCatalogOutput -> String)
-> ([DataCatalogOutput] -> ShowS)
-> Show DataCatalogOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataCatalogOutput] -> ShowS
$cshowList :: [DataCatalogOutput] -> ShowS
show :: DataCatalogOutput -> String
$cshow :: DataCatalogOutput -> String
showsPrec :: Int -> DataCatalogOutput -> ShowS
$cshowsPrec :: Int -> DataCatalogOutput -> ShowS
Prelude.Show, (forall x. DataCatalogOutput -> Rep DataCatalogOutput x)
-> (forall x. Rep DataCatalogOutput x -> DataCatalogOutput)
-> Generic DataCatalogOutput
forall x. Rep DataCatalogOutput x -> DataCatalogOutput
forall x. DataCatalogOutput -> Rep DataCatalogOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataCatalogOutput x -> DataCatalogOutput
$cfrom :: forall x. DataCatalogOutput -> Rep DataCatalogOutput x
Prelude.Generic)
newDataCatalogOutput ::
Prelude.Text ->
Prelude.Text ->
DataCatalogOutput
newDataCatalogOutput :: Text -> Text -> DataCatalogOutput
newDataCatalogOutput Text
pDatabaseName_ Text
pTableName_ =
DataCatalogOutput' :: Maybe DatabaseTableOutputOptions
-> Maybe S3TableOutputOptions
-> Maybe Text
-> Maybe Bool
-> Text
-> Text
-> DataCatalogOutput
DataCatalogOutput'
{ $sel:databaseOptions:DataCatalogOutput' :: Maybe DatabaseTableOutputOptions
databaseOptions =
Maybe DatabaseTableOutputOptions
forall a. Maybe a
Prelude.Nothing,
$sel:s3Options:DataCatalogOutput' :: Maybe S3TableOutputOptions
s3Options = Maybe S3TableOutputOptions
forall a. Maybe a
Prelude.Nothing,
$sel:catalogId:DataCatalogOutput' :: Maybe Text
catalogId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:overwrite:DataCatalogOutput' :: Maybe Bool
overwrite = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:databaseName:DataCatalogOutput' :: Text
databaseName = Text
pDatabaseName_,
$sel:tableName:DataCatalogOutput' :: Text
tableName = Text
pTableName_
}
dataCatalogOutput_databaseOptions :: Lens.Lens' DataCatalogOutput (Prelude.Maybe DatabaseTableOutputOptions)
dataCatalogOutput_databaseOptions :: (Maybe DatabaseTableOutputOptions
-> f (Maybe DatabaseTableOutputOptions))
-> DataCatalogOutput -> f DataCatalogOutput
dataCatalogOutput_databaseOptions = (DataCatalogOutput -> Maybe DatabaseTableOutputOptions)
-> (DataCatalogOutput
-> Maybe DatabaseTableOutputOptions -> DataCatalogOutput)
-> Lens
DataCatalogOutput
DataCatalogOutput
(Maybe DatabaseTableOutputOptions)
(Maybe DatabaseTableOutputOptions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataCatalogOutput' {Maybe DatabaseTableOutputOptions
databaseOptions :: Maybe DatabaseTableOutputOptions
$sel:databaseOptions:DataCatalogOutput' :: DataCatalogOutput -> Maybe DatabaseTableOutputOptions
databaseOptions} -> Maybe DatabaseTableOutputOptions
databaseOptions) (\s :: DataCatalogOutput
s@DataCatalogOutput' {} Maybe DatabaseTableOutputOptions
a -> DataCatalogOutput
s {$sel:databaseOptions:DataCatalogOutput' :: Maybe DatabaseTableOutputOptions
databaseOptions = Maybe DatabaseTableOutputOptions
a} :: DataCatalogOutput)
dataCatalogOutput_s3Options :: Lens.Lens' DataCatalogOutput (Prelude.Maybe S3TableOutputOptions)
dataCatalogOutput_s3Options :: (Maybe S3TableOutputOptions -> f (Maybe S3TableOutputOptions))
-> DataCatalogOutput -> f DataCatalogOutput
dataCatalogOutput_s3Options = (DataCatalogOutput -> Maybe S3TableOutputOptions)
-> (DataCatalogOutput
-> Maybe S3TableOutputOptions -> DataCatalogOutput)
-> Lens
DataCatalogOutput
DataCatalogOutput
(Maybe S3TableOutputOptions)
(Maybe S3TableOutputOptions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataCatalogOutput' {Maybe S3TableOutputOptions
s3Options :: Maybe S3TableOutputOptions
$sel:s3Options:DataCatalogOutput' :: DataCatalogOutput -> Maybe S3TableOutputOptions
s3Options} -> Maybe S3TableOutputOptions
s3Options) (\s :: DataCatalogOutput
s@DataCatalogOutput' {} Maybe S3TableOutputOptions
a -> DataCatalogOutput
s {$sel:s3Options:DataCatalogOutput' :: Maybe S3TableOutputOptions
s3Options = Maybe S3TableOutputOptions
a} :: DataCatalogOutput)
dataCatalogOutput_catalogId :: Lens.Lens' DataCatalogOutput (Prelude.Maybe Prelude.Text)
dataCatalogOutput_catalogId :: (Maybe Text -> f (Maybe Text))
-> DataCatalogOutput -> f DataCatalogOutput
dataCatalogOutput_catalogId = (DataCatalogOutput -> Maybe Text)
-> (DataCatalogOutput -> Maybe Text -> DataCatalogOutput)
-> Lens
DataCatalogOutput DataCatalogOutput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataCatalogOutput' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:DataCatalogOutput' :: DataCatalogOutput -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: DataCatalogOutput
s@DataCatalogOutput' {} Maybe Text
a -> DataCatalogOutput
s {$sel:catalogId:DataCatalogOutput' :: Maybe Text
catalogId = Maybe Text
a} :: DataCatalogOutput)
dataCatalogOutput_overwrite :: Lens.Lens' DataCatalogOutput (Prelude.Maybe Prelude.Bool)
dataCatalogOutput_overwrite :: (Maybe Bool -> f (Maybe Bool))
-> DataCatalogOutput -> f DataCatalogOutput
dataCatalogOutput_overwrite = (DataCatalogOutput -> Maybe Bool)
-> (DataCatalogOutput -> Maybe Bool -> DataCatalogOutput)
-> Lens
DataCatalogOutput DataCatalogOutput (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataCatalogOutput' {Maybe Bool
overwrite :: Maybe Bool
$sel:overwrite:DataCatalogOutput' :: DataCatalogOutput -> Maybe Bool
overwrite} -> Maybe Bool
overwrite) (\s :: DataCatalogOutput
s@DataCatalogOutput' {} Maybe Bool
a -> DataCatalogOutput
s {$sel:overwrite:DataCatalogOutput' :: Maybe Bool
overwrite = Maybe Bool
a} :: DataCatalogOutput)
dataCatalogOutput_databaseName :: Lens.Lens' DataCatalogOutput Prelude.Text
dataCatalogOutput_databaseName :: (Text -> f Text) -> DataCatalogOutput -> f DataCatalogOutput
dataCatalogOutput_databaseName = (DataCatalogOutput -> Text)
-> (DataCatalogOutput -> Text -> DataCatalogOutput)
-> Lens DataCatalogOutput DataCatalogOutput Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataCatalogOutput' {Text
databaseName :: Text
$sel:databaseName:DataCatalogOutput' :: DataCatalogOutput -> Text
databaseName} -> Text
databaseName) (\s :: DataCatalogOutput
s@DataCatalogOutput' {} Text
a -> DataCatalogOutput
s {$sel:databaseName:DataCatalogOutput' :: Text
databaseName = Text
a} :: DataCatalogOutput)
dataCatalogOutput_tableName :: Lens.Lens' DataCatalogOutput Prelude.Text
dataCatalogOutput_tableName :: (Text -> f Text) -> DataCatalogOutput -> f DataCatalogOutput
dataCatalogOutput_tableName = (DataCatalogOutput -> Text)
-> (DataCatalogOutput -> Text -> DataCatalogOutput)
-> Lens DataCatalogOutput DataCatalogOutput Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataCatalogOutput' {Text
tableName :: Text
$sel:tableName:DataCatalogOutput' :: DataCatalogOutput -> Text
tableName} -> Text
tableName) (\s :: DataCatalogOutput
s@DataCatalogOutput' {} Text
a -> DataCatalogOutput
s {$sel:tableName:DataCatalogOutput' :: Text
tableName = Text
a} :: DataCatalogOutput)
instance Core.FromJSON DataCatalogOutput where
parseJSON :: Value -> Parser DataCatalogOutput
parseJSON =
String
-> (Object -> Parser DataCatalogOutput)
-> Value
-> Parser DataCatalogOutput
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DataCatalogOutput"
( \Object
x ->
Maybe DatabaseTableOutputOptions
-> Maybe S3TableOutputOptions
-> Maybe Text
-> Maybe Bool
-> Text
-> Text
-> DataCatalogOutput
DataCatalogOutput'
(Maybe DatabaseTableOutputOptions
-> Maybe S3TableOutputOptions
-> Maybe Text
-> Maybe Bool
-> Text
-> Text
-> DataCatalogOutput)
-> Parser (Maybe DatabaseTableOutputOptions)
-> Parser
(Maybe S3TableOutputOptions
-> Maybe Text -> Maybe Bool -> Text -> Text -> DataCatalogOutput)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DatabaseTableOutputOptions)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DatabaseOptions")
Parser
(Maybe S3TableOutputOptions
-> Maybe Text -> Maybe Bool -> Text -> Text -> DataCatalogOutput)
-> Parser (Maybe S3TableOutputOptions)
-> Parser
(Maybe Text -> Maybe Bool -> Text -> Text -> DataCatalogOutput)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe S3TableOutputOptions)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"S3Options")
Parser
(Maybe Text -> Maybe Bool -> Text -> Text -> DataCatalogOutput)
-> Parser (Maybe Text)
-> Parser (Maybe Bool -> Text -> Text -> DataCatalogOutput)
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
"CatalogId")
Parser (Maybe Bool -> Text -> Text -> DataCatalogOutput)
-> Parser (Maybe Bool)
-> Parser (Text -> Text -> DataCatalogOutput)
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 (Text -> Text -> DataCatalogOutput)
-> Parser Text -> Parser (Text -> DataCatalogOutput)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DatabaseName")
Parser (Text -> DataCatalogOutput)
-> Parser Text -> Parser DataCatalogOutput
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TableName")
)
instance Prelude.Hashable DataCatalogOutput
instance Prelude.NFData DataCatalogOutput
instance Core.ToJSON DataCatalogOutput where
toJSON :: DataCatalogOutput -> Value
toJSON DataCatalogOutput' {Maybe Bool
Maybe Text
Maybe DatabaseTableOutputOptions
Maybe S3TableOutputOptions
Text
tableName :: Text
databaseName :: Text
overwrite :: Maybe Bool
catalogId :: Maybe Text
s3Options :: Maybe S3TableOutputOptions
databaseOptions :: Maybe DatabaseTableOutputOptions
$sel:tableName:DataCatalogOutput' :: DataCatalogOutput -> Text
$sel:databaseName:DataCatalogOutput' :: DataCatalogOutput -> Text
$sel:overwrite:DataCatalogOutput' :: DataCatalogOutput -> Maybe Bool
$sel:catalogId:DataCatalogOutput' :: DataCatalogOutput -> Maybe Text
$sel:s3Options:DataCatalogOutput' :: DataCatalogOutput -> Maybe S3TableOutputOptions
$sel:databaseOptions:DataCatalogOutput' :: DataCatalogOutput -> Maybe DatabaseTableOutputOptions
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DatabaseOptions" Text -> DatabaseTableOutputOptions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(DatabaseTableOutputOptions -> Pair)
-> Maybe DatabaseTableOutputOptions -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DatabaseTableOutputOptions
databaseOptions,
(Text
"S3Options" Text -> S3TableOutputOptions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (S3TableOutputOptions -> Pair)
-> Maybe S3TableOutputOptions -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3TableOutputOptions
s3Options,
(Text
"CatalogId" 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
catalogId,
(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
"DatabaseName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
databaseName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TableName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tableName)
]
)