{-# 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.DataBrew.Types.DataCatalogInputDefinition
-- 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.DataBrew.Types.DataCatalogInputDefinition where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DataBrew.Types.S3Location
import qualified Amazonka.Prelude as Prelude

-- | Represents how metadata stored in the Glue Data Catalog is defined in a
-- DataBrew dataset.
--
-- /See:/ 'newDataCatalogInputDefinition' smart constructor.
data DataCatalogInputDefinition = DataCatalogInputDefinition'
  { -- | The unique identifier of the Amazon Web Services account that holds the
    -- Data Catalog that stores the data.
    DataCatalogInputDefinition -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
    -- | Represents an Amazon location where DataBrew can store intermediate
    -- results.
    DataCatalogInputDefinition -> Maybe S3Location
tempDirectory :: Prelude.Maybe S3Location,
    -- | The name of a database in the Data Catalog.
    DataCatalogInputDefinition -> Text
databaseName :: Prelude.Text,
    -- | The name of a database table in the Data Catalog. This table corresponds
    -- to a DataBrew dataset.
    DataCatalogInputDefinition -> Text
tableName :: Prelude.Text
  }
  deriving (DataCatalogInputDefinition -> DataCatalogInputDefinition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataCatalogInputDefinition -> DataCatalogInputDefinition -> Bool
$c/= :: DataCatalogInputDefinition -> DataCatalogInputDefinition -> Bool
== :: DataCatalogInputDefinition -> DataCatalogInputDefinition -> Bool
$c== :: DataCatalogInputDefinition -> DataCatalogInputDefinition -> Bool
Prelude.Eq, ReadPrec [DataCatalogInputDefinition]
ReadPrec DataCatalogInputDefinition
Int -> ReadS DataCatalogInputDefinition
ReadS [DataCatalogInputDefinition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataCatalogInputDefinition]
$creadListPrec :: ReadPrec [DataCatalogInputDefinition]
readPrec :: ReadPrec DataCatalogInputDefinition
$creadPrec :: ReadPrec DataCatalogInputDefinition
readList :: ReadS [DataCatalogInputDefinition]
$creadList :: ReadS [DataCatalogInputDefinition]
readsPrec :: Int -> ReadS DataCatalogInputDefinition
$creadsPrec :: Int -> ReadS DataCatalogInputDefinition
Prelude.Read, Int -> DataCatalogInputDefinition -> ShowS
[DataCatalogInputDefinition] -> ShowS
DataCatalogInputDefinition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataCatalogInputDefinition] -> ShowS
$cshowList :: [DataCatalogInputDefinition] -> ShowS
show :: DataCatalogInputDefinition -> String
$cshow :: DataCatalogInputDefinition -> String
showsPrec :: Int -> DataCatalogInputDefinition -> ShowS
$cshowsPrec :: Int -> DataCatalogInputDefinition -> ShowS
Prelude.Show, forall x.
Rep DataCatalogInputDefinition x -> DataCatalogInputDefinition
forall x.
DataCatalogInputDefinition -> Rep DataCatalogInputDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DataCatalogInputDefinition x -> DataCatalogInputDefinition
$cfrom :: forall x.
DataCatalogInputDefinition -> Rep DataCatalogInputDefinition x
Prelude.Generic)

-- |
-- Create a value of 'DataCatalogInputDefinition' 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:
--
-- 'catalogId', 'dataCatalogInputDefinition_catalogId' - The unique identifier of the Amazon Web Services account that holds the
-- Data Catalog that stores the data.
--
-- 'tempDirectory', 'dataCatalogInputDefinition_tempDirectory' - Represents an Amazon location where DataBrew can store intermediate
-- results.
--
-- 'databaseName', 'dataCatalogInputDefinition_databaseName' - The name of a database in the Data Catalog.
--
-- 'tableName', 'dataCatalogInputDefinition_tableName' - The name of a database table in the Data Catalog. This table corresponds
-- to a DataBrew dataset.
newDataCatalogInputDefinition ::
  -- | 'databaseName'
  Prelude.Text ->
  -- | 'tableName'
  Prelude.Text ->
  DataCatalogInputDefinition
newDataCatalogInputDefinition :: Text -> Text -> DataCatalogInputDefinition
newDataCatalogInputDefinition
  Text
pDatabaseName_
  Text
pTableName_ =
    DataCatalogInputDefinition'
      { $sel:catalogId:DataCatalogInputDefinition' :: Maybe Text
catalogId =
          forall a. Maybe a
Prelude.Nothing,
        $sel:tempDirectory:DataCatalogInputDefinition' :: Maybe S3Location
tempDirectory = forall a. Maybe a
Prelude.Nothing,
        $sel:databaseName:DataCatalogInputDefinition' :: Text
databaseName = Text
pDatabaseName_,
        $sel:tableName:DataCatalogInputDefinition' :: Text
tableName = Text
pTableName_
      }

-- | The unique identifier of the Amazon Web Services account that holds the
-- Data Catalog that stores the data.
dataCatalogInputDefinition_catalogId :: Lens.Lens' DataCatalogInputDefinition (Prelude.Maybe Prelude.Text)
dataCatalogInputDefinition_catalogId :: Lens' DataCatalogInputDefinition (Maybe Text)
dataCatalogInputDefinition_catalogId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataCatalogInputDefinition' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:DataCatalogInputDefinition' :: DataCatalogInputDefinition -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: DataCatalogInputDefinition
s@DataCatalogInputDefinition' {} Maybe Text
a -> DataCatalogInputDefinition
s {$sel:catalogId:DataCatalogInputDefinition' :: Maybe Text
catalogId = Maybe Text
a} :: DataCatalogInputDefinition)

-- | Represents an Amazon location where DataBrew can store intermediate
-- results.
dataCatalogInputDefinition_tempDirectory :: Lens.Lens' DataCatalogInputDefinition (Prelude.Maybe S3Location)
dataCatalogInputDefinition_tempDirectory :: Lens' DataCatalogInputDefinition (Maybe S3Location)
dataCatalogInputDefinition_tempDirectory = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataCatalogInputDefinition' {Maybe S3Location
tempDirectory :: Maybe S3Location
$sel:tempDirectory:DataCatalogInputDefinition' :: DataCatalogInputDefinition -> Maybe S3Location
tempDirectory} -> Maybe S3Location
tempDirectory) (\s :: DataCatalogInputDefinition
s@DataCatalogInputDefinition' {} Maybe S3Location
a -> DataCatalogInputDefinition
s {$sel:tempDirectory:DataCatalogInputDefinition' :: Maybe S3Location
tempDirectory = Maybe S3Location
a} :: DataCatalogInputDefinition)

-- | The name of a database in the Data Catalog.
dataCatalogInputDefinition_databaseName :: Lens.Lens' DataCatalogInputDefinition Prelude.Text
dataCatalogInputDefinition_databaseName :: Lens' DataCatalogInputDefinition Text
dataCatalogInputDefinition_databaseName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataCatalogInputDefinition' {Text
databaseName :: Text
$sel:databaseName:DataCatalogInputDefinition' :: DataCatalogInputDefinition -> Text
databaseName} -> Text
databaseName) (\s :: DataCatalogInputDefinition
s@DataCatalogInputDefinition' {} Text
a -> DataCatalogInputDefinition
s {$sel:databaseName:DataCatalogInputDefinition' :: Text
databaseName = Text
a} :: DataCatalogInputDefinition)

-- | The name of a database table in the Data Catalog. This table corresponds
-- to a DataBrew dataset.
dataCatalogInputDefinition_tableName :: Lens.Lens' DataCatalogInputDefinition Prelude.Text
dataCatalogInputDefinition_tableName :: Lens' DataCatalogInputDefinition Text
dataCatalogInputDefinition_tableName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataCatalogInputDefinition' {Text
tableName :: Text
$sel:tableName:DataCatalogInputDefinition' :: DataCatalogInputDefinition -> Text
tableName} -> Text
tableName) (\s :: DataCatalogInputDefinition
s@DataCatalogInputDefinition' {} Text
a -> DataCatalogInputDefinition
s {$sel:tableName:DataCatalogInputDefinition' :: Text
tableName = Text
a} :: DataCatalogInputDefinition)

instance Data.FromJSON DataCatalogInputDefinition where
  parseJSON :: Value -> Parser DataCatalogInputDefinition
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DataCatalogInputDefinition"
      ( \Object
x ->
          Maybe Text
-> Maybe S3Location -> Text -> Text -> DataCatalogInputDefinition
DataCatalogInputDefinition'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CatalogId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"TempDirectory")
            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")
            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
"TableName")
      )

instance Prelude.Hashable DataCatalogInputDefinition where
  hashWithSalt :: Int -> DataCatalogInputDefinition -> Int
hashWithSalt Int
_salt DataCatalogInputDefinition' {Maybe Text
Maybe S3Location
Text
tableName :: Text
databaseName :: Text
tempDirectory :: Maybe S3Location
catalogId :: Maybe Text
$sel:tableName:DataCatalogInputDefinition' :: DataCatalogInputDefinition -> Text
$sel:databaseName:DataCatalogInputDefinition' :: DataCatalogInputDefinition -> Text
$sel:tempDirectory:DataCatalogInputDefinition' :: DataCatalogInputDefinition -> Maybe S3Location
$sel:catalogId:DataCatalogInputDefinition' :: DataCatalogInputDefinition -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
catalogId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3Location
tempDirectory
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
databaseName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
tableName

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

instance Data.ToJSON DataCatalogInputDefinition where
  toJSON :: DataCatalogInputDefinition -> Value
toJSON DataCatalogInputDefinition' {Maybe Text
Maybe S3Location
Text
tableName :: Text
databaseName :: Text
tempDirectory :: Maybe S3Location
catalogId :: Maybe Text
$sel:tableName:DataCatalogInputDefinition' :: DataCatalogInputDefinition -> Text
$sel:databaseName:DataCatalogInputDefinition' :: DataCatalogInputDefinition -> Text
$sel:tempDirectory:DataCatalogInputDefinition' :: DataCatalogInputDefinition -> Maybe S3Location
$sel:catalogId:DataCatalogInputDefinition' :: DataCatalogInputDefinition -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"CatalogId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
catalogId,
            (Key
"TempDirectory" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3Location
tempDirectory,
            forall a. a -> Maybe a
Prelude.Just (Key
"DatabaseName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
databaseName),
            forall a. a -> Maybe a
Prelude.Just (Key
"TableName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
tableName)
          ]
      )