{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SageMaker.Types.DataCatalogConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(DataCatalogConfig -> DataCatalogConfig -> Bool)
-> (DataCatalogConfig -> DataCatalogConfig -> Bool)
-> Eq DataCatalogConfig
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]
(Int -> ReadS DataCatalogConfig)
-> ReadS [DataCatalogConfig]
-> ReadPrec DataCatalogConfig
-> ReadPrec [DataCatalogConfig]
-> Read 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
(Int -> DataCatalogConfig -> ShowS)
-> (DataCatalogConfig -> String)
-> ([DataCatalogConfig] -> ShowS)
-> Show DataCatalogConfig
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. DataCatalogConfig -> Rep DataCatalogConfig x)
-> (forall x. Rep DataCatalogConfig x -> DataCatalogConfig)
-> Generic DataCatalogConfig
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' :: Text -> Text -> Text -> DataCatalogConfig
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 :: (Text -> f Text) -> DataCatalogConfig -> f DataCatalogConfig
dataCatalogConfig_tableName = (DataCatalogConfig -> Text)
-> (DataCatalogConfig -> Text -> DataCatalogConfig)
-> Lens DataCatalogConfig DataCatalogConfig Text Text
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 :: (Text -> f Text) -> DataCatalogConfig -> f DataCatalogConfig
dataCatalogConfig_catalog = (DataCatalogConfig -> Text)
-> (DataCatalogConfig -> Text -> DataCatalogConfig)
-> Lens DataCatalogConfig DataCatalogConfig Text Text
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 :: (Text -> f Text) -> DataCatalogConfig -> f DataCatalogConfig
dataCatalogConfig_database = (DataCatalogConfig -> Text)
-> (DataCatalogConfig -> Text -> DataCatalogConfig)
-> Lens DataCatalogConfig DataCatalogConfig Text Text
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 Core.FromJSON DataCatalogConfig where
  parseJSON :: Value -> Parser DataCatalogConfig
parseJSON =
    String
-> (Object -> Parser DataCatalogConfig)
-> Value
-> Parser DataCatalogConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DataCatalogConfig"
      ( \Object
x ->
          Text -> Text -> Text -> DataCatalogConfig
DataCatalogConfig'
            (Text -> Text -> Text -> DataCatalogConfig)
-> Parser Text -> Parser (Text -> Text -> DataCatalogConfig)
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 -> Text -> DataCatalogConfig)
-> Parser Text -> Parser (Text -> DataCatalogConfig)
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
"Catalog")
            Parser (Text -> DataCatalogConfig)
-> Parser Text -> Parser DataCatalogConfig
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
"Database")
      )

instance Prelude.Hashable DataCatalogConfig

instance Prelude.NFData DataCatalogConfig

instance Core.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
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
"Catalog" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
catalog),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Database" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
database)
          ]
      )