{-# 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.SageMaker.Types.DataCatalogConfig
-- 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.SageMaker.Types.DataCatalogConfig 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

-- | The meta data of the Glue table which serves as data catalog for the
-- @OfflineStore@.
--
-- /See:/ 'newDataCatalogConfig' smart constructor.
data DataCatalogConfig = DataCatalogConfig'
  { -- | The name of the Glue table.
    DataCatalogConfig -> Text
tableName :: Prelude.Text,
    -- | The name of the Glue table catalog.
    DataCatalogConfig -> Text
catalog :: Prelude.Text,
    -- | The name of the Glue table database.
    DataCatalogConfig -> Text
database :: Prelude.Text
  }
  deriving (DataCatalogConfig -> DataCatalogConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataCatalogConfig -> DataCatalogConfig -> Bool
$c/= :: DataCatalogConfig -> DataCatalogConfig -> Bool
== :: DataCatalogConfig -> DataCatalogConfig -> Bool
$c== :: DataCatalogConfig -> DataCatalogConfig -> Bool
Prelude.Eq, ReadPrec [DataCatalogConfig]
ReadPrec DataCatalogConfig
Int -> ReadS DataCatalogConfig
ReadS [DataCatalogConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataCatalogConfig]
$creadListPrec :: ReadPrec [DataCatalogConfig]
readPrec :: ReadPrec DataCatalogConfig
$creadPrec :: ReadPrec DataCatalogConfig
readList :: ReadS [DataCatalogConfig]
$creadList :: ReadS [DataCatalogConfig]
readsPrec :: Int -> ReadS DataCatalogConfig
$creadsPrec :: Int -> ReadS DataCatalogConfig
Prelude.Read, Int -> DataCatalogConfig -> ShowS
[DataCatalogConfig] -> ShowS
DataCatalogConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataCatalogConfig] -> ShowS
$cshowList :: [DataCatalogConfig] -> ShowS
show :: DataCatalogConfig -> String
$cshow :: DataCatalogConfig -> String
showsPrec :: Int -> DataCatalogConfig -> ShowS
$cshowsPrec :: Int -> DataCatalogConfig -> ShowS
Prelude.Show, forall x. Rep DataCatalogConfig x -> DataCatalogConfig
forall x. DataCatalogConfig -> Rep DataCatalogConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataCatalogConfig x -> DataCatalogConfig
$cfrom :: forall x. DataCatalogConfig -> Rep DataCatalogConfig x
Prelude.Generic)

-- |
-- Create a value of 'DataCatalogConfig' 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', 'dataCatalogConfig_tableName' - The name of the Glue table.
--
-- 'catalog', 'dataCatalogConfig_catalog' - The name of the Glue table catalog.
--
-- 'database', 'dataCatalogConfig_database' - The name of the Glue table database.
newDataCatalogConfig ::
  -- | 'tableName'
  Prelude.Text ->
  -- | 'catalog'
  Prelude.Text ->
  -- | 'database'
  Prelude.Text ->
  DataCatalogConfig
newDataCatalogConfig :: Text -> Text -> Text -> DataCatalogConfig
newDataCatalogConfig Text
pTableName_ Text
pCatalog_ Text
pDatabase_ =
  DataCatalogConfig'
    { $sel:tableName:DataCatalogConfig' :: Text
tableName = Text
pTableName_,
      $sel:catalog:DataCatalogConfig' :: Text
catalog = Text
pCatalog_,
      $sel:database:DataCatalogConfig' :: Text
database = Text
pDatabase_
    }

-- | The name of the Glue table.
dataCatalogConfig_tableName :: Lens.Lens' DataCatalogConfig Prelude.Text
dataCatalogConfig_tableName :: Lens' DataCatalogConfig Text
dataCatalogConfig_tableName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataCatalogConfig' {Text
tableName :: Text
$sel:tableName:DataCatalogConfig' :: DataCatalogConfig -> Text
tableName} -> Text
tableName) (\s :: DataCatalogConfig
s@DataCatalogConfig' {} Text
a -> DataCatalogConfig
s {$sel:tableName:DataCatalogConfig' :: Text
tableName = Text
a} :: DataCatalogConfig)

-- | The name of the Glue table catalog.
dataCatalogConfig_catalog :: Lens.Lens' DataCatalogConfig Prelude.Text
dataCatalogConfig_catalog :: Lens' DataCatalogConfig Text
dataCatalogConfig_catalog = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataCatalogConfig' {Text
catalog :: Text
$sel:catalog:DataCatalogConfig' :: DataCatalogConfig -> Text
catalog} -> Text
catalog) (\s :: DataCatalogConfig
s@DataCatalogConfig' {} Text
a -> DataCatalogConfig
s {$sel:catalog:DataCatalogConfig' :: Text
catalog = Text
a} :: DataCatalogConfig)

-- | The name of the Glue table database.
dataCatalogConfig_database :: Lens.Lens' DataCatalogConfig Prelude.Text
dataCatalogConfig_database :: Lens' DataCatalogConfig Text
dataCatalogConfig_database = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataCatalogConfig' {Text
database :: Text
$sel:database:DataCatalogConfig' :: DataCatalogConfig -> Text
database} -> Text
database) (\s :: DataCatalogConfig
s@DataCatalogConfig' {} Text
a -> DataCatalogConfig
s {$sel:database:DataCatalogConfig' :: Text
database = Text
a} :: DataCatalogConfig)

instance Data.FromJSON DataCatalogConfig where
  parseJSON :: Value -> Parser DataCatalogConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DataCatalogConfig"
      ( \Object
x ->
          Text -> Text -> Text -> DataCatalogConfig
DataCatalogConfig'
            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
"Catalog")
            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
"Database")
      )

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

instance Prelude.NFData DataCatalogConfig where
  rnf :: DataCatalogConfig -> ()
rnf DataCatalogConfig' {Text
database :: Text
catalog :: Text
tableName :: Text
$sel:database:DataCatalogConfig' :: DataCatalogConfig -> Text
$sel:catalog:DataCatalogConfig' :: DataCatalogConfig -> Text
$sel:tableName:DataCatalogConfig' :: DataCatalogConfig -> 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
catalog
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
database

instance Data.ToJSON DataCatalogConfig where
  toJSON :: DataCatalogConfig -> Value
toJSON DataCatalogConfig' {Text
database :: Text
catalog :: Text
tableName :: Text
$sel:database:DataCatalogConfig' :: DataCatalogConfig -> Text
$sel:catalog:DataCatalogConfig' :: DataCatalogConfig -> Text
$sel:tableName:DataCatalogConfig' :: DataCatalogConfig -> 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
"Catalog" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
catalog),
            forall a. a -> Maybe a
Prelude.Just (Key
"Database" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
database)
          ]
      )