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