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