{-# 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.Glue.Types.OracleSQLCatalogSource
-- 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.Glue.Types.OracleSQLCatalogSource 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

-- | Specifies an Oracle data source in the Glue Data Catalog.
--
-- /See:/ 'newOracleSQLCatalogSource' smart constructor.
data OracleSQLCatalogSource = OracleSQLCatalogSource'
  { -- | The name of the data source.
    OracleSQLCatalogSource -> Text
name :: Prelude.Text,
    -- | The name of the database to read from.
    OracleSQLCatalogSource -> Text
database :: Prelude.Text,
    -- | The name of the table in the database to read from.
    OracleSQLCatalogSource -> Text
table :: Prelude.Text
  }
  deriving (OracleSQLCatalogSource -> OracleSQLCatalogSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OracleSQLCatalogSource -> OracleSQLCatalogSource -> Bool
$c/= :: OracleSQLCatalogSource -> OracleSQLCatalogSource -> Bool
== :: OracleSQLCatalogSource -> OracleSQLCatalogSource -> Bool
$c== :: OracleSQLCatalogSource -> OracleSQLCatalogSource -> Bool
Prelude.Eq, ReadPrec [OracleSQLCatalogSource]
ReadPrec OracleSQLCatalogSource
Int -> ReadS OracleSQLCatalogSource
ReadS [OracleSQLCatalogSource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OracleSQLCatalogSource]
$creadListPrec :: ReadPrec [OracleSQLCatalogSource]
readPrec :: ReadPrec OracleSQLCatalogSource
$creadPrec :: ReadPrec OracleSQLCatalogSource
readList :: ReadS [OracleSQLCatalogSource]
$creadList :: ReadS [OracleSQLCatalogSource]
readsPrec :: Int -> ReadS OracleSQLCatalogSource
$creadsPrec :: Int -> ReadS OracleSQLCatalogSource
Prelude.Read, Int -> OracleSQLCatalogSource -> ShowS
[OracleSQLCatalogSource] -> ShowS
OracleSQLCatalogSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OracleSQLCatalogSource] -> ShowS
$cshowList :: [OracleSQLCatalogSource] -> ShowS
show :: OracleSQLCatalogSource -> String
$cshow :: OracleSQLCatalogSource -> String
showsPrec :: Int -> OracleSQLCatalogSource -> ShowS
$cshowsPrec :: Int -> OracleSQLCatalogSource -> ShowS
Prelude.Show, forall x. Rep OracleSQLCatalogSource x -> OracleSQLCatalogSource
forall x. OracleSQLCatalogSource -> Rep OracleSQLCatalogSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OracleSQLCatalogSource x -> OracleSQLCatalogSource
$cfrom :: forall x. OracleSQLCatalogSource -> Rep OracleSQLCatalogSource x
Prelude.Generic)

-- |
-- Create a value of 'OracleSQLCatalogSource' 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:
--
-- 'name', 'oracleSQLCatalogSource_name' - The name of the data source.
--
-- 'database', 'oracleSQLCatalogSource_database' - The name of the database to read from.
--
-- 'table', 'oracleSQLCatalogSource_table' - The name of the table in the database to read from.
newOracleSQLCatalogSource ::
  -- | 'name'
  Prelude.Text ->
  -- | 'database'
  Prelude.Text ->
  -- | 'table'
  Prelude.Text ->
  OracleSQLCatalogSource
newOracleSQLCatalogSource :: Text -> Text -> Text -> OracleSQLCatalogSource
newOracleSQLCatalogSource Text
pName_ Text
pDatabase_ Text
pTable_ =
  OracleSQLCatalogSource'
    { $sel:name:OracleSQLCatalogSource' :: Text
name = Text
pName_,
      $sel:database:OracleSQLCatalogSource' :: Text
database = Text
pDatabase_,
      $sel:table:OracleSQLCatalogSource' :: Text
table = Text
pTable_
    }

-- | The name of the data source.
oracleSQLCatalogSource_name :: Lens.Lens' OracleSQLCatalogSource Prelude.Text
oracleSQLCatalogSource_name :: Lens' OracleSQLCatalogSource Text
oracleSQLCatalogSource_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OracleSQLCatalogSource' {Text
name :: Text
$sel:name:OracleSQLCatalogSource' :: OracleSQLCatalogSource -> Text
name} -> Text
name) (\s :: OracleSQLCatalogSource
s@OracleSQLCatalogSource' {} Text
a -> OracleSQLCatalogSource
s {$sel:name:OracleSQLCatalogSource' :: Text
name = Text
a} :: OracleSQLCatalogSource)

-- | The name of the database to read from.
oracleSQLCatalogSource_database :: Lens.Lens' OracleSQLCatalogSource Prelude.Text
oracleSQLCatalogSource_database :: Lens' OracleSQLCatalogSource Text
oracleSQLCatalogSource_database = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OracleSQLCatalogSource' {Text
database :: Text
$sel:database:OracleSQLCatalogSource' :: OracleSQLCatalogSource -> Text
database} -> Text
database) (\s :: OracleSQLCatalogSource
s@OracleSQLCatalogSource' {} Text
a -> OracleSQLCatalogSource
s {$sel:database:OracleSQLCatalogSource' :: Text
database = Text
a} :: OracleSQLCatalogSource)

-- | The name of the table in the database to read from.
oracleSQLCatalogSource_table :: Lens.Lens' OracleSQLCatalogSource Prelude.Text
oracleSQLCatalogSource_table :: Lens' OracleSQLCatalogSource Text
oracleSQLCatalogSource_table = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OracleSQLCatalogSource' {Text
table :: Text
$sel:table:OracleSQLCatalogSource' :: OracleSQLCatalogSource -> Text
table} -> Text
table) (\s :: OracleSQLCatalogSource
s@OracleSQLCatalogSource' {} Text
a -> OracleSQLCatalogSource
s {$sel:table:OracleSQLCatalogSource' :: Text
table = Text
a} :: OracleSQLCatalogSource)

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

instance Prelude.Hashable OracleSQLCatalogSource where
  hashWithSalt :: Int -> OracleSQLCatalogSource -> Int
hashWithSalt Int
_salt OracleSQLCatalogSource' {Text
table :: Text
database :: Text
name :: Text
$sel:table:OracleSQLCatalogSource' :: OracleSQLCatalogSource -> Text
$sel:database:OracleSQLCatalogSource' :: OracleSQLCatalogSource -> Text
$sel:name:OracleSQLCatalogSource' :: OracleSQLCatalogSource -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
database
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
table

instance Prelude.NFData OracleSQLCatalogSource where
  rnf :: OracleSQLCatalogSource -> ()
rnf OracleSQLCatalogSource' {Text
table :: Text
database :: Text
name :: Text
$sel:table:OracleSQLCatalogSource' :: OracleSQLCatalogSource -> Text
$sel:database:OracleSQLCatalogSource' :: OracleSQLCatalogSource -> Text
$sel:name:OracleSQLCatalogSource' :: OracleSQLCatalogSource -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
database
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
table

instance Data.ToJSON OracleSQLCatalogSource where
  toJSON :: OracleSQLCatalogSource -> Value
toJSON OracleSQLCatalogSource' {Text
table :: Text
database :: Text
name :: Text
$sel:table:OracleSQLCatalogSource' :: OracleSQLCatalogSource -> Text
$sel:database:OracleSQLCatalogSource' :: OracleSQLCatalogSource -> Text
$sel:name:OracleSQLCatalogSource' :: OracleSQLCatalogSource -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"Database" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
database),
            forall a. a -> Maybe a
Prelude.Just (Key
"Table" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
table)
          ]
      )