{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.IoTAnalytics.Types.GlueConfiguration
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoTAnalytics.Types.GlueConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Configuration information for coordination with Glue, a fully managed
-- extract, transform and load (ETL) service.
--
-- /See:/ 'newGlueConfiguration' smart constructor.
data GlueConfiguration = GlueConfiguration'
  { -- | The name of the table in your Glue Data Catalog that is used to perform
    -- the ETL operations. An Glue Data Catalog table contains partitioned data
    -- and descriptions of data sources and targets.
    GlueConfiguration -> Text
tableName :: Prelude.Text,
    -- | The name of the database in your Glue Data Catalog in which the table is
    -- located. An Glue Data Catalog database contains metadata tables.
    GlueConfiguration -> Text
databaseName :: Prelude.Text
  }
  deriving (GlueConfiguration -> GlueConfiguration -> Bool
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]
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
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. 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)

-- |
-- Create a value of 'GlueConfiguration' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'tableName', 'glueConfiguration_tableName' - The name of the table in your Glue Data Catalog that is used to perform
-- the ETL operations. An Glue Data Catalog table contains partitioned data
-- and descriptions of data sources and targets.
--
-- 'databaseName', 'glueConfiguration_databaseName' - The name of the database in your Glue Data Catalog in which the table is
-- located. An Glue Data Catalog database contains metadata tables.
newGlueConfiguration ::
  -- | 'tableName'
  Prelude.Text ->
  -- | 'databaseName'
  Prelude.Text ->
  GlueConfiguration
newGlueConfiguration :: Text -> Text -> GlueConfiguration
newGlueConfiguration Text
pTableName_ Text
pDatabaseName_ =
  GlueConfiguration'
    { $sel:tableName:GlueConfiguration' :: Text
tableName = Text
pTableName_,
      $sel:databaseName:GlueConfiguration' :: Text
databaseName = Text
pDatabaseName_
    }

-- | The name of the table in your Glue Data Catalog that is used to perform
-- the ETL operations. An Glue Data Catalog table contains partitioned data
-- and descriptions of data sources and targets.
glueConfiguration_tableName :: Lens.Lens' GlueConfiguration Prelude.Text
glueConfiguration_tableName :: Lens' GlueConfiguration Text
glueConfiguration_tableName = 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)

-- | The name of the database in your Glue Data Catalog in which the table is
-- located. An Glue Data Catalog database contains metadata tables.
glueConfiguration_databaseName :: Lens.Lens' GlueConfiguration Prelude.Text
glueConfiguration_databaseName :: Lens' GlueConfiguration Text
glueConfiguration_databaseName = 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 Data.FromJSON GlueConfiguration where
  parseJSON :: Value -> Parser GlueConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"GlueConfiguration"
      ( \Object
x ->
          Text -> Text -> GlueConfiguration
GlueConfiguration'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"tableName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"databaseName")
      )

instance Prelude.Hashable GlueConfiguration where
  hashWithSalt :: Int -> GlueConfiguration -> Int
hashWithSalt Int
_salt GlueConfiguration' {Text
databaseName :: Text
tableName :: Text
$sel:databaseName:GlueConfiguration' :: GlueConfiguration -> Text
$sel:tableName:GlueConfiguration' :: GlueConfiguration -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
tableName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
databaseName

instance Prelude.NFData GlueConfiguration where
  rnf :: GlueConfiguration -> ()
rnf GlueConfiguration' {Text
databaseName :: Text
tableName :: Text
$sel:databaseName:GlueConfiguration' :: GlueConfiguration -> Text
$sel:tableName:GlueConfiguration' :: GlueConfiguration -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
tableName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
databaseName

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"tableName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
tableName),
            forall a. a -> Maybe a
Prelude.Just (Key
"databaseName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
databaseName)
          ]
      )