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